aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog5
-rw-r--r--test/Makefile.am2
-rw-r--r--test/Makefile.in7
-rw-r--r--test/Maketests5
-rw-r--r--test/aryunasgn.awk17
-rw-r--r--test/aryunasgn.ok8
6 files changed, 42 insertions, 2 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index b7225ce8..e85aa681 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -2,6 +2,11 @@
* badargs.ok: Update after code changes.
+ Unrelated:
+
+ * Makefile.am (aryunasgn): New test.
+ * aryunasgn.awk, aryunasgn.ok: New files.
+
2017-08-04 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am: Update copyright year.
diff --git a/test/Makefile.am b/test/Makefile.am
index dddcf931..f519b0db 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1199,7 +1199,7 @@ BASIC_TESTS = \
addcomma anchgsub anchor argarray arrayind1 arrayind2 arrayind3 arrayparm arrayprm2 arrayprm3 \
arrayref arrymem1 arryref2 arryref3 arryref4 arryref5 arynasty \
arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \
- aryprm8 aryprm9 arysubnm asgext awkpath \
+ aryprm8 aryprm9 arysubnm aryunasgn asgext awkpath \
back89 backgsub badassign1 badbuild \
callparam childin clobber closebad clsflnam compare compare2 concat1 concat2 \
concat3 concat4 concat5 convfmt \
diff --git a/test/Makefile.in b/test/Makefile.in
index 2b21e0a7..a6e4f96e 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1456,7 +1456,7 @@ BASIC_TESTS = \
addcomma anchgsub anchor argarray arrayind1 arrayind2 arrayind3 arrayparm arrayprm2 arrayprm3 \
arrayref arrymem1 arryref2 arryref3 arryref4 arryref5 arynasty \
arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \
- aryprm8 aryprm9 arysubnm asgext awkpath \
+ aryprm8 aryprm9 arysubnm aryunasgn asgext awkpath \
back89 backgsub badassign1 badbuild \
callparam childin clobber closebad clsflnam compare compare2 concat1 concat2 \
concat3 concat4 concat5 convfmt \
@@ -2990,6 +2990,11 @@ arysubnm:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+aryunasgn:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
asgext:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index f8c54f94..e6a2f300 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -130,6 +130,11 @@ arysubnm:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+aryunasgn:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
asgext:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/aryunasgn.awk b/test/aryunasgn.awk
new file mode 100644
index 00000000..ccb3fd23
--- /dev/null
+++ b/test/aryunasgn.awk
@@ -0,0 +1,17 @@
+BEGIN {
+ a[i] = "null" # i is initially undefined
+ for (i in a) { # i is null string
+ print length(i), a[i] # , typeof(i) # 0 null
+ print (i==0), (i=="") # 1 1 should be 0 1
+ }
+ print a[""] # null
+ print a[0] #
+
+ b[$2] = "null also" # $2 is also undefined
+ for (j in b) {
+ print length(j), a[j] # , typeof(i) # 0 null
+ print (j==0), (j=="") # 1 1 should be 0 1
+ }
+ print b[""] # null
+ print b[0] #
+}
diff --git a/test/aryunasgn.ok b/test/aryunasgn.ok
new file mode 100644
index 00000000..798c6de3
--- /dev/null
+++ b/test/aryunasgn.ok
@@ -0,0 +1,8 @@
+0 null
+0 1
+null
+
+0 null
+0 1
+null also
+