Change debconf text to claim that the default /bin/sh is dash instead of bash. close...
[posh.git] / tests / parameters.t
blob1410227f64912e4ee5148c5bba3e7c74487304e3
1 # These tests deal with parameters
3 name: parameters-1
4 description:
5         Check setting of positional parameters
6 category: debian,posix
7 stdin:
8         set -- To comply or not to comply.  That is the question.
9         echo 1: $1
10         echo 2: $2
11         echo 3: $3
12         echo 4: $4
13         echo 5: $5
14         echo 6: $6
15         echo 7: $7
16         echo 8: $8
17         echo 9: $9
18         echo 10: $10
19         echo 10 again, with feeling: ${10}
20 expected-stdout:
21         1: To
22         2: comply
23         3: or
24         4: not
25         5: to
26         6: comply.
27         7: That
28         8: is
29         9: the
30         10: To0
31         10 again, with feeling: question.
32 ---
33 name: parameters-2
34 description:
35         Check expansion of special parameters
36 category: debian,posix
37 stdin:
38         set -- To comply or not to comply.  That was the question.
39         echo $@
40         echo "$@"
41         echo $*
42         echo "$*"
43         echo This should be 10: $#.
44         echo Now once more with IFS changed.
45         IFS=":"
46         echo $@
47         echo "$@"
48         echo $*
49         echo "$*"
50         echo That was exciting.
51         echo "Exit status: $?"
52 expected-stdout:
53         To comply or not to comply. That was the question.
54         To comply or not to comply. That was the question.
55         To comply or not to comply. That was the question.
56         To comply or not to comply. That was the question.
57         This should be 10: 10.
58         Now once more with IFS changed.
59         To comply or not to comply. That was the question.
60         To comply or not to comply. That was the question.
61         To comply or not to comply. That was the question.
62         To:comply:or:not:to:comply.:That:was:the:question.
63         That was exciting.
64         Exit status: 0
65 ---
66 name: parameters-3
67 description:
68         Check PWD parameter
69 category: debian,posix
70 stdin:
71         cd /
72         pwd
73         /bin/pwd
74         echo $PWD
75 expected-stdout:
76         /
77         /
78         /
79 ---
80 name: parameters-4
81 description:
82         Check parameter expansions
83 category: debian,posix
84 stdin:
85         FULLPARAMETER="yes"
86         NULLPARAMETER=""
87         echo ${FULLPARAMETER:-one}
88         echo ${EMPTYPARAMETER:-two}
89         echo ${NULLPARAMETER:-three}
90         echo ${FULLPARAMETER-four}
91         echo ${EMPTYPARAMETER-five}
92         echo ${NULLPARAMETER-six}
93         echo ${FULLPARAMETER:=seven}
94         echo ${EMPTYPARAMETER:=eight}
95         echo ${FULLPARAMETER:+nine}
96         echo ${EMPTYPARAMETER:+ten}
97         echo ${NEWEMPTYPARAMETER:+eleven}
98         echo ${NULLPARAMETER:+twelve}
99         echo ${FULLPARAMETER+thirteen}
100         echo ${EMPTYPARAMETER+fourteen}
101         echo ${NEWEMPTYPARAMETER+fifteen}
102         echo ${NULLPARAMETER?seventeen}
103         echo ${FULLPARAMETER:?eighteen}
104         echo ${EMPTYPARAMETER:?nineteen}
105 expected-stdout:
106         yes
107         two
108         three
109         yes
110         five
111         
112         yes
113         eight
114         nine
115         ten
116         
117         
118         thirteen
119         fourteen
120         
121         
122         yes
123         eight
125 name: parameters-5
126 description:
127         Check parameter expansion substrings
128 category: debian,posix
129 stdin:
130         TESTSTRING="abcDEF"
131         echo ${TESTSTRING%[A-Z]?}
132         echo ${TESTSTRING%%[A-Z]?}
133         echo ${TESTSTRING#[a-z]?}
134         echo ${TESTSTRING##[a-z]?}
135 expected-stdout:
136         abcD
137         abcD
138         cDEF
139         cDEF