aboutsummaryrefslogtreecommitdiffstats
path: root/testcases-cons
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-04-16 10:38:01 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-04-16 10:38:01 -0700
commit025ac4afc05331802ac9e81929eec740edabeb39 (patch)
treed6157d3bc0d6aa730a3dd10032b64ad6a4f40738 /testcases-cons
parent23442546290df93f6fb0f7bb0b9329ecf19b48fa (diff)
downloadcppawk-025ac4afc05331802ac9e81929eec740edabeb39.tar.gz
cppawk-025ac4afc05331802ac9e81929eec740edabeb39.tar.bz2
cppawk-025ac4afc05331802ac9e81929eec740edabeb39.zip
cons: fields and set_fields: document, test.
Diffstat (limited to 'testcases-cons')
-rw-r--r--testcases-cons20
1 files changed, 20 insertions, 0 deletions
diff --git a/testcases-cons b/testcases-cons
index 10d827b..ec7e6cb 100644
--- a/testcases-cons
+++ b/testcases-cons
@@ -754,3 +754,23 @@ BEGIN {
:
("a" "b" "c")
(1 2 3)
+--
+40:
+$cppawk '
+#include <cons.h>
+
+BEGIN {
+ $0 = "the quick brown fox"
+ print sexp(fields())
+
+ set_fields(list(1, cons(1, 2), "foo", box_str("foo")))
+
+ for (i = 1; i <= NF; i++)
+ print $i
+}'
+:
+("the" "quick" "brown" "fox")
+1
+C1,1:12
+foo
+Tfoo