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/nsidentifier.awk | |
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/nsidentifier.awk')
-rw-r--r-- | test/nsidentifier.awk | 36 |
1 files changed, 36 insertions, 0 deletions
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 +} |