aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-02-02 23:28:55 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-02-02 23:28:55 +0100
commitbd8b05ba1b0901bbd6a913dfd5186ac7c8beffed (patch)
treed4989ed16d4824dc8925042bce8c426bd499df2f /testsuite
parent9e2a5668fd38db169d9d91b13089a99df4c9bd37 (diff)
downloadbusybox-w32-bd8b05ba1b0901bbd6a913dfd5186ac7c8beffed.tar.gz
busybox-w32-bd8b05ba1b0901bbd6a913dfd5186ac7c8beffed.tar.bz2
busybox-w32-bd8b05ba1b0901bbd6a913dfd5186ac7c8beffed.zip
awk: fix more "length" cases, closes 12486
function old new delta next_token 808 831 +23 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/awk.tests23
1 files changed, 22 insertions, 1 deletions
diff --git a/testsuite/awk.tests b/testsuite/awk.tests
index a7a533ba0..b5008290f 100755
--- a/testsuite/awk.tests
+++ b/testsuite/awk.tests
@@ -85,7 +85,8 @@ testing "awk floating const with leading zeroes" \
85 "" "\n" 85 "" "\n"
86 86
87# long field seps requiring regex 87# long field seps requiring regex
88testing "awk long field sep" "awk -F-- '{ print NF, length(\$NF), \$NF }'" \ 88testing "awk long field sep" \
89 "awk -F-- '{ print NF, length(\$NF), \$NF }'" \
89 "2 0 \n3 0 \n4 0 \n5 0 \n" \ 90 "2 0 \n3 0 \n4 0 \n5 0 \n" \
90 "" \ 91 "" \
91 "a--\na--b--\na--b--c--\na--b--c--d--" 92 "a--\na--b--\na--b--c--\na--b--c--d--"
@@ -317,6 +318,26 @@ testing "awk length()" \
317 "3\n3\n3\n3\n" \ 318 "3\n3\n3\n3\n" \
318 "" "qwe" 319 "" "qwe"
319 320
321testing "awk print length, 1" \
322 "awk '{ print length, 1 }'" \
323 "0 1\n" \
324 "" "\n"
325
326testing "awk print length 1" \
327 "awk '{ print length 1 }'" \
328 "01\n" \
329 "" "\n"
330
331testing "awk length == 0" \
332 "awk 'length == 0 { print \"foo\" }'" \
333 "foo\n" \
334 "" "\n"
335
336testing "awk if (length == 0)" \
337 "awk '{ if (length == 0) { print \"bar\" } }'" \
338 "bar\n" \
339 "" "\n"
340
320testing "awk -f and ARGC" \ 341testing "awk -f and ARGC" \
321 "awk -f - input" \ 342 "awk -f - input" \
322 "re\n2\n" \ 343 "re\n2\n" \