aboutsummaryrefslogtreecommitdiffstats
path: root/test/aryunasgn.awk
diff options
context:
space:
mode:
Diffstat (limited to 'test/aryunasgn.awk')
-rw-r--r--test/aryunasgn.awk17
1 files changed, 17 insertions, 0 deletions
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] #
+}