aboutsummaryrefslogtreecommitdiffstats
path: root/test/arraytype.awk
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2019-01-09 10:51:28 -0500
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2019-01-09 10:51:28 -0500
commit56f4a4139ad7e81064e25887f959a4a6e5e54a58 (patch)
tree01645ae916a19e911d2111763beead9faa1ba7ab /test/arraytype.awk
parent0e1fd064f13b220a129fc720607d3f62b55b3b19 (diff)
downloadegawk-56f4a4139ad7e81064e25887f959a4a6e5e54a58.tar.gz
egawk-56f4a4139ad7e81064e25887f959a4a6e5e54a58.tar.bz2
egawk-56f4a4139ad7e81064e25887f959a4a6e5e54a58.zip
Implement optional second array arg to type of returning info on variable internals.
Diffstat (limited to 'test/arraytype.awk')
-rw-r--r--test/arraytype.awk35
1 files changed, 35 insertions, 0 deletions
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"]
+}