aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2022-01-05 21:29:47 +0200
committerArnold D. Robbins <arnold@skeeve.com>2022-01-05 21:29:47 +0200
commit0e8b44d33b8de608e35e6a649fe84ad9b7c7fffd (patch)
treeafc0ffb888de22ece1b07213c24746ed3633e81b /test
parentaa58c798bed920b6051c4459488195df2b76aaf4 (diff)
parent71a50ec092b75ce2b2f969892c6cd443d44777a5 (diff)
downloadegawk-0e8b44d33b8de608e35e6a649fe84ad9b7c7fffd.tar.gz
egawk-0e8b44d33b8de608e35e6a649fe84ad9b7c7fffd.tar.bz2
egawk-0e8b44d33b8de608e35e6a649fe84ad9b7c7fffd.zip
Merge branch 'gawk-5.1-stable'
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog5
-rw-r--r--test/Makefile.am4
-rw-r--r--test/Makefile.in9
-rw-r--r--test/Maketests5
-rw-r--r--test/nsidentifier.awk36
-rw-r--r--test/nsidentifier.ok118
6 files changed, 175 insertions, 2 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index 034cc63b..66882c59 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2022-01-05 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): nsidentifier, new test.
+ * nsidentifier.awk, nsidentifier.ok: New files.
+
2021-12-07 Andrew J. Schorr <aschorr@telemetry-investments.com>
* iolint.awk, iolint.ok: Reorder "cat" pipe/output file test to reduce
diff --git a/test/Makefile.am b/test/Makefile.am
index 10c5c812..27f12dbb 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -850,6 +850,8 @@ EXTRA_DIST = \
nsforloop.ok \
nsfuncrecurse.awk \
nsfuncrecurse.ok \
+ nsidentifier.awk \
+ nsidentifier.ok \
nsindirect1.awk \
nsindirect1.ok \
nsindirect2.awk \
@@ -1456,7 +1458,7 @@ GAWK_EXT_TESTS = \
modifiers muldimposix nastyparm negtime next nondec nondec2 \
nonfatal1 nonfatal2 nonfatal3 nsawk1a nsawk1b nsawk1c nsawk2a \
nsawk2b nsbad nsbad_cmd nsforloop nsfuncrecurse nsindirect1 \
- nsindirect2 nsprof1 nsprof2 octdec patsplit posix printfbad1 \
+ nsidentifier nsindirect2 nsprof1 nsprof2 octdec patsplit posix printfbad1 \
printfbad2 printfbad3 printfbad4 printhuge procinfs profile0 \
profile1 profile10 profile11 profile12 profile13 profile14 \
profile15 profile16 profile2 profile3 profile4 profile5 profile6 \
diff --git a/test/Makefile.in b/test/Makefile.in
index 6144e749..62a93182 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1116,6 +1116,8 @@ EXTRA_DIST = \
nsforloop.ok \
nsfuncrecurse.awk \
nsfuncrecurse.ok \
+ nsidentifier.awk \
+ nsidentifier.ok \
nsindirect1.awk \
nsindirect1.ok \
nsindirect2.awk \
@@ -1722,7 +1724,7 @@ GAWK_EXT_TESTS = \
modifiers muldimposix nastyparm negtime next nondec nondec2 \
nonfatal1 nonfatal2 nonfatal3 nsawk1a nsawk1b nsawk1c nsawk2a \
nsawk2b nsbad nsbad_cmd nsforloop nsfuncrecurse nsindirect1 \
- nsindirect2 nsprof1 nsprof2 octdec patsplit posix printfbad1 \
+ nsidentifier nsindirect2 nsprof1 nsprof2 octdec patsplit posix printfbad1 \
printfbad2 printfbad3 printfbad4 printhuge procinfs profile0 \
profile1 profile10 profile11 profile12 profile13 profile14 \
profile15 profile16 profile2 profile3 profile4 profile5 profile6 \
@@ -4735,6 +4737,11 @@ nsfuncrecurse:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+nsidentifier:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
nsindirect1:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index f080c29f..ca303c61 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1795,6 +1795,11 @@ nsfuncrecurse:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+nsidentifier:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
nsindirect1:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/nsidentifier.awk b/test/nsidentifier.awk
new file mode 100644
index 00000000..0c665289
--- /dev/null
+++ b/test/nsidentifier.awk
@@ -0,0 +1,36 @@
+# Overdocumented Test Case for FUNCTAB
+
+@namespace "ns"
+
+ns1 = 1 # ns::ns1
+ns::ns2 = 2 # ns::ns2
+awk::defined_in_ns3 = 3 # defined_in_ns3
+@namespace "awk"
+awkspace4 = 4 # awkspace4
+awk::awkspace5 = 5 # awkspace5
+
+BEGIN {
+ list = "awk::defined_in_ns3 awk::awkspace5 ns1 ns::ns1 ns::ns2 awkspace4 awkspace5" # list
+ n = split(list, test) # n, test
+ for (i = 1; i <= n; i++) { # i
+ var = test[i] # var
+ sub(/awk::/, "", var) # no 'awk::' in SYMTAB or SYMTAB
+
+ yesno = (test[i] in FUNCTAB) ? "Yes" : "No " # yesno
+ printf("%s %s in FUNCTAB\n", yesno, test[i])
+ yesno = (test[i] in PROCINFO["identifiers"]) ? "Yes" : "No "
+ printf("%s %s in PROCINFO[\"identifiers\"]\n", yesno, test[i])
+
+ yesno = (var in SYMTAB) ? "Yes" : "No "
+ printf("%s %s in SYMTAB\n", yesno, var)
+ yesno = (var in PROCINFO["identifiers"]) ? "Yes" :"No "
+ printf("%s %s in PROCINFO[\"identifiers\"]\n", yesno, var)
+ printf("\n")
+ }
+ print "------------------------------"
+ for (i in PROCINFO["identifiers"])
+ print i | "LC_ALL=C sort"
+ close("LC_ALL=C sort")
+
+ exit 0
+}
diff --git a/test/nsidentifier.ok b/test/nsidentifier.ok
new file mode 100644
index 00000000..5743f94c
--- /dev/null
+++ b/test/nsidentifier.ok
@@ -0,0 +1,118 @@
+No awk::defined_in_ns3 in FUNCTAB
+No awk::defined_in_ns3 in PROCINFO["identifiers"]
+Yes defined_in_ns3 in SYMTAB
+Yes defined_in_ns3 in PROCINFO["identifiers"]
+
+No awk::awkspace5 in FUNCTAB
+No awk::awkspace5 in PROCINFO["identifiers"]
+Yes awkspace5 in SYMTAB
+Yes awkspace5 in PROCINFO["identifiers"]
+
+No ns1 in FUNCTAB
+No ns1 in PROCINFO["identifiers"]
+No ns1 in SYMTAB
+No ns1 in PROCINFO["identifiers"]
+
+No ns::ns1 in FUNCTAB
+Yes ns::ns1 in PROCINFO["identifiers"]
+Yes ns::ns1 in SYMTAB
+Yes ns::ns1 in PROCINFO["identifiers"]
+
+No ns::ns2 in FUNCTAB
+Yes ns::ns2 in PROCINFO["identifiers"]
+Yes ns::ns2 in SYMTAB
+Yes ns::ns2 in PROCINFO["identifiers"]
+
+No awkspace4 in FUNCTAB
+Yes awkspace4 in PROCINFO["identifiers"]
+Yes awkspace4 in SYMTAB
+Yes awkspace4 in PROCINFO["identifiers"]
+
+No awkspace5 in FUNCTAB
+Yes awkspace5 in PROCINFO["identifiers"]
+Yes awkspace5 in SYMTAB
+Yes awkspace5 in PROCINFO["identifiers"]
+
+------------------------------
+ARGC
+ARGIND
+ARGV
+BINMODE
+CONVFMT
+ENVIRON
+ERRNO
+FIELDWIDTHS
+FILENAME
+FNR
+FPAT
+FS
+FUNCTAB
+IGNORECASE
+LINT
+NF
+NR
+OFMT
+OFS
+ORS
+PREC
+PROCINFO
+RLENGTH
+ROUNDMODE
+RS
+RSTART
+RT
+SUBSEP
+SYMTAB
+TEXTDOMAIN
+and
+asort
+asorti
+atan2
+awkspace4
+awkspace5
+bindtextdomain
+close
+compl
+cos
+dcgettext
+dcngettext
+defined_in_ns3
+exp
+fflush
+gensub
+gsub
+i
+index
+int
+isarray
+length
+list
+log
+lshift
+match
+mktime
+n
+ns::ns1
+ns::ns2
+or
+patsplit
+rand
+rshift
+sin
+split
+sprintf
+sqrt
+srand
+strftime
+strtonum
+sub
+substr
+system
+systime
+test
+tolower
+toupper
+typeof
+var
+xor
+yesno