diff options
author | Ron Yorston <rmy@pobox.com> | 2021-07-05 12:24:55 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-07-05 12:24:55 +0100 |
commit | 57261b6b3a6d2955a5abd6a0563fe78ba43abf3f (patch) | |
tree | 3069f9f8bbe05104a8a4339479b3f07d246ff540 /testsuite | |
parent | e1ad66c0b8fd58a7158d40771175a7dab224202d (diff) | |
parent | 08ca313d7edb99687068b93b5d2435b59f3db23a (diff) | |
download | busybox-w32-57261b6b3a6d2955a5abd6a0563fe78ba43abf3f.tar.gz busybox-w32-57261b6b3a6d2955a5abd6a0563fe78ba43abf3f.tar.bz2 busybox-w32-57261b6b3a6d2955a5abd6a0563fe78ba43abf3f.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/awk.tests | 32 |
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 | ||
47 | prg=' | 47 | prg=' |
48 | function empty_fun(){} | ||
49 | END {empty_fun() | ||
50 | print "Ok" | ||
51 | }' | ||
52 | testing "awk handles empty function f(){}" \ | ||
53 | "awk '$prg'" \ | ||
54 | "Ok\n" \ | ||
55 | "" "" | ||
56 | |||
57 | prg=' | ||
48 | function outer_fun() { | 58 | function 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 | ||
84 | prg=' | ||
85 | BEGIN { | ||
86 | v=1 | ||
87 | a=2 | ||
88 | print v (a) | ||
89 | }' | ||
90 | testing "awk 'v (a)' is not a function call, it is a concatenation" \ | ||
91 | "awk '$prg' 2>&1" \ | ||
92 | "12\n" \ | ||
93 | "" "" | ||
94 | |||
95 | prg='func f(){print"F"};func g(){print"G"};BEGIN{f(g(),g())}' | ||
96 | testing "awk unused function args are evaluated" \ | ||
97 | "awk '$prg' 2>&1" \ | ||
98 | "G\nG\nF\n" \ | ||
99 | "" "" | ||
100 | |||
74 | 101 | ||
75 | optional DESKTOP | 102 | optional DESKTOP |
76 | testing "awk hex const 1" "awk '{ print or(0xffffffff,1) }'" "4294967295\n" "" "\n" | 103 | testing "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 | ||
448 | testing "awk exit N propagates through END's exit" \ | ||
449 | "awk 'BEGIN { exit 42 } END { exit }'; echo \$?" \ | ||
450 | "42\n" \ | ||
451 | '' '' | ||
452 | |||
421 | exit $FAILCOUNT | 453 | exit $FAILCOUNT |