aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog5
-rw-r--r--test/Makefile.am3
-rw-r--r--test/Makefile.in8
-rw-r--r--test/Maketests5
-rw-r--r--test/arraytype.awk35
-rw-r--r--test/arraytype.ok16
6 files changed, 72 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index b1d2e340..7f17f725 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2019-01-09 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * Makefile.am (EXTRA_DIST): New test: arraytype.
+ * arraytype.awk, arraytype.ok: New files.
+
2018-12-24 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (inetdayt, inetdayu, inetecht, inetechu): Add
diff --git a/test/Makefile.am b/test/Makefile.am
index 7b42f8db..b4f50cec 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -76,6 +76,8 @@ EXTRA_DIST = \
arraysort.ok \
arraysort2.awk \
arraysort2.ok \
+ arraytype.awk \
+ arraytype.ok \
arrdbg.awk \
arrymem1.awk \
arrymem1.ok \
@@ -1294,6 +1296,7 @@ UNIX_TESTS = \
GAWK_EXT_TESTS = \
aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort arraysort2 \
+ arraytype \
backw badargs beginfile1 beginfile2 binmode1 \
charasbytes colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \
clos1way6 crlf \
diff --git a/test/Makefile.in b/test/Makefile.in
index f2fa6c8e..b6adabdd 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -334,6 +334,8 @@ EXTRA_DIST = \
arraysort.ok \
arraysort2.awk \
arraysort2.ok \
+ arraytype.awk \
+ arraytype.ok \
arrdbg.awk \
arrymem1.awk \
arrymem1.ok \
@@ -1552,6 +1554,7 @@ UNIX_TESTS = \
GAWK_EXT_TESTS = \
aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort arraysort2 \
+ arraytype \
backw badargs beginfile1 beginfile2 binmode1 \
charasbytes colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \
clos1way6 crlf \
@@ -3945,6 +3948,11 @@ arraysort2:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+arraytype:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
backw:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 08d92ba3..9ad8ade9 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1269,6 +1269,11 @@ arraysort2:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+arraytype:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
backw:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/arraytype.awk b/test/arraytype.awk
new file mode 100644
index 00000000..70fd72b0
--- /dev/null
+++ b/test/arraytype.awk
@@ -0,0 +1,35 @@
+BEGIN {
+ # N.B. This relies upon the undocumented 2nd argument to typeof
+ x[0] = 0
+ print typeof(x, a)
+ print a["array_type"]
+
+ # make sure it resets
+ delete x[0]
+ print typeof(x, a)
+ print a["array_type"]
+
+ x["fubar"] = 0
+ print typeof(x, a)
+ print a["array_type"]
+
+ delete x["fubar"]
+ print typeof(x, a)
+ print a["array_type"]
+
+ x[-2] = 0
+ print typeof(x, a)
+ print a["array_type"]
+
+ delete x[-2]
+ print typeof(x, a)
+ print a["array_type"]
+
+ x[2] = 0
+ print typeof(x, a)
+ print a["array_type"]
+
+ delete x
+ print typeof(x, a)
+ print a["array_type"]
+}
diff --git a/test/arraytype.ok b/test/arraytype.ok
new file mode 100644
index 00000000..6595bb89
--- /dev/null
+++ b/test/arraytype.ok
@@ -0,0 +1,16 @@
+array
+cint
+array
+null
+array
+str
+array
+null
+array
+int
+array
+null
+array
+cint
+array
+null