aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
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" \
"" "\n"
# long field seps requiring regex
-testing "awk long field sep" "awk -F-- '{ print NF, length(\$NF), \$NF }'" \
+testing "awk long field sep" \
+ "awk -F-- '{ print NF, length(\$NF), \$NF }'" \
"2 0 \n3 0 \n4 0 \n5 0 \n" \
"" \
"a--\na--b--\na--b--c--\na--b--c--d--"
@@ -317,6 +318,26 @@ testing "awk length()" \
"3\n3\n3\n3\n" \
"" "qwe"
+testing "awk print length, 1" \
+ "awk '{ print length, 1 }'" \
+ "0 1\n" \
+ "" "\n"
+
+testing "awk print length 1" \
+ "awk '{ print length 1 }'" \
+ "01\n" \
+ "" "\n"
+
+testing "awk length == 0" \
+ "awk 'length == 0 { print \"foo\" }'" \
+ "foo\n" \
+ "" "\n"
+
+testing "awk if (length == 0)" \
+ "awk '{ if (length == 0) { print \"bar\" } }'" \
+ "bar\n" \
+ "" "\n"
+
testing "awk -f and ARGC" \
"awk -f - input" \
"re\n2\n" \