diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-07-27 04:20:32 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-07-27 04:20:32 +0200 |
commit | c450437a4e631378cd6a2dc06a5923ce811a950d (patch) | |
tree | 448ad0b6599a5365dedd8f78960957a722c0aecb | |
parent | 8dd676c6c3b862846a4a215f5f3a8822fcf8c569 (diff) | |
download | busybox-w32-c450437a4e631378cd6a2dc06a5923ce811a950d.tar.gz busybox-w32-c450437a4e631378cd6a2dc06a5923ce811a950d.tar.bz2 busybox-w32-c450437a4e631378cd6a2dc06a5923ce811a950d.zip |
shell: update psubst testcases
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/ash_test/ash-psubst/falsetick.right | 24 | ||||
-rwxr-xr-x | shell/ash_test/ash-psubst/falsetick.tests | 19 | ||||
-rw-r--r-- | shell/ash_test/ash-psubst/falsetick2.right | 1 | ||||
-rwxr-xr-x | shell/ash_test/ash-psubst/falsetick2.tests | 3 | ||||
-rw-r--r-- | shell/hush_test/hush-psubst/falsetick.right | 3 | ||||
-rwxr-xr-x | shell/hush_test/hush-psubst/falsetick.tests | 3 | ||||
-rw-r--r-- | shell/hush_test/hush-psubst/falsetick3.right | 3 | ||||
-rwxr-xr-x | shell/hush_test/hush-psubst/falsetick3.tests | 3 |
8 files changed, 53 insertions, 6 deletions
diff --git a/shell/ash_test/ash-psubst/falsetick.right b/shell/ash_test/ash-psubst/falsetick.right new file mode 100644 index 000000000..0335254a8 --- /dev/null +++ b/shell/ash_test/ash-psubst/falsetick.right | |||
@@ -0,0 +1,24 @@ | |||
1 | 0 | ||
2 | 0 | ||
3 | 0 | ||
4 | 0 | ||
5 | 2 | ||
6 | 2 | ||
7 | 2 | ||
8 | 2 | ||
9 | ./falsetick.tests: line 12: can't create /does/not/exist: nonexistent directory | ||
10 | 1 | ||
11 | ./falsetick.tests: line 13: can't create /does/not/exist: nonexistent directory | ||
12 | 1 | ||
13 | ./falsetick.tests: line 14: can't create /does/not/exist: nonexistent directory | ||
14 | 1 | ||
15 | ./falsetick.tests: line 15: can't create /does/not/exist: nonexistent directory | ||
16 | 1 | ||
17 | ./falsetick.tests: line 16: can't create /does/not/exist: nonexistent directory | ||
18 | 1 | ||
19 | ./falsetick.tests: line 17: can't create /does/not/exist: nonexistent directory | ||
20 | 1 | ||
21 | ./falsetick.tests: line 18: can't create /does/not/exist: nonexistent directory | ||
22 | 1 | ||
23 | ./falsetick.tests: line 19: can't create /does/not/exist: nonexistent directory | ||
24 | 1 | ||
diff --git a/shell/ash_test/ash-psubst/falsetick.tests b/shell/ash_test/ash-psubst/falsetick.tests new file mode 100755 index 000000000..d2b93695e --- /dev/null +++ b/shell/ash_test/ash-psubst/falsetick.tests | |||
@@ -0,0 +1,19 @@ | |||
1 | # Exitcode 0 (`` has no exitcode, but assignment has): | ||
2 | true; a=``; echo $? | ||
3 | false; a=``; echo $? | ||
4 | true; a=$(); echo $? | ||
5 | false; a=$(); echo $? | ||
6 | # Exitcode 2 (`cmd` expansion sets exitcode after assignment set it to 0): | ||
7 | true; a=`exit 2`; echo $? | ||
8 | false; a=`exit 2`; echo $? | ||
9 | true; a=$(exit 2); echo $? | ||
10 | false; a=$(exit 2); echo $? | ||
11 | # Exitcode 1 (redirect sets exitcode to 1 on error after them): | ||
12 | true; a=`` >/does/not/exist; echo $? | ||
13 | false; a=`` >/does/not/exist; echo $? | ||
14 | true; a=$() >/does/not/exist; echo $? | ||
15 | false; a=$() >/does/not/exist; echo $? | ||
16 | true; a=`exit 2` >/does/not/exist; echo $? | ||
17 | false; a=`exit 2` >/does/not/exist; echo $? | ||
18 | true; a=$(exit 2) >/does/not/exist; echo $? | ||
19 | false; a=$(exit 2) >/does/not/exist; echo $? | ||
diff --git a/shell/ash_test/ash-psubst/falsetick2.right b/shell/ash_test/ash-psubst/falsetick2.right new file mode 100644 index 000000000..670f560f1 --- /dev/null +++ b/shell/ash_test/ash-psubst/falsetick2.right | |||
@@ -0,0 +1 @@ | |||
Two:2 v:[] | |||
diff --git a/shell/ash_test/ash-psubst/falsetick2.tests b/shell/ash_test/ash-psubst/falsetick2.tests new file mode 100755 index 000000000..cfbd1a5de --- /dev/null +++ b/shell/ash_test/ash-psubst/falsetick2.tests | |||
@@ -0,0 +1,3 @@ | |||
1 | v=v | ||
2 | v=`exit 2` `false` | ||
3 | echo Two:$? v:"[$v]" | ||
diff --git a/shell/hush_test/hush-psubst/falsetick.right b/shell/hush_test/hush-psubst/falsetick.right index 0b98fb778..d2d1a2880 100644 --- a/shell/hush_test/hush-psubst/falsetick.right +++ b/shell/hush_test/hush-psubst/falsetick.right | |||
@@ -22,6 +22,3 @@ hush: can't open '/does/not/exist': No such file or directory | |||
22 | 1 | 22 | 1 |
23 | hush: can't open '/does/not/exist': No such file or directory | 23 | hush: can't open '/does/not/exist': No such file or directory |
24 | 1 | 24 | 1 |
25 | hush: can't open '/does/not/exist': No such file or directory | ||
26 | 1 | ||
27 | Done: a=b | ||
diff --git a/shell/hush_test/hush-psubst/falsetick.tests b/shell/hush_test/hush-psubst/falsetick.tests index 44d2eae8b..d2b93695e 100755 --- a/shell/hush_test/hush-psubst/falsetick.tests +++ b/shell/hush_test/hush-psubst/falsetick.tests | |||
@@ -17,6 +17,3 @@ true; a=`exit 2` >/does/not/exist; echo $? | |||
17 | false; a=`exit 2` >/does/not/exist; echo $? | 17 | false; a=`exit 2` >/does/not/exist; echo $? |
18 | true; a=$(exit 2) >/does/not/exist; echo $? | 18 | true; a=$(exit 2) >/does/not/exist; echo $? |
19 | false; a=$(exit 2) >/does/not/exist; echo $? | 19 | false; a=$(exit 2) >/does/not/exist; echo $? |
20 | # ...and assignment still happens despite redirect error: | ||
21 | true; a=$(echo b) >/does/not/exist; echo $? | ||
22 | echo "Done: a=$a" | ||
diff --git a/shell/hush_test/hush-psubst/falsetick3.right b/shell/hush_test/hush-psubst/falsetick3.right new file mode 100644 index 000000000..327849a31 --- /dev/null +++ b/shell/hush_test/hush-psubst/falsetick3.right | |||
@@ -0,0 +1,3 @@ | |||
1 | hush: can't open '/does/not/exist': No such file or directory | ||
2 | 1 | ||
3 | Done: a=b | ||
diff --git a/shell/hush_test/hush-psubst/falsetick3.tests b/shell/hush_test/hush-psubst/falsetick3.tests new file mode 100755 index 000000000..cd185335e --- /dev/null +++ b/shell/hush_test/hush-psubst/falsetick3.tests | |||
@@ -0,0 +1,3 @@ | |||
1 | # assignment still happens despite redirect error | ||
2 | true; a=$(echo b) >/does/not/exist; echo $? | ||
3 | echo "Done: a=$a" | ||