aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
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 1fb76bab..7db73f3c 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 b74056ec..abd1fc00 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -848,6 +848,8 @@ EXTRA_DIST = \
nsforloop.ok \
nsfuncrecurse.awk \
nsfuncrecurse.ok \
+ nsidentifier.awk \
+ nsidentifier.ok \
nsindirect1.awk \
nsindirect1.ok \
nsindirect2.awk \
@@ -1453,7 +1455,7 @@ GAWK_EXT_TESTS = \
mbstr2 mixed1 mktime 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 \
+ nsidentifier nsindirect1 nsindirect2 nsprof1 nsprof2 octdec patsplit posix \
printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \
profile0 profile1 profile2 profile3 profile4 profile5 profile6 \
profile7 profile8 profile9 profile10 profile11 profile12 profile13 \
diff --git a/test/Makefile.in b/test/Makefile.in
index d56e90d1..ab45c3aa 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1114,6 +1114,8 @@ EXTRA_DIST = \
nsforloop.ok \
nsfuncrecurse.awk \
nsfuncrecurse.ok \
+ nsidentifier.awk \
+ nsidentifier.ok \
nsindirect1.awk \
nsindirect1.ok \
nsindirect2.awk \
@@ -1719,7 +1721,7 @@ GAWK_EXT_TESTS = \
mbstr2 mixed1 mktime 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 \
+ nsidentifier nsindirect1 nsindirect2 nsprof1 nsprof2 octdec patsplit posix \
printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \
profile0 profile1 profile2 profile3 profile4 profile5 profile6 \
profile7 profile8 profile9 profile10 profile11 profile12 profile13 \
@@ -4727,6 +4729,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 9e00cd57..4c4cfa62 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1790,6 +1790,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