Finish TEST_SH - all tests should support it now. Misc other KNF changes, minor bug fixes, and a few minor extra tests added. (from kre@)diff -r1.1 -r1.2 src/tests/bin/sh/t_evaltested.sh
(christos)
--- src/tests/bin/sh/t_evaltested.sh 2012/03/17 16:33:11 1.1
+++ src/tests/bin/sh/t_evaltested.sh 2016/03/27 14:50:01 1.2
@@ -1,59 +1,61 @@ | @@ -1,59 +1,61 @@ | |||
1 | # $NetBSD: t_evaltested.sh,v 1.1 2012/03/17 16:33:11 jruoho Exp $ | 1 | # $NetBSD: t_evaltested.sh,v 1.2 2016/03/27 14:50:01 christos Exp $ | |
2 | # | 2 | # | |
3 | # Copyright (c) 2011 The NetBSD Foundation, Inc. | 3 | # Copyright (c) 2011 The NetBSD Foundation, Inc. | |
4 | # All rights reserved. | 4 | # All rights reserved. | |
5 | # | 5 | # | |
6 | # Redistribution and use in source and binary forms, with or without | 6 | # Redistribution and use in source and binary forms, with or without | |
7 | # modification, are permitted provided that the following conditions | 7 | # modification, are permitted provided that the following conditions | |
8 | # are met: | 8 | # are met: | |
9 | # 1. Redistributions of source code must retain the above copyright | 9 | # 1. Redistributions of source code must retain the above copyright | |
10 | # notice, this list of conditions and the following disclaimer. | 10 | # notice, this list of conditions and the following disclaimer. | |
11 | # 2. Redistributions in binary form must reproduce the above copyright | 11 | # 2. Redistributions in binary form must reproduce the above copyright | |
12 | # notice, this list of conditions and the following disclaimer in the | 12 | # notice, this list of conditions and the following disclaimer in the | |
13 | # documentation and/or other materials provided with the distribution. | 13 | # documentation and/or other materials provided with the distribution. | |
14 | # | 14 | # | |
15 | # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 15 | # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
16 | # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 16 | # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
17 | # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 17 | # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
18 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 18 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
19 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 19 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
20 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 20 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
21 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 21 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
22 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 22 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
23 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 23 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
24 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 24 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
25 | # POSSIBILITY OF SUCH DAMAGE. | 25 | # POSSIBILITY OF SUCH DAMAGE. | |
26 | # | 26 | # | |
27 | # the implementation of "sh" to test | |||
28 | : ${TEST_SH:="/bin/sh"} | |||
27 | 29 | |||
28 | atf_test_case evaltested | 30 | atf_test_case evaltested | |
29 | 31 | |||
30 | evaltested_head() { | 32 | evaltested_head() { | |
31 | atf_set "descr" "Tests that eval in a tested context does not exit" | 33 | atf_set "descr" "Tests that eval in a tested context does not exit" | |
32 | } | 34 | } | |
33 | 35 | |||
34 | evaltested_body() { | 36 | evaltested_body() { | |
35 | set -e | 37 | set -e | |
36 | cat > helper.sh << EOF | 38 | cat > helper.sh << EOF | |
37 | set -e | 39 | set -e | |
38 | if eval false | 40 | if eval false | |
39 | then | 41 | then | |
40 | echo "'eval false' returned true" | 42 | echo "'eval false' returned true" | |
41 | exit 1 | 43 | exit 1 | |
42 | fi | 44 | fi | |
43 | echo "passed" | 45 | echo "passed" | |
44 | exit 0 | 46 | exit 0 | |
45 | EOF | 47 | EOF | |
46 | output="$(/bin/sh helper.sh)" | 48 | output="$($TEST_SH helper.sh)" | |
47 | [ $? = 0 ] && return | 49 | [ $? = 0 ] && return | |
48 | 50 | |||
49 | if [ -n "$output" ] | 51 | if [ -n "$output" ] | |
50 | then | 52 | then | |
51 | atf_fail "$output" | 53 | atf_fail "$output" | |
52 | else | 54 | else | |
53 | atf_fail "'eval false' exited from a tested context" | 55 | atf_fail "'eval false' exited from a tested context" | |
54 | fi | 56 | fi | |
55 | 57 | |||
56 | } | 58 | } | |
57 | 59 | |||
58 | atf_init_test_cases() { | 60 | atf_init_test_cases() { | |
59 | atf_add_test_case evaltested | 61 | atf_add_test_case evaltested |
--- src/tests/bin/sh/t_fsplit.sh 2016/03/10 22:30:57 1.3
+++ src/tests/bin/sh/t_fsplit.sh 2016/03/27 14:50:01 1.4
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: t_fsplit.sh,v 1.3 2016/03/10 22:30:57 christos Exp $ | 1 | # $NetBSD: t_fsplit.sh,v 1.4 2016/03/27 14:50:01 christos Exp $ | |
2 | # | 2 | # | |
3 | # Copyright (c) 2007-2016 The NetBSD Foundation, Inc. | 3 | # Copyright (c) 2007-2016 The NetBSD Foundation, Inc. | |
4 | # All rights reserved. | 4 | # All rights reserved. | |
5 | # | 5 | # | |
6 | # Redistribution and use in source and binary forms, with or without | 6 | # Redistribution and use in source and binary forms, with or without | |
7 | # modification, are permitted provided that the following conditions | 7 | # modification, are permitted provided that the following conditions | |
8 | # are met: | 8 | # are met: | |
9 | # 1. Redistributions of source code must retain the above copyright | 9 | # 1. Redistributions of source code must retain the above copyright | |
10 | # notice, this list of conditions and the following disclaimer. | 10 | # notice, this list of conditions and the following disclaimer. | |
11 | # 2. Redistributions in binary form must reproduce the above copyright | 11 | # 2. Redistributions in binary form must reproduce the above copyright | |
12 | # notice, this list of conditions and the following disclaimer in the | 12 | # notice, this list of conditions and the following disclaimer in the | |
13 | # documentation and/or other materials provided with the distribution. | 13 | # documentation and/or other materials provided with the distribution. | |
14 | # | 14 | # | |
@@ -284,26 +284,31 @@ dollar_at_body() { | @@ -284,26 +284,31 @@ dollar_at_body() { | |||
284 | check 'set ""; for i in "$@"; do echo "z${i}z"; done' 'zz' | 284 | check 'set ""; for i in "$@"; do echo "z${i}z"; done' 'zz' | |
285 | check 'set "" ""; for i; do echo "z${i}z"; done' 'zz zz' | 285 | check 'set "" ""; for i; do echo "z${i}z"; done' 'zz zz' | |
286 | check 'set "" ""; for i in "$@"; do echo "z${i}z"; done' 'zz zz' | 286 | check 'set "" ""; for i in "$@"; do echo "z${i}z"; done' 'zz zz' | |
287 | check 'set "" ""; for i in $@; do echo "z${i}z"; done' '' | 287 | check 'set "" ""; for i in $@; do echo "z${i}z"; done' '' | |
288 | 288 | |||
289 | check 'set "a b" c; for i; do echo "z${i}z"; done' \ | 289 | check 'set "a b" c; for i; do echo "z${i}z"; done' \ | |
290 | 'za bz zcz' | 290 | 'za bz zcz' | |
291 | check 'set "a b" c; for i in "$@"; do echo "z${i}z"; done' \ | 291 | check 'set "a b" c; for i in "$@"; do echo "z${i}z"; done' \ | |
292 | 'za bz zcz' | 292 | 'za bz zcz' | |
293 | check 'set "a b" c; for i in $@; do echo "z${i}z"; done' \ | 293 | check 'set "a b" c; for i in $@; do echo "z${i}z"; done' \ | |
294 | 'zaz zbz zcz' | 294 | 'zaz zbz zcz' | |
295 | check 'set " a b " c; for i in "$@"; do echo "z${i}z"; done' \ | 295 | check 'set " a b " c; for i in "$@"; do echo "z${i}z"; done' \ | |
296 | 'z a b z zcz' | 296 | 'z a b z zcz' | |
297 | ||||
298 | check 'set a b c; for i in "$@$@"; do echo "z${i}z"; done' \ | |||
299 | 'zaz zbz zcaz zbz zcz' | |||
300 | check 'set a b c; for i in "$@""$@";do echo "z${i}z"; done' \ | |||
301 | 'zaz zbz zcaz zbz zcz' | |||
297 | } | 302 | } | |
298 | 303 | |||
299 | atf_test_case ifs | 304 | atf_test_case ifs | |
300 | ifs_head() { | 305 | ifs_head() { | |
301 | atf_set "descr" "Checks that IFS correctly configures field" \ | 306 | atf_set "descr" "Checks that IFS correctly configures field" \ | |
302 | "splitting behavior" | 307 | "splitting behavior" | |
303 | } | 308 | } | |
304 | ifs_body() { | 309 | ifs_body() { | |
305 | unset x | 310 | unset x | |
306 | 311 | |||
307 | TEST=0 | 312 | TEST=0 | |
308 | # Some IFS tests | 313 | # Some IFS tests | |
309 | check 't="-- "; IFS=" "; set $t; IFS=":"; r="$*"; IFS=; echo $# $r' '0' | 314 | check 't="-- "; IFS=" "; set $t; IFS=":"; r="$*"; IFS=; echo $# $r' '0' |
--- src/tests/bin/sh/t_set_e.sh 2016/03/08 14:20:22 1.2
+++ src/tests/bin/sh/t_set_e.sh 2016/03/27 14:50:01 1.3
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: t_set_e.sh,v 1.2 2016/03/08 14:20:22 christos Exp $ | 1 | # $NetBSD: t_set_e.sh,v 1.3 2016/03/27 14:50:01 christos Exp $ | |
2 | # | 2 | # | |
3 | # Copyright (c) 2007 The NetBSD Foundation, Inc. | 3 | # Copyright (c) 2007 The NetBSD Foundation, Inc. | |
4 | # All rights reserved. | 4 | # All rights reserved. | |
5 | # | 5 | # | |
6 | # Redistribution and use in source and binary forms, with or without | 6 | # Redistribution and use in source and binary forms, with or without | |
7 | # modification, are permitted provided that the following conditions | 7 | # modification, are permitted provided that the following conditions | |
8 | # are met: | 8 | # are met: | |
9 | # 1. Redistributions of source code must retain the above copyright | 9 | # 1. Redistributions of source code must retain the above copyright | |
10 | # notice, this list of conditions and the following disclaimer. | 10 | # notice, this list of conditions and the following disclaimer. | |
11 | # 2. Redistributions in binary form must reproduce the above copyright | 11 | # 2. Redistributions in binary form must reproduce the above copyright | |
12 | # notice, this list of conditions and the following disclaimer in the | 12 | # notice, this list of conditions and the following disclaimer in the | |
13 | # documentation and/or other materials provided with the distribution. | 13 | # documentation and/or other materials provided with the distribution. | |
14 | # | 14 | # | |
@@ -71,28 +71,28 @@ all_head() { | @@ -71,28 +71,28 @@ all_head() { | |||
71 | atf_set "descr" "Tests that 'set -e' works correctly" | 71 | atf_set "descr" "Tests that 'set -e' works correctly" | |
72 | } | 72 | } | |
73 | all_body() { | 73 | all_body() { | |
74 | count=0 | 74 | count=0 | |
75 | failcount=0 | 75 | failcount=0 | |
76 | 76 | |||
77 | # make sure exiting from a subshell behaves as expected | 77 | # make sure exiting from a subshell behaves as expected | |
78 | dcheck '(set -e; exit 1; echo ERR$?); echo OK$?' 'OK1' | 78 | dcheck '(set -e; exit 1; echo ERR$?); echo OK$?' 'OK1' | |
79 | echeck '(set -e; exit 1; echo ERR$?); echo OK$?' 'OK1' | 79 | echeck '(set -e; exit 1; echo ERR$?); echo OK$?' 'OK1' | |
80 | 80 | |||
81 | # first, check basic functioning. | 81 | # first, check basic functioning. | |
82 | # The ERR shouldn't print; the result of the () should be 1. | 82 | # The ERR shouldn't print; the result of the () should be 1. | |
83 | # Henceforth we'll assume that we don't need to check $?. | 83 | # Henceforth we'll assume that we don't need to check $?. | |
84 | dcheck '(set -e; false; echo ERR$?); echo -n OK$?' 'OK1' | 84 | dcheck '(set -e; false; echo ERR$?); echo OK$?' 'OK1' | |
85 | echeck '(set -e; false; echo ERR$?); echo -n OK$?' 'OK1' | 85 | echeck '(set -e; false; echo ERR$?); echo OK$?' 'OK1' | |
86 | 86 | |||
87 | # these cases should be equivalent to the preceding. | 87 | # these cases should be equivalent to the preceding. | |
88 | dcheck '(set -e; /nonexistent; echo ERR); echo OK' 'OK' | 88 | dcheck '(set -e; /nonexistent; echo ERR); echo OK' 'OK' | |
89 | echeck '(set -e; /nonexistent; echo ERR); echo OK' 'OK' | 89 | echeck '(set -e; /nonexistent; echo ERR); echo OK' 'OK' | |
90 | dcheck '(set -e; nonexistent-program-on-path; echo ERR); echo OK' 'OK' | 90 | dcheck '(set -e; nonexistent-program-on-path; echo ERR); echo OK' 'OK' | |
91 | echeck '(set -e; nonexistent-program-on-path; echo ERR); echo OK' 'OK' | 91 | echeck '(set -e; nonexistent-program-on-path; echo ERR); echo OK' 'OK' | |
92 | dcheck 'f() { false; }; (set -e; f; echo ERR); echo OK' 'OK' | 92 | dcheck 'f() { false; }; (set -e; f; echo ERR); echo OK' 'OK' | |
93 | echeck 'f() { false; }; (set -e; f; echo ERR); echo OK' 'OK' | 93 | echeck 'f() { false; }; (set -e; f; echo ERR); echo OK' 'OK' | |
94 | dcheck 'f() { return 1; }; (set -e; f; echo ERR); echo OK' 'OK' | 94 | dcheck 'f() { return 1; }; (set -e; f; echo ERR); echo OK' 'OK' | |
95 | echeck 'f() { return 1; }; (set -e; f; echo ERR); echo OK' 'OK' | 95 | echeck 'f() { return 1; }; (set -e; f; echo ERR); echo OK' 'OK' | |
96 | 96 | |||
97 | # but! with set -e, the false should cause an *immediate* exit. | 97 | # but! with set -e, the false should cause an *immediate* exit. | |
98 | # The return form should not, as such, but there's no way to | 98 | # The return form should not, as such, but there's no way to |
--- src/tests/bin/sh/t_ulimit.sh 2015/12/30 22:24:44 1.2
+++ src/tests/bin/sh/t_ulimit.sh 2016/03/27 14:50:01 1.3
@@ -1,57 +1,57 @@ | @@ -1,57 +1,57 @@ | |||
1 | # $NetBSD: t_ulimit.sh,v 1.2 2015/12/30 22:24:44 christos Exp $ | 1 | # $NetBSD: t_ulimit.sh,v 1.3 2016/03/27 14:50:01 christos Exp $ | |
2 | # | 2 | # | |
3 | # Copyright (c) 2012 The NetBSD Foundation, Inc. | 3 | # Copyright (c) 2012 The NetBSD Foundation, Inc. | |
4 | # All rights reserved. | 4 | # All rights reserved. | |
5 | # | 5 | # | |
6 | # Redistribution and use in source and binary forms, with or without | 6 | # Redistribution and use in source and binary forms, with or without | |
7 | # modification, are permitted provided that the following conditions | 7 | # modification, are permitted provided that the following conditions | |
8 | # are met: | 8 | # are met: | |
9 | # 1. Redistributions of source code must retain the above copyright | 9 | # 1. Redistributions of source code must retain the above copyright | |
10 | # notice, this list of conditions and the following disclaimer. | 10 | # notice, this list of conditions and the following disclaimer. | |
11 | # 2. Redistributions in binary form must reproduce the above copyright | 11 | # 2. Redistributions in binary form must reproduce the above copyright | |
12 | # notice, this list of conditions and the following disclaimer in the | 12 | # notice, this list of conditions and the following disclaimer in the | |
13 | # documentation and/or other materials provided with the distribution. | 13 | # documentation and/or other materials provided with the distribution. | |
14 | # | 14 | # | |
15 | # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 15 | # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
16 | # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 16 | # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
17 | # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 17 | # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
18 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 18 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
19 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 19 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
20 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 20 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
21 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 21 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
22 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 22 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
23 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 23 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
24 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 24 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
25 | # POSSIBILITY OF SUCH DAMAGE. | 25 | # POSSIBILITY OF SUCH DAMAGE. | |
26 | # | 26 | # | |
27 | # the implementation of "sh" to test | |||
28 | : ${TEST_SH:="/bin/sh"} | |||
27 | 29 | |||
28 | # ulimit builtin test. | 30 | # ulimit builtin test. | |
29 | 31 | |||
30 | atf_test_case limits | 32 | atf_test_case limits | |
31 | limits_head() { | 33 | limits_head() { | |
32 | atf_set "descr" "Checks for limits flags" | 34 | atf_set "descr" "Checks for limits flags" | |
33 | } | 35 | } | |
34 | 36 | |||
35 | get_ulimits() { | 37 | get_ulimits() { | |
36 | local limits=$(ulimit -a | | 38 | local limits=$(${TEST_SH} -c 'ulimit -a' | | |
37 | sed -e 's/.*\(-[A-Za-z0-9]\)[^A-Za-z0-9].*/\1/' | sort -u) | 39 | sed -e 's/.*\(-[A-Za-z0-9]\)[^A-Za-z0-9].*/\1/' | sort -u) | |
38 | if [ -z "$limits" ]; then | 40 | if [ -z "$limits" ]; then | |
39 | # grr ksh | 41 | # grr ksh | |
40 | limits="-a -b -c -d -f -l -m -n -p -r -s -t -v" | 42 | limits="-a -b -c -d -f -l -m -n -p -r -s -t -v" | |
41 | fi | 43 | fi | |
42 | echo "$limits" | 44 | echo "$limits" | |
43 | } | 45 | } | |
44 | 46 | |||
45 | limits_body() { | 47 | limits_body() { | |
46 | atf_check -s eq:0 -o ignore -e empty \ | 48 | atf_check -s eq:0 -o ignore -e empty ${TEST_SH} -c "ulimit -a" | |
47 | /bin/sh -c "ulimit -a" | |||
48 | for l in $(get_ulimits) | 49 | for l in $(get_ulimits) | |
49 | do | 50 | do | |
50 | atf_check -s eq:0 -o ignore -e empty \ | 51 | atf_check -s eq:0 -o ignore -e empty ${TEST_SH} -c "ulimit $l" | |
51 | /bin/sh -c "ulimit $l" | |||
52 | done | 52 | done | |
53 | } | 53 | } | |
54 | 54 | |||
55 | atf_init_test_cases() { | 55 | atf_init_test_cases() { | |
56 | atf_add_test_case limits | 56 | atf_add_test_case limits | |
57 | } | 57 | } |
--- src/tests/bin/sh/t_varquote.sh 2016/03/12 14:58:03 1.4
+++ src/tests/bin/sh/t_varquote.sh 2016/03/27 14:50:01 1.5
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: t_varquote.sh,v 1.4 2016/03/12 14:58:03 christos Exp $ | 1 | # $NetBSD: t_varquote.sh,v 1.5 2016/03/27 14:50:01 christos Exp $ | |
2 | # | 2 | # | |
3 | # Copyright (c) 2007 The NetBSD Foundation, Inc. | 3 | # Copyright (c) 2007 The NetBSD Foundation, Inc. | |
4 | # All rights reserved. | 4 | # All rights reserved. | |
5 | # | 5 | # | |
6 | # Redistribution and use in source and binary forms, with or without | 6 | # Redistribution and use in source and binary forms, with or without | |
7 | # modification, are permitted provided that the following conditions | 7 | # modification, are permitted provided that the following conditions | |
8 | # are met: | 8 | # are met: | |
9 | # 1. Redistributions of source code must retain the above copyright | 9 | # 1. Redistributions of source code must retain the above copyright | |
10 | # notice, this list of conditions and the following disclaimer. | 10 | # notice, this list of conditions and the following disclaimer. | |
11 | # 2. Redistributions in binary form must reproduce the above copyright | 11 | # 2. Redistributions in binary form must reproduce the above copyright | |
12 | # notice, this list of conditions and the following disclaimer in the | 12 | # notice, this list of conditions and the following disclaimer in the | |
13 | # documentation and/or other materials provided with the distribution. | 13 | # documentation and/or other materials provided with the distribution. | |
14 | # | 14 | # | |
@@ -115,21 +115,20 @@ nested_quotes_multiword_head() { | @@ -115,21 +115,20 @@ nested_quotes_multiword_head() { | |||
115 | nested_quotes_multiword_body() { | 115 | nested_quotes_multiword_body() { | |
116 | atf_check -s eq:0 -o match:"first-word second-word" -e empty \ | 116 | atf_check -s eq:0 -o match:"first-word second-word" -e empty \ | |
117 | ${TEST_SH} -c 'echo "${foo:="first-word"} second-word"' | 117 | ${TEST_SH} -c 'echo "${foo:="first-word"} second-word"' | |
118 | } | 118 | } | |
119 | 119 | |||
120 | atf_test_case default_assignment_with_arith | 120 | atf_test_case default_assignment_with_arith | |
121 | default_assignment_with_arith_head() { | 121 | default_assignment_with_arith_head() { | |
122 | atf_set "descr" "Tests default variable assignment with arithmetic" \ | 122 | atf_set "descr" "Tests default variable assignment with arithmetic" \ | |
123 | "string works (PR bin/50827)" | 123 | "string works (PR bin/50827)" | |
124 | } | 124 | } | |
125 | default_assignment_with_arith_body() { | 125 | default_assignment_with_arith_body() { | |
126 | atf_check -s eq:0 -o empty -e empty ${TEST_SH} -c ': "${x=$((1))}"' | 126 | atf_check -s eq:0 -o empty -e empty ${TEST_SH} -c ': "${x=$((1))}"' | |
127 | atf_check -s eq:0 -o match:1 -e empty ${TEST_SH} -c 'echo "${x=$((1))}"' | 127 | atf_check -s eq:0 -o match:1 -e empty ${TEST_SH} -c 'echo "${x=$((1))}"' | |
128 | ||||
129 | } | 128 | } | |
130 | 129 | |||
131 | atf_init_test_cases() { | 130 | atf_init_test_cases() { | |
132 | atf_add_test_case all | 131 | atf_add_test_case all | |
133 | atf_add_test_case nested_quotes_multiword | 132 | atf_add_test_case nested_quotes_multiword | |
134 | atf_add_test_case default_assignment_with_arith | 133 | atf_add_test_case default_assignment_with_arith | |
135 | } | 134 | } |