diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-04-22 20:26:08 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-04-22 20:26:08 -0700 |
commit | f9f306814ce6ff1aa64b34b3079bb9022bd7ffbe (patch) | |
tree | be270e571d2217cba52a733fbcc9ff95fcc9ad6c /testcases-field | |
parent | c82cebd005c48aa8ebd28b40a99a021a723e0a3d (diff) | |
download | cppawk-f9f306814ce6ff1aa64b34b3079bb9022bd7ffbe.tar.gz cppawk-f9f306814ce6ff1aa64b34b3079bb9022bd7ffbe.tar.bz2 cppawk-f9f306814ce6ff1aa64b34b3079bb9022bd7ffbe.zip |
New <field.h> header: positional parameter utils.
Diffstat (limited to 'testcases-field')
-rw-r--r-- | testcases-field | 176 |
1 files changed, 176 insertions, 0 deletions
diff --git a/testcases-field b/testcases-field new file mode 100644 index 0000000..788f325 --- /dev/null +++ b/testcases-field @@ -0,0 +1,176 @@ +1: +$cppawk ' +#include <cons.h> +#include <field.h> + +#define pf {print sexp(fields())} + +BEGIN { + $0 = "" + delf(1, 0) + pf + delf(1, 5) + pf + delf(3, 5) + pf +}' +: +nil +nil +nil +-- +2: +$cppawk ' +#include <cons.h> +#include <field.h> + +#define pf {print sexp(fields())} + +BEGIN { + $0 = "1 2 3 4" + delf(1, 1) + pf + delf(2, 1) + pf + delf(3, 0) + pf + delf(0, 0) + pf + delf(1, 2) + pf +}' +: +(2 3 4) +(2 4) +(2 4) +(2 4) +nil +-- +3: +$cppawk ' +#include <cons.h> +#include <field.h> + +#define pf {print sexp(fields())} + +BEGIN { + $0 = "1 2 3 4 5" + delf(1) + pf + delf(1) + pf + delf(1, 10) + pf +}' +: +(2 3 4 5) +(3 4 5) +nil +-- +4: +$cppawk ' +#include <cons.h> +#include <field.h> + +#define pf {print sexp(fields())} + +BEGIN { + $0 = "1 2 3 4 5" + delf(5) + pf + delf(4) + pf + delf(3, 15) + pf + delf(2, 1000) + pf + delf(1) + pf +}' +: +(1 2 3 4) +(1 2 3) +(1 2) +(1) +nil +-- +5: +$cppawk ' +#include <cons.h> +#include <field.h> + +#define pf {print sexp(fields())} + +BEGIN { + $0 = "1 2 3 4 5" + delf(4, 13) + pf +}' +: +(1 2 3) +-- +6: +$cppawk ' +#include <cons.h> +#include <field.h> + +#define pf {print sexp(fields())} + +BEGIN { + $0 = "1 2 3 4 5" + delf(2, 3) + pf +}' +: +(1 5) +-- +7: +$cppawk ' +#include <cons.h> +#include <field.h> + +#define pf {print sexp(fields())} + +BEGIN { + $0 = "" + insf(1, 1) + pf + insf(2, 2) + pf + insf(3, 3) + pf + insf(4, 4, 5, 6) + pf +}' +: +(1) +(1 2) +(1 2 3) +(1 2 3 4 5 6) +-- +8: +$cppawk ' +#include <cons.h> +#include <field.h> + +#define pf {print sexp(fields())} + +BEGIN { + $0 = "" + insf(3, 3, 4) + pf + insf(5, 5, 6) + pf + insf(9, 9) + pf + insf(0, 1, 2, 3) + pf + insf(1, 1, 2) + pf +}' +: +(nil nil 3 4) +(nil nil 3 4 5 6) +(nil nil 3 4 5 6 nil nil 9) +(nil nil 3 4 5 6 nil nil 9) +(1 2 nil nil 3 4 5 6 nil nil 9) |