diff options
Diffstat (limited to 'testsuite/env.tests')
-rwxr-xr-x | testsuite/env.tests | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/testsuite/env.tests b/testsuite/env.tests new file mode 100755 index 000000000..8b810e44b --- /dev/null +++ b/testsuite/env.tests | |||
@@ -0,0 +1,71 @@ | |||
1 | #!/bin/sh | ||
2 | # Copyright 2022 by Ron Yorston | ||
3 | # Licensed under GPLv2, see file LICENSE in this source tree. | ||
4 | |||
5 | . ./testing.sh | ||
6 | |||
7 | # testing "test name" "commands" "expected result" "file input" "stdin" | ||
8 | |||
9 | optional PLATFORM_MINGW32 | ||
10 | # Not so much a test of 'env' as of whether environment variables | ||
11 | # (or the lack thereof) are correctly passed to child processes. | ||
12 | testing "environment variables 1a" \ | ||
13 | "V=set env sh -c 'env | grep ^V='" \ | ||
14 | "V=set | ||
15 | " "" "" | ||
16 | |||
17 | testing "environment variables 1b" \ | ||
18 | "V= env sh -c 'env | grep ^V='" \ | ||
19 | "V= | ||
20 | " "" "" | ||
21 | |||
22 | testing "environment variables 1c" \ | ||
23 | "env sh -c 'env | grep ^V='" \ | ||
24 | "" "" "" | ||
25 | |||
26 | testing "environment variables 2a" \ | ||
27 | "V=set sh -c 'env | grep ^V='" \ | ||
28 | "V=set | ||
29 | " "" "" | ||
30 | |||
31 | testing "environment variables 2b" \ | ||
32 | "V= sh -c 'env | grep ^V='" \ | ||
33 | "V= | ||
34 | " "" "" | ||
35 | |||
36 | testing "environment variables 2c" \ | ||
37 | "sh -c 'env | grep ^V='" \ | ||
38 | "" "" "" | ||
39 | |||
40 | testing "environment variables 3a" \ | ||
41 | "V=set env sh -c 'echo \${V-unset}'" \ | ||
42 | "set | ||
43 | " "" "" | ||
44 | |||
45 | testing "environment variables 3b" \ | ||
46 | "V= env sh -c 'echo \${V-unset}'" \ | ||
47 | " | ||
48 | " "" "" | ||
49 | |||
50 | testing "environment variables 3c" \ | ||
51 | "env sh -c 'echo \${V-unset}'" \ | ||
52 | "unset | ||
53 | " "" "" | ||
54 | |||
55 | testing "environment variables 4a" \ | ||
56 | "V=set sh -c 'echo \${V-unset}'" \ | ||
57 | "set | ||
58 | " "" "" | ||
59 | |||
60 | testing "environment variables 4b" \ | ||
61 | "V= sh -c 'echo \${V-unset}'" \ | ||
62 | " | ||
63 | " "" "" | ||
64 | |||
65 | testing "environment variables 4c" \ | ||
66 | "sh -c 'echo \${V-unset}'" \ | ||
67 | "unset | ||
68 | " "" "" | ||
69 | SKIP= | ||
70 | |||
71 | exit $FAILCOUNT | ||