aboutsummaryrefslogtreecommitdiffstats
path: root/testcases-cons
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-04-23 16:31:41 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-04-23 16:31:41 -0700
commit57f4e4ed68140a9f20cb59c45c79214cfa552970 (patch)
treee63b55b41f0923f23a66dcb9307a86fd647b9fa8 /testcases-cons
parent44e30eb85147c413c7e4959c2d8e50cf1de673a8 (diff)
downloadcppawk-57f4e4ed68140a9f20cb59c45c79214cfa552970.tar.gz
cppawk-57f4e4ed68140a9f20cb59c45c79214cfa552970.tar.bz2
cppawk-57f4e4ed68140a9f20cb59c45c79214cfa552970.zip
set_fields: document/test the start index param.
Diffstat (limited to 'testcases-cons')
-rw-r--r--testcases-cons27
1 files changed, 27 insertions, 0 deletions
diff --git a/testcases-cons b/testcases-cons
index e5342c0..ebf9241 100644
--- a/testcases-cons
+++ b/testcases-cons
@@ -937,3 +937,30 @@ nil
("brown" "fox")
("fox")
nil
+--
+47:
+$cppawk '
+#include <cons.h>
+
+BEGIN {
+ $0 = "the quick brown fox"
+ print sexp(fields())
+
+ set_fields(list(1, cons(1, 2), "foo", box_str("foo")), 3)
+
+ for (i = 1; i <= NF; i++)
+ print $i
+
+ set_fields(list("fast", "fox"), 2)
+ print sexp(fields())
+}'
+:
+("the" "quick" "brown" "fox")
+the
+quick
+1
+C1,1:12
+foo
+Tfoo
+("the" "fast" "fox")
+--