diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2022-01-05 21:39:18 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2022-01-05 21:39:18 +0200 |
commit | 8cde2e44a252ac2d80ec3f539d9c2157e8aea33e (patch) | |
tree | 66f4829c40c7b5bce3c530e9b91e9985afcc898b /test | |
parent | b52237743955ece2c890aeb0959c03e70e3175e3 (diff) | |
parent | 7388d79e02299193e991b6714c3b3c5314191154 (diff) | |
download | egawk-8cde2e44a252ac2d80ec3f539d9c2157e8aea33e.tar.gz egawk-8cde2e44a252ac2d80ec3f539d9c2157e8aea33e.tar.bz2 egawk-8cde2e44a252ac2d80ec3f539d9c2157e8aea33e.zip |
Merge branch 'master' into feature/readall
Diffstat (limited to 'test')
-rw-r--r-- | test/ChangeLog | 5 | ||||
-rw-r--r-- | test/Makefile.am | 4 | ||||
-rw-r--r-- | test/Makefile.in | 9 | ||||
-rw-r--r-- | test/Maketests | 5 | ||||
-rw-r--r-- | test/nsidentifier.awk | 36 | ||||
-rw-r--r-- | test/nsidentifier.ok | 118 |
6 files changed, 175 insertions, 2 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index c6c0c657..47289312 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-08 Andrew J. Schorr <aschorr@telemetry-investments.com> * Makefile.am (EXTRA_DIST): Add readall1.awk, readall2.awk, and diff --git a/test/Makefile.am b/test/Makefile.am index 1fa8ad3f..16606b09 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 \ @@ -1459,7 +1461,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 c6c131fc..cb4551e2 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 \ @@ -1725,7 +1727,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 \ @@ -4752,6 +4754,11 @@ nsindirect1: @-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 _$@ + nsindirect2: @echo $@ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index f080c29f..923e1f78 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1800,6 +1800,11 @@ nsindirect1: @-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 _$@ + nsindirect2: @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 |