aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-07-05 12:24:55 +0100
committerRon Yorston <rmy@pobox.com>2021-07-05 12:24:55 +0100
commit57261b6b3a6d2955a5abd6a0563fe78ba43abf3f (patch)
tree3069f9f8bbe05104a8a4339479b3f07d246ff540 /testsuite
parente1ad66c0b8fd58a7158d40771175a7dab224202d (diff)
parent08ca313d7edb99687068b93b5d2435b59f3db23a (diff)
downloadbusybox-w32-57261b6b3a6d2955a5abd6a0563fe78ba43abf3f.tar.gz
busybox-w32-57261b6b3a6d2955a5abd6a0563fe78ba43abf3f.tar.bz2
busybox-w32-57261b6b3a6d2955a5abd6a0563fe78ba43abf3f.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/awk.tests32
1 files changed, 32 insertions, 0 deletions
diff --git a/testsuite/awk.tests b/testsuite/awk.tests
index cf9b722dc..770d8ffce 100755
--- a/testsuite/awk.tests
+++ b/testsuite/awk.tests
@@ -45,6 +45,16 @@ testing "awk handles empty function f(arg){}" \
45 "" "" 45 "" ""
46 46
47prg=' 47prg='
48function empty_fun(){}
49END {empty_fun()
50 print "Ok"
51}'
52testing "awk handles empty function f(){}" \
53 "awk '$prg'" \
54 "Ok\n" \
55 "" ""
56
57prg='
48function outer_fun() { 58function outer_fun() {
49 return 1 59 return 1
50} 60}
@@ -71,6 +81,23 @@ testing "awk properly handles undefined function" \
71 "L1\n\nawk: cmd. line:5: Call to undefined function\n" \ 81 "L1\n\nawk: cmd. line:5: Call to undefined function\n" \
72 "" "" 82 "" ""
73 83
84prg='
85BEGIN {
86 v=1
87 a=2
88 print v (a)
89}'
90testing "awk 'v (a)' is not a function call, it is a concatenation" \
91 "awk '$prg' 2>&1" \
92 "12\n" \
93 "" ""
94
95prg='func f(){print"F"};func g(){print"G"};BEGIN{f(g(),g())}'
96testing "awk unused function args are evaluated" \
97 "awk '$prg' 2>&1" \
98 "G\nG\nF\n" \
99 "" ""
100
74 101
75optional DESKTOP 102optional DESKTOP
76testing "awk hex const 1" "awk '{ print or(0xffffffff,1) }'" "4294967295\n" "" "\n" 103testing "awk hex const 1" "awk '{ print or(0xffffffff,1) }'" "4294967295\n" "" "\n"
@@ -418,4 +445,9 @@ testing 'awk $NF is empty' \
418 '' \ 445 '' \
419 'a=====123=' 446 'a=====123='
420 447
448testing "awk exit N propagates through END's exit" \
449 "awk 'BEGIN { exit 42 } END { exit }'; echo \$?" \
450 "42\n" \
451 '' ''
452
421exit $FAILCOUNT 453exit $FAILCOUNT