aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog5
-rw-r--r--test/Makefile.am10
-rw-r--r--test/Makefile.in10
-rw-r--r--test/indirectbuiltin2.awk29
-rw-r--r--test/indirectbuiltin2.ok6
5 files changed, 60 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index 66882c59..03a1cbfb 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2022-02-09 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): indirectbuiltin2, new test.
+ * indirectbuiltin2.awk, indirectbuiltin2.ok: New files.
+
2022-01-05 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (EXTRA_DIST): nsidentifier, new test.
diff --git a/test/Makefile.am b/test/Makefile.am
index 27f12dbb..f76f5d48 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -569,6 +569,8 @@ EXTRA_DIST = \
include.ok \
indirectbuiltin.awk \
indirectbuiltin.ok \
+ indirectbuiltin2.awk \
+ indirectbuiltin2.ok \
indirectcall2.awk \
indirectcall2.ok \
indirectcall.awk \
@@ -1452,6 +1454,7 @@ GAWK_EXT_TESTS = \
icasefs icasers id igncdym igncfs ignrcas2 ignrcas4 ignrcase \
incdupe incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 \
include include2 indirectbuiltin indirectcall indirectcall2 \
+ indirectbuiltin2 \
inf-nan-torture intarray iolint isarrayunset lint lintexp \
lintindex lintint lintlength lintold lintplus lintset lintwarn \
manyfiles match1 match2 match3 mbstr1 mbstr2 mixed1 mktime \
@@ -2492,6 +2495,13 @@ argcasfile:
@-$(AWK) -f "$(srcdir)"/$@.awk ARGC=1 ' /no/such/file' < "$(srcdir)/$@.in" >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+indirectbuiltin2:
+ @echo $@
+ @-for test in 0 1 2 3 4 5 ; do \
+ $(AWK) -v test=$$test -f "$(srcdir)"/$@.awk ; \
+ done > _$@ 2>&1 || exit 0
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
# Targets generated for other tests:
include Maketests
diff --git a/test/Makefile.in b/test/Makefile.in
index a755b633..f0e2894a 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -835,6 +835,8 @@ EXTRA_DIST = \
include.ok \
indirectbuiltin.awk \
indirectbuiltin.ok \
+ indirectbuiltin2.awk \
+ indirectbuiltin2.ok \
indirectcall2.awk \
indirectcall2.ok \
indirectcall.awk \
@@ -1718,6 +1720,7 @@ GAWK_EXT_TESTS = \
icasefs icasers id igncdym igncfs ignrcas2 ignrcas4 ignrcase \
incdupe incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 \
include include2 indirectbuiltin indirectcall indirectcall2 \
+ indirectbuiltin2 \
inf-nan-torture intarray iolint isarrayunset lint lintexp \
lintindex lintint lintlength lintold lintplus lintset lintwarn \
manyfiles match1 match2 match3 mbstr1 mbstr2 mixed1 mktime \
@@ -2940,6 +2943,13 @@ argcasfile:
@echo $@
@-$(AWK) -f "$(srcdir)"/$@.awk ARGC=1 ' /no/such/file' < "$(srcdir)/$@.in" >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+indirectbuiltin2:
+ @echo $@
+ @-for test in 0 1 2 3 4 5 ; do \
+ $(AWK) -v test=$$test -f "$(srcdir)"/$@.awk ; \
+ done > _$@ 2>&1 || exit 0
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
Gt-dummy:
# file Maketests, generated from Makefile.am by the Gentests program
addcomma:
diff --git a/test/indirectbuiltin2.awk b/test/indirectbuiltin2.awk
new file mode 100644
index 00000000..6409f91a
--- /dev/null
+++ b/test/indirectbuiltin2.awk
@@ -0,0 +1,29 @@
+@load "ordchr"
+
+BEGIN {
+ o = "ord" # check stack for indirect call of ext function
+ l = "length" # check bad args for function of 1 argument
+ m = "match" # check bad args for function of 3-4 argument
+ s = "systime" # check bad args for function of 0 arguments
+
+ switch (test) {
+ case 0:
+ print "indirect, " @o("A")
+ break
+ case 1:
+ print @l()
+ break
+ case 2:
+ print @l("a", "b")
+ break
+ case 3:
+ print @m(@/foo/)
+ break
+ case 4:
+ print @m(@/foo/, "bar", a, b)
+ break
+ case 5:
+ print @s("xxx")
+ break
+ }
+}
diff --git a/test/indirectbuiltin2.ok b/test/indirectbuiltin2.ok
new file mode 100644
index 00000000..dfb2005e
--- /dev/null
+++ b/test/indirectbuiltin2.ok
@@ -0,0 +1,6 @@
+indirect, 65
+gawk: ./indirectbuiltin2.awk:14: fatal: length: called with 0 arguments
+gawk: ./indirectbuiltin2.awk:17: fatal: length: called with 2 arguments
+gawk: ./indirectbuiltin2.awk:20: fatal: indirect call to match requires two or three arguments
+gawk: ./indirectbuiltin2.awk:23: fatal: indirect call to match requires two or three arguments
+gawk: ./indirectbuiltin2.awk:26: fatal: systime: called with 1 arguments