aboutsummaryrefslogtreecommitdiff
path: root/tests/test/script/runner/redirect.test
blob: a49cd3c5c3da7939bb25f681a4108501c68cbede (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# file      : tests/test/script/runner/redirect.test
# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
# license   : MIT; see accompanying LICENSE file

$* -o foo >-                                         # out-null
$* -e foo 2>-                                        # err-null
$* -i 0 <foo                                         # in-str
$* -o foo >foo                                       # out-str
$* -e foo 2>foo                                      # err-str
$* -i 1 <foo >foo                                    # inout-str
$* -i 2 <foo 2>foo                                   # inerr-str
$* -i 1 -e bar <foo 1>foo 2>bar                      # inout-err-str

$* -i 0 <<EOO                                        # in-doc
foo
bar
EOO

$* -o foo -o bar >>EOO                               # out-doc
foo
bar
EOO

$* -e foo -e bar 2>>EOO                              # err-doc
foo
bar
EOO

$* -i 1 <<EOI >>EOO                                  # inout-doc
foo
bar
EOI
foo
bar
EOO

$* -i 2 <<EOI 2>>EOE                                 # inerr-doc
foo
bar
EOI
foo
bar
EOE

$* -i 1 -e bar -e baz -s 2 <<EOI 1>>EOO 2>>EOE == 2  # inout-err-doc-status
foo
bar
EOI
foo
bar
EOO
bar
baz
EOE

$* -i 1 -e "" <<EOI >>EOO 2>""                       # empty-str-doc
EOI
EOO

$* -i 1 <<EOI >>EOO                                  # nl-containing-doc

EOI

EOO

# No-newline tests.
#
# @@ TMP Need does not compare test.
#
$* -i 1 <:"foo" >:"foo"                              # no-newline-str
#\
$* -i 1 <:"foo" >!"foo"                              # no-newline-str-fail1
$* -i 1 <"foo"  >:!"foo"                             # no-newline-str-fail2
#\

$* -i 1 <<:EOI >>:EOO                                # no-newline-doc
foo
EOI
foo
EOO

#\
$* -i 1 <<:EOI >>!EOO                                # no-newline-doc-fail1
foo
EOI
foo
EOO

$* -i 1 <<EOI >>:!EOO                                # no-newline-doc-fail2
foo
EOI
foo
EOO
#\

$* -i 1 <<:EOI >>:EOO 2>:""                          # no-newline-empty-str-doc
EOI
EOO

$* -i 1 <<:EOI >>:EOO                                # no-newline-nl-cont-doc

EOI

EOO

$* -o foo >>>out;                                    # file
$* -e bar 2>>>&out;
$* -i 1 <<<out >>EOO
foo
bar
EOO

$* -o foo -e bar 2>>EOE 1>&2                         # merge-str
foo
bar
EOE

$* -i 1 <<EOI -e baz >>EOO 2>&1                      # merge-doc
foo
bar
EOI
foo
bar
baz
EOO

$* -o foo -e bar 2>&1 >>>out;                        # merge-file
$* -e baz -o biz 1>&2 2>>>&out;
$* -i 1 <<<out >>EOO
foo
bar
baz
biz
EOO