aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2021-03-30 17:14:06 +0300
committerArnold D. Robbins <arnold@skeeve.com>2021-03-30 17:14:06 +0300
commit2c53d8349f3e5abdbbcd8168ac284c5989b4f444 (patch)
tree29f93fb9d71e8ef654ee32d97c4f360dd3df4b99 /test
parent5887e22adfed809e482da3a6f5b2f37901915aff (diff)
downloadegawk-2c53d8349f3e5abdbbcd8168ac284c5989b4f444.tar.gz
egawk-2c53d8349f3e5abdbbcd8168ac284c5989b4f444.tar.bz2
egawk-2c53d8349f3e5abdbbcd8168ac284c5989b4f444.zip
Update rwarray extension for bool values, and also test code.
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog1
-rw-r--r--test/rwarray.awk11
2 files changed, 12 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index 0212e1ff..a65ff619 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -2,6 +2,7 @@
* Makefile.am (EXTRA_DIST): asortbool, new test.
* asortbool.awk, asortbool.ok: New files.
+ * rwarray.awk: Add test of saving/restoring bool values.
2021-03-08 Arnold D. Robbins <arnold@skeeve.com>
diff --git a/test/rwarray.awk b/test/rwarray.awk
index 86a4b589..831f17c3 100644
--- a/test/rwarray.awk
+++ b/test/rwarray.awk
@@ -11,6 +11,9 @@ BEGIN {
split("-2.4", f)
dict[strnum_sub] = f[1]
+ bool_sub = "bool-sub"
+ dict[bool_sub] = bool(1)
+
n = asorti(dict, dictindices)
for (i = 1; i <= n; i++)
printf("dict[%s] = %s\n", dictindices[i], dict[dictindices[i]]) > "orig.out"
@@ -51,4 +54,12 @@ BEGIN {
if (typeof(dict[strnum_sub]) != "strnum")
printf("dict[\"%s\"] should be strnum, is %s\n",
strnum_sub, typeof(dict[strnum_sub]));
+
+ if (typeof(dict[bool_sub]) != "bool")
+ printf("dict[\"%s\"] should be bool, is %s\n",
+ bool_sub, typeof(dict[bool_sub]));
+
+ if ((dict[bool_sub] "") != "TRUE")
+ printf("dict[\"%s\"] should be TRUE, is %s\n",
+ bool_sub, dict[bool_sub]);
}