diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ChangeLog | 80 | ||||
-rw-r--r-- | test/Makefile.am | 61 | ||||
-rw-r--r-- | test/Makefile.in | 115 | ||||
-rw-r--r-- | test/Maketests | 55 | ||||
-rw-r--r-- | test/arraytype.awk | 35 | ||||
-rw-r--r-- | test/arraytype.ok | 16 | ||||
-rw-r--r-- | test/eofsrc1.ok | 3 | ||||
-rw-r--r-- | test/eofsrc1a.awk | 2 | ||||
-rw-r--r-- | test/eofsrc1b.awk | 2 | ||||
-rw-r--r-- | test/inplace1.ok | 2 | ||||
-rw-r--r-- | test/inplace2.ok | 2 | ||||
-rw-r--r-- | test/inplace3.ok | 4 | ||||
-rw-r--r-- | test/nsbad.awk | 15 | ||||
-rw-r--r-- | test/nsbad.ok | 13 | ||||
-rw-r--r-- | test/nsbad_cmd.ok | 3 | ||||
-rw-r--r-- | test/nsindirect1.awk | 13 | ||||
-rw-r--r-- | test/nsindirect1.ok | 2 | ||||
-rw-r--r-- | test/nsindirect2.awk | 44 | ||||
-rw-r--r-- | test/nsindirect2.ok | 5 | ||||
-rw-r--r-- | test/nsprof1.awk | 16 | ||||
-rw-r--r-- | test/nsprof1.ok | 19 | ||||
-rw-r--r-- | test/nsprof2.awk | 74 | ||||
-rw-r--r-- | test/nsprof2.ok | 75 | ||||
-rw-r--r-- | test/profile0.ok | 2 | ||||
-rw-r--r-- | test/profile10.ok | 12 | ||||
-rw-r--r-- | test/profile11.awk | 321 | ||||
-rw-r--r-- | test/profile11.ok | 371 | ||||
-rw-r--r-- | test/profile5.ok | 222 | ||||
-rw-r--r-- | test/sourcesplit.ok | 4 | ||||
-rw-r--r-- | test/symtab6.ok | 30 | ||||
-rw-r--r-- | test/symtab7.ok | 4 | ||||
-rw-r--r-- | test/testext.ok | 3 | ||||
-rw-r--r-- | test/unterm.ok | 4 |
33 files changed, 1439 insertions, 190 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 69cedf65..812f3faf 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2019-01-09 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * Makefile.am (EXTRA_DIST): New test: arraytype. + * arraytype.awk, arraytype.ok: New files. + 2018-12-24 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (inetdayt, inetdayu, inetecht, inetechu): Add @@ -12,12 +17,41 @@ * Makefile.am (EXTRA_DIST): New test: dfacheck1. * dfacheck1.awk, dfacheck1.in, dfacheck1.ok: New files. +2018-12-12 Arnold D. Robbins <arnold@skeeve.com> + + * nsprof2.awk: Add extra @namespace lines for testing. + * nsprof2.ok: Adjusted. + +2018-12-06 Arnold D. Robbins <arnold@skeeve.com> + + * nsprof2.awk, nsprof2.ok: Updated after code changes. + +2018-11-28 Arnold D. Robbins <arnold@skeeve.com> + + * profile11.ok: Updated after code change. + +2018-11-27 Arnold D. Robbins <arnold@skeeve.com> + + * profile11.awk: Disambiguate some comments. + * profile5.ok, profile11.ok: Updated after code change. + +2018-11-26 Arnold D. Robbins <arnold@skeeve.com> + + * profile5.ok: Updated after code change. + * Makefile.am (GAWK_EXT_TESTS): New test, profile11.ok. Add + to the other relevant macros. + * profile11.awk, profile11.ok: New files. + 2018-11-25 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (GAWK_EXT_TESTS): Fix layout of the list. 2018-11-24 Arnold D. Robbins <arnold@skeeve.com> + * profile5.ok: Updated after code change. + +2018-11-24 Arnold D. Robbins <arnold@skeeve.com> + * spacere.awk: Move setting of LC_ALL=C out to ... * Makefile.am (spacere): ... here. Added test. Per request from Eli Zaretskii to help porting to MinGW. @@ -27,6 +61,14 @@ * Makefile.am (EXTRA_DIST): New test: typedregex4. * typedregex4.awk, typedregex4.ok: New files. +2018-11-11 Arnold D. Robbins <arnold@skeeve.com> + + * profile10.ok: Updated after code change. + +2018-10-14 Arnold D. Robbins <arnold@skeeve.com> + + * profile0.ok: Updated after code change. + 2018-10-10 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (profile1): Add minus to ignore errors on final @@ -455,6 +497,40 @@ * inplace1.ok, inplace2.ok, inplace3.ok: Update after adding license to inplace.awk. +2017-07-26 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (nsbad_cmd, nsindirect1, nsindirect2): New tests. + * nsbad_cmd.ok, nsindirect1.awk, nsindirect1.ok, nsindirect2.awk, + nsindirect2.ok: New files. + +2017-07-26 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (nsbad): New test. + * nsbad.awk, nsbad.ok: New files. + +2017-07-20 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (inplace1, inplace2, inplace3): Update to use + inplace::suffix instead of INPLACE_SUFFIX. + * inplace1.ok, inplace2.ok, inplace3.ok: Update after code + changes. + +2017-07-07 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (eofsrc1): New test. + * eofsrc1a.awk, eofsrc1b.awk, eofsrc1.ok: New files. + * unterm.ok: Updated after code change. + +2017-07-01 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (nsprof2): New test. + * nsprof2.awk, nsprof2.ok: New files. + +2017-06-30 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (nsprof1): New test. + * nsprof1.awk, nsprof1.ok: New files. + 2017-06-27 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (mbprintf5): Skip this test on Cygwin. @@ -469,6 +545,10 @@ * Makefile.am (mbprintf5): New test. * mbprintf5.awk, mbprintf5.in, mbprintf5.ok: New files. +2017-05-30 Arnold D. Robbins <arnold@skeeve.com> + + * sourceplit.ok: Revise to match changed code. + 2017-05-24 Andrew J. Schorr <aschorr@telemetry-investments.com> * fwtest8.ok: Fix field number in error message, thanks to a bug diff --git a/test/Makefile.am b/test/Makefile.am index c6b8caeb..0ffad9ad 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -76,6 +76,8 @@ EXTRA_DIST = \ arraysort.ok \ arraysort2.awk \ arraysort2.ok \ + arraytype.awk \ + arraytype.ok \ arrdbg.awk \ arrymem1.awk \ arrymem1.ok \ @@ -260,6 +262,9 @@ EXTRA_DIST = \ dynlj.ok \ eofsplit.awk \ eofsplit.ok \ + eofsrc1a.awk \ + eofsrc1b.awk \ + eofsrc1.ok \ errno.awk \ errno.in \ errno.ok \ @@ -765,6 +770,17 @@ EXTRA_DIST = \ noparms.ok \ nors.in \ nors.ok \ + nsbad.awk \ + nsbad.ok \ + nsbad_cmd.ok \ + nsindirect1.awk \ + nsindirect1.ok \ + nsindirect2.awk \ + nsindirect2.ok \ + nsprof1.awk \ + nsprof1.ok \ + nsprof2.awk \ + nsprof2.ok \ nulinsrc.awk \ nulinsrc.ok \ nulrsend.awk \ @@ -902,6 +918,8 @@ EXTRA_DIST = \ profile9.ok \ profile10.awk \ profile10.ok \ + profile11.awk \ + profile11.ok \ prt1eval.awk \ prt1eval.ok \ prtoeval.awk \ @@ -1254,10 +1272,10 @@ BASIC_TESTS = \ callparam childin clobber closebad clsflnam compare compare2 \ concat1 concat2 concat3 concat4 concat5 convfmt \ datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \ - eofsplit exit2 exitval1 exitval2 exitval3 fcall_exit fcall_exit2 \ - fldchg fldchgnf fldterm fnamedat fnarray fnarray2 fnaryscl fnasgnm fnmisc \ - fordel forref forsimp fsbs fsnul1 fsrs fsspcoln fstabplus funsemnl \ - funsmnam funstack \ + eofsplit eofsrc1 exit2 exitval1 exitval2 exitval3 \ + fcall_exit fcall_exit2 fldchg fldchgnf fldterm fnamedat fnarray fnarray2 \ + fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fsnul1 fsrs fsspcoln \ + fstabplus funsemnl funsmnam funstack \ getline getline2 getline3 getline4 getline5 getlnbuf getnr2tb getnr2tm \ gsubasgn gsubtest gsubtst2 gsubtst3 gsubtst4 gsubtst5 gsubtst6 gsubtst7 \ gsubtst8 \ @@ -1292,6 +1310,7 @@ UNIX_TESTS = \ GAWK_EXT_TESTS = \ aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort arraysort2 \ + arraytype \ backw badargs beginfile1 beginfile2 binmode1 \ charasbytes colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \ clos1way6 crlf \ @@ -1306,19 +1325,20 @@ GAWK_EXT_TESTS = \ incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 include include2 \ indirectbuiltin indirectcall indirectcall2 intarray isarrayunset \ lint lintexp lintindex lintint lintlength lintold lintset lintwarn \ - mixed1 mktime manyfiles match1 match2 match3 mbstr1 mbstr2 muldimposix \ + manyfiles match1 match2 match3 mbstr1 mbstr2 mixed1 mktime muldimposix \ nastyparm negtime next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 \ + nsbad nsbad_cmd nsindirect1 nsindirect2 nsprof1 nsprof2 \ patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge \ procinfs profile0 profile1 profile2 profile3 profile4 profile5 profile6 \ - profile7 profile8 profile9 profile10 pty1 pty2 \ + profile7 profile8 profile9 profile10 profile11 pty1 pty2 \ rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin \ rsstart1 rsstart2 rsstart3 rstest6 \ shadow shadowbuiltin sortfor sortfor2 sortu sourcesplit split_after_fpat \ - splitarg4 strftime strftfld strtonum strtonum1 switch2 symtab1 symtab2 \ + splitarg4 strftfld strftime strtonum strtonum1 switch2 symtab1 symtab2 \ symtab3 symtab4 symtab5 symtab6 symtab7 symtab8 symtab9 symtab10 \ - typedregex1 typedregex2 typedregex3 typedregex4 \ + timeout typedregex1 typedregex2 typedregex3 typedregex4 \ typeof1 typeof2 typeof3 typeof4 typeof5 \ - timeout watchpoint1 + watchpoint1 ARRAYDEBUG_TESTS = arrdbg @@ -1367,7 +1387,8 @@ NEED_NONDEC = mpfrbigint2 nondec2 intarray forcenum NEED_POSIX = printf0 posix2008sub paramasfunc1 paramasfunc2 muldimposix # List of tests that need --pretty-print -NEED_PRETTY = profile4 profile5 profile8 profile9 profile10 +NEED_PRETTY = nsprof1 nsprof2 \ + profile4 profile5 profile8 profile9 profile10 profile11 # List of tests that need --re-interval NEED_RE_INTERVAL = gsubtst3 reint reint2 @@ -2026,7 +2047,7 @@ inplace2:: @echo $@ @cp "$(srcdir)"/inplace.1.in _$@.1 @cp "$(srcdir)"/inplace.2.in _$@.2 - @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v inplace::suffix=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ @-$(CMP) "$(srcdir)"/$@.1.ok _$@.1 && rm -f _$@.1 @-$(CMP) "$(srcdir)"/$@.1.bak.ok _$@.1.bak && rm -f _$@.1.bak @@ -2037,8 +2058,8 @@ inplace3:: @echo $@ @cp "$(srcdir)"/inplace.1.in _$@.1 @cp "$(srcdir)"/inplace.2.in _$@.2 - @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "Before"} {gsub(/bar/, "foo"); print} END {print "After"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v inplace::suffix=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v inplace::suffix=.bak 'BEGIN {print "Before"} {gsub(/bar/, "foo"); print} END {print "After"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ @-$(CMP) "$(srcdir)"/$@.1.ok _$@.1 && rm -f _$@.1 @-$(CMP) "$(srcdir)"/$@.1.bak.ok _$@.1.bak && rm -f _$@.1.bak @@ -2104,8 +2125,7 @@ charasbytes: symtab6: @echo $@ - @$(AWK) -d__$@ -f "$(srcdir)"/$@.awk - @grep -v '^ENVIRON' __$@ | grep -v '^PROCINFO' > _$@ ; rm __$@ + @$(AWK) -f "$(srcdir)"/$@.awk > _$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ symtab8: @@ -2195,6 +2215,17 @@ sourcesplit: @AWKPATH="$(srcdir)" $(AWK) --source='BEGIN { a = 5;' --source='print a }' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +eofsrc1: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f "$(srcdir)"/$@a.awk -f "$(srcdir)"/$@b.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +nsbad_cmd: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -v foo:bar=3 -v foo:::blat=4 1 /dev/null >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + + # Use [:] in the regexp to keep MSYS from converting the /'s to \'s. nonfatal1: @echo $@ diff --git a/test/Makefile.in b/test/Makefile.in index c95a1dc8..c244c7af 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -334,6 +334,8 @@ EXTRA_DIST = \ arraysort.ok \ arraysort2.awk \ arraysort2.ok \ + arraytype.awk \ + arraytype.ok \ arrdbg.awk \ arrymem1.awk \ arrymem1.ok \ @@ -518,6 +520,9 @@ EXTRA_DIST = \ dynlj.ok \ eofsplit.awk \ eofsplit.ok \ + eofsrc1a.awk \ + eofsrc1b.awk \ + eofsrc1.ok \ errno.awk \ errno.in \ errno.ok \ @@ -1023,6 +1028,17 @@ EXTRA_DIST = \ noparms.ok \ nors.in \ nors.ok \ + nsbad.awk \ + nsbad.ok \ + nsbad_cmd.ok \ + nsindirect1.awk \ + nsindirect1.ok \ + nsindirect2.awk \ + nsindirect2.ok \ + nsprof1.awk \ + nsprof1.ok \ + nsprof2.awk \ + nsprof2.ok \ nulinsrc.awk \ nulinsrc.ok \ nulrsend.awk \ @@ -1160,6 +1176,8 @@ EXTRA_DIST = \ profile9.ok \ profile10.awk \ profile10.ok \ + profile11.awk \ + profile11.ok \ prt1eval.awk \ prt1eval.ok \ prtoeval.awk \ @@ -1512,10 +1530,10 @@ BASIC_TESTS = \ callparam childin clobber closebad clsflnam compare compare2 \ concat1 concat2 concat3 concat4 concat5 convfmt \ datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \ - eofsplit exit2 exitval1 exitval2 exitval3 fcall_exit fcall_exit2 \ - fldchg fldchgnf fldterm fnamedat fnarray fnarray2 fnaryscl fnasgnm fnmisc \ - fordel forref forsimp fsbs fsnul1 fsrs fsspcoln fstabplus funsemnl \ - funsmnam funstack \ + eofsplit eofsrc1 exit2 exitval1 exitval2 exitval3 \ + fcall_exit fcall_exit2 fldchg fldchgnf fldterm fnamedat fnarray fnarray2 \ + fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fsnul1 fsrs fsspcoln \ + fstabplus funsemnl funsmnam funstack \ getline getline2 getline3 getline4 getline5 getlnbuf getnr2tb getnr2tm \ gsubasgn gsubtest gsubtst2 gsubtst3 gsubtst4 gsubtst5 gsubtst6 gsubtst7 \ gsubtst8 \ @@ -1550,6 +1568,7 @@ UNIX_TESTS = \ GAWK_EXT_TESTS = \ aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort arraysort2 \ + arraytype \ backw badargs beginfile1 beginfile2 binmode1 \ charasbytes colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \ clos1way6 crlf \ @@ -1564,19 +1583,20 @@ GAWK_EXT_TESTS = \ incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 include include2 \ indirectbuiltin indirectcall indirectcall2 intarray isarrayunset \ lint lintexp lintindex lintint lintlength lintold lintset lintwarn \ - mixed1 mktime manyfiles match1 match2 match3 mbstr1 mbstr2 muldimposix \ + manyfiles match1 match2 match3 mbstr1 mbstr2 mixed1 mktime muldimposix \ nastyparm negtime next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 \ + nsbad nsbad_cmd nsindirect1 nsindirect2 nsprof1 nsprof2 \ patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge \ procinfs profile0 profile1 profile2 profile3 profile4 profile5 profile6 \ - profile7 profile8 profile9 profile10 pty1 pty2 \ + profile7 profile8 profile9 profile10 profile11 pty1 pty2 \ rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin \ rsstart1 rsstart2 rsstart3 rstest6 \ shadow shadowbuiltin sortfor sortfor2 sortu sourcesplit split_after_fpat \ - splitarg4 strftime strftfld strtonum strtonum1 switch2 symtab1 symtab2 \ + splitarg4 strftfld strftime strtonum strtonum1 switch2 symtab1 symtab2 \ symtab3 symtab4 symtab5 symtab6 symtab7 symtab8 symtab9 symtab10 \ - typedregex1 typedregex2 typedregex3 typedregex4 \ + timeout typedregex1 typedregex2 typedregex3 typedregex4 \ typeof1 typeof2 typeof3 typeof4 typeof5 \ - timeout watchpoint1 + watchpoint1 ARRAYDEBUG_TESTS = arrdbg EXTRA_TESTS = inftest regtest ignrcas3 @@ -1624,7 +1644,8 @@ NEED_NONDEC = mpfrbigint2 nondec2 intarray forcenum NEED_POSIX = printf0 posix2008sub paramasfunc1 paramasfunc2 muldimposix # List of tests that need --pretty-print -NEED_PRETTY = profile4 profile5 profile8 profile9 profile10 +NEED_PRETTY = nsprof1 nsprof2 \ + profile4 profile5 profile8 profile9 profile10 profile11 # List of tests that need --re-interval NEED_RE_INTERVAL = gsubtst3 reint reint2 @@ -2474,7 +2495,7 @@ inplace2:: @echo $@ @cp "$(srcdir)"/inplace.1.in _$@.1 @cp "$(srcdir)"/inplace.2.in _$@.2 - @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v inplace::suffix=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ @-$(CMP) "$(srcdir)"/$@.1.ok _$@.1 && rm -f _$@.1 @-$(CMP) "$(srcdir)"/$@.1.bak.ok _$@.1.bak && rm -f _$@.1.bak @@ -2485,8 +2506,8 @@ inplace3:: @echo $@ @cp "$(srcdir)"/inplace.1.in _$@.1 @cp "$(srcdir)"/inplace.2.in _$@.2 - @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "Before"} {gsub(/bar/, "foo"); print} END {print "After"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v inplace::suffix=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v inplace::suffix=.bak 'BEGIN {print "Before"} {gsub(/bar/, "foo"); print} END {print "After"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ @-$(CMP) "$(srcdir)"/$@.1.ok _$@.1 && rm -f _$@.1 @-$(CMP) "$(srcdir)"/$@.1.bak.ok _$@.1.bak && rm -f _$@.1.bak @@ -2552,8 +2573,7 @@ charasbytes: symtab6: @echo $@ - @$(AWK) -d__$@ -f "$(srcdir)"/$@.awk - @grep -v '^ENVIRON' __$@ | grep -v '^PROCINFO' > _$@ ; rm __$@ + @$(AWK) -f "$(srcdir)"/$@.awk > _$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ symtab8: @@ -2641,6 +2661,16 @@ sourcesplit: @AWKPATH="$(srcdir)" $(AWK) --source='BEGIN { a = 5;' --source='print a }' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +eofsrc1: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f "$(srcdir)"/$@a.awk -f "$(srcdir)"/$@b.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +nsbad_cmd: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -v foo:bar=3 -v foo:::blat=4 1 /dev/null >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + # Use [:] in the regexp to keep MSYS from converting the /'s to \'s. nonfatal1: @echo $@ @@ -3944,6 +3974,11 @@ arraysort2: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +arraytype: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + backw: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -4276,11 +4311,6 @@ lintwarn: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ -mktime: - @echo $@ - @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ - match1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -4308,6 +4338,11 @@ mbstr2: AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +mktime: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + muldimposix: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --posix >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -4343,6 +4378,31 @@ nonfatal3: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +nsbad: + @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: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +nsindirect2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +nsprof1: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +nsprof2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + patsplit: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -4404,6 +4464,11 @@ profile10: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +profile11: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + regnul1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -4540,6 +4605,11 @@ symtab10: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --debug < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +timeout: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + typedregex1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -4580,11 +4650,6 @@ typeof5: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ -timeout: - @echo $@ - @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ - double1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index 05804988..7163b4ab 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1269,6 +1269,11 @@ arraysort2: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +arraytype: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + backw: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1601,11 +1606,6 @@ lintwarn: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ -mktime: - @echo $@ - @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ - match1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1633,6 +1633,11 @@ mbstr2: AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +mktime: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + muldimposix: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --posix >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1668,6 +1673,31 @@ nonfatal3: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +nsbad: + @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: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +nsindirect2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +nsprof1: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +nsprof2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + patsplit: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1729,6 +1759,11 @@ profile10: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +profile11: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + regnul1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1865,6 +1900,11 @@ symtab10: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --debug < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +timeout: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + typedregex1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1905,11 +1945,6 @@ typeof5: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ -timeout: - @echo $@ - @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ - double1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/arraytype.awk b/test/arraytype.awk new file mode 100644 index 00000000..70fd72b0 --- /dev/null +++ b/test/arraytype.awk @@ -0,0 +1,35 @@ +BEGIN { + # N.B. This relies upon the undocumented 2nd argument to typeof + x[0] = 0 + print typeof(x, a) + print a["array_type"] + + # make sure it resets + delete x[0] + print typeof(x, a) + print a["array_type"] + + x["fubar"] = 0 + print typeof(x, a) + print a["array_type"] + + delete x["fubar"] + print typeof(x, a) + print a["array_type"] + + x[-2] = 0 + print typeof(x, a) + print a["array_type"] + + delete x[-2] + print typeof(x, a) + print a["array_type"] + + x[2] = 0 + print typeof(x, a) + print a["array_type"] + + delete x + print typeof(x, a) + print a["array_type"] +} diff --git a/test/arraytype.ok b/test/arraytype.ok new file mode 100644 index 00000000..6595bb89 --- /dev/null +++ b/test/arraytype.ok @@ -0,0 +1,16 @@ +array +cint +array +null +array +str +array +null +array +int +array +null +array +cint +array +null diff --git a/test/eofsrc1.ok b/test/eofsrc1.ok new file mode 100644 index 00000000..64d85b33 --- /dev/null +++ b/test/eofsrc1.ok @@ -0,0 +1,3 @@ +gawk: ./eofsrc1a.awk:2: (END OF FILE) +gawk: ./eofsrc1a.awk:2: ^ source files / command-line arguments must contain complete functions or rules +EXIT CODE: 1 diff --git a/test/eofsrc1a.awk b/test/eofsrc1a.awk new file mode 100644 index 00000000..55143c2b --- /dev/null +++ b/test/eofsrc1a.awk @@ -0,0 +1,2 @@ +BEGIN { + n = 5 diff --git a/test/eofsrc1b.awk b/test/eofsrc1b.awk new file mode 100644 index 00000000..0dad2163 --- /dev/null +++ b/test/eofsrc1b.awk @@ -0,0 +1,2 @@ + print n +} diff --git a/test/inplace1.ok b/test/inplace1.ok index 730d7754..753079b3 100644 --- a/test/inplace1.ok +++ b/test/inplace1.ok @@ -1,5 +1,5 @@ before -gawk: inplace:47: warning: inplace_begin: disabling in-place editing for invalid FILENAME `-' +gawk: inplace:53: warning: inplace::begin: disabling in-place editing for invalid FILENAME `-' stdin start is bar replaced? stdin end diff --git a/test/inplace2.ok b/test/inplace2.ok index 730d7754..753079b3 100644 --- a/test/inplace2.ok +++ b/test/inplace2.ok @@ -1,5 +1,5 @@ before -gawk: inplace:47: warning: inplace_begin: disabling in-place editing for invalid FILENAME `-' +gawk: inplace:53: warning: inplace::begin: disabling in-place editing for invalid FILENAME `-' stdin start is bar replaced? stdin end diff --git a/test/inplace3.ok b/test/inplace3.ok index 815cd1c7..7802a0c8 100644 --- a/test/inplace3.ok +++ b/test/inplace3.ok @@ -1,11 +1,11 @@ before -gawk: inplace:47: warning: inplace_begin: disabling in-place editing for invalid FILENAME `-' +gawk: inplace:53: warning: inplace::begin: disabling in-place editing for invalid FILENAME `-' stdin start is bar replaced? stdin end after Before -gawk: inplace:47: warning: inplace_begin: disabling in-place editing for invalid FILENAME `-' +gawk: inplace:53: warning: inplace::begin: disabling in-place editing for invalid FILENAME `-' stdin start is foo replaced? stdin end diff --git a/test/nsbad.awk b/test/nsbad.awk new file mode 100644 index 00000000..825bb35c --- /dev/null +++ b/test/nsbad.awk @@ -0,0 +1,15 @@ +@namespace "1foo" +@namespace "for" +@namespace "42f" +@namespace "ab#d" + +BEGIN { + foo75::bar = 57 + if::junk = 1 + foo::match = 3 +} + +@namespace "foo" +function gsub () { + print "foo::gsub" +} diff --git a/test/nsbad.ok b/test/nsbad.ok new file mode 100644 index 00000000..dfa228a7 --- /dev/null +++ b/test/nsbad.ok @@ -0,0 +1,13 @@ +gawk: nsbad.awk:1: error: namespace name `1foo' must meet identifier naming rules +gawk: nsbad.awk:2: error: using reserved identifier `for' as a namespace is not allowed +gawk: nsbad.awk:3: error: namespace name `42f' must meet identifier naming rules +gawk: nsbad.awk:4: error: namespace name `ab#d' must meet identifier naming rules +gawk: nsbad.awk:8: error: using reserved identifier `if' as a namespace is not allowed +gawk: nsbad.awk:8: if::junk = 1 +gawk: nsbad.awk:8: ^ syntax error +gawk: nsbad.awk:9: error: using reserved identifier `match' as second component of a qualified name is not allowed +gawk: nsbad.awk:9: foo::match = 3 +gawk: nsbad.awk:9: ^ syntax error +gawk: nsbad.awk:13: function gsub () { +gawk: nsbad.awk:13: ^ `gsub' is a built-in function, it cannot be redefined +EXIT CODE: 1 diff --git a/test/nsbad_cmd.ok b/test/nsbad_cmd.ok new file mode 100644 index 00000000..cbca6ea0 --- /dev/null +++ b/test/nsbad_cmd.ok @@ -0,0 +1,3 @@ +gawk: error: identifier foo:bar: namespace separator is two colons, not one +gawk: error: qualified identifier `foo:::blat' is badly formed +EXIT CODE: 1 diff --git a/test/nsindirect1.awk b/test/nsindirect1.awk new file mode 100644 index 00000000..d04863f5 --- /dev/null +++ b/test/nsindirect1.awk @@ -0,0 +1,13 @@ +@namespace "test" + +BEGIN { + bar = 3 +} + +@namespace "awk" + +BEGIN { + print "before change, direct =", test::bar, "indirect =", SYMTAB["test::bar"] + SYMTAB["test::bar"] = 4 + print "after change, direct =", test::bar, "indirect =", SYMTAB["test::bar"] +} diff --git a/test/nsindirect1.ok b/test/nsindirect1.ok new file mode 100644 index 00000000..ab2e31ba --- /dev/null +++ b/test/nsindirect1.ok @@ -0,0 +1,2 @@ +before change, direct = 3 indirect = 3 +after change, direct = 4 indirect = 4 diff --git a/test/nsindirect2.awk b/test/nsindirect2.awk new file mode 100644 index 00000000..8017e8f7 --- /dev/null +++ b/test/nsindirect2.awk @@ -0,0 +1,44 @@ +BEGIN { + stftime::gensub = 3 # should be OK, not related to indirect calls +} + + +BEGIN { base_time = systime() } # in awk namespace + +@namespace "testing" + +function strftime(mesg) +{ + printf("strftime(%s) - this is not the function you are looking for\n", + mesg) + return 0 +} + +BEGIN { + strftime("from 'testing'") + gensub = "gensub" + print "gensub =", gensub +} + +function systime() +{ + return awk::base_time +} + +BEGIN { + st = "systime" + now[1] = @st() + + st = "awk::systime" + now[2] = @st() + + st = "testing::systime" + now[3] = @st() + + for (i = 1; i <= 3; i++) { + if (now[i] == awk::base_time || now[i] == awk::base_time + 1) + printf "iteration %d, got good result from systime\n", i + else + printf "iteration %d, got bad result from systime, now %d, base_time %d\n", i, now, awk::base_time + } +} diff --git a/test/nsindirect2.ok b/test/nsindirect2.ok new file mode 100644 index 00000000..9b71cd92 --- /dev/null +++ b/test/nsindirect2.ok @@ -0,0 +1,5 @@ +strftime() - this is not the function you are looking for +gensub = gensub +iteration 1, got good result from systime +iteration 2, got good result from systime +iteration 3, got good result from systime diff --git a/test/nsprof1.awk b/test/nsprof1.awk new file mode 100644 index 00000000..46be5bc9 --- /dev/null +++ b/test/nsprof1.awk @@ -0,0 +1,16 @@ +@namespace "foo" + +BEGIN { + a = 5 + a++ + print a +} + +/foo/ { print "bar" } + +@namespace "stuff" + +function stuff() +{ + print "stuff" +} diff --git a/test/nsprof1.ok b/test/nsprof1.ok new file mode 100644 index 00000000..eacc2707 --- /dev/null +++ b/test/nsprof1.ok @@ -0,0 +1,19 @@ +@namespace "foo" + +BEGIN { + a = 5 + a++ + print a +} + +/foo/ { + print "bar" +} + +@namespace "stuff" + + +function stuff() +{ + print "stuff" +} diff --git a/test/nsprof2.awk b/test/nsprof2.awk new file mode 100644 index 00000000..9c7da57e --- /dev/null +++ b/test/nsprof2.awk @@ -0,0 +1,74 @@ +# passwd.awk --- access password file information +# +# Arnold Robbins, arnold@skeeve.com, Public Domain +# May 1993 +# Revised October 2000 +# Revised December 2010 +# Revised July 2017 + +@namespace "foo" # this is foo + +@namespace "bar" # this is bar + +@namespace "passwd" # move to passwd namespace + +BEGIN { + # tailor this to suit your system + Awklib = "/usr/local/libexec/awk/" +} + +function Init( oldfs, oldrs, olddol0, pwcat, using_fw, using_fpat) +{ + if (Inited) + return + + oldfs = FS + oldrs = RS + olddol0 = $0 + using_fw = (PROCINFO["FS"] == "FIELDWIDTHS") + using_fpat = (PROCINFO["FS"] == "FPAT") + FS = ":" + RS = "\n" + + pwcat = Awklib "pwcat" + while ((pwcat | getline) > 0) { + Byname[$1] = $0 + Byuid[$3] = $0 + Bycount[++Total] = $0 + } + close(pwcat) + Count = 0 + Inited = 1 + FS = oldfs + if (using_fw) + FIELDWIDTHS = FIELDWIDTHS + else if (using_fpat) + FPAT = FPAT + RS = oldrs + $0 = olddol0 +} + +function awk::getpwnam(name) +{ + Init() + return Byname[name] +} + +function awk::getpwuid(uid) +{ + Init() + return Byuid[uid] +} + +function awk::getpwent() +{ + Init() + if (Count < Total) + return Bycount[++Count] + return "" +} + +function awk::endpwent() +{ + Count = 0 +} diff --git a/test/nsprof2.ok b/test/nsprof2.ok new file mode 100644 index 00000000..1bb78822 --- /dev/null +++ b/test/nsprof2.ok @@ -0,0 +1,75 @@ +# passwd.awk --- access password file information +# +# Arnold Robbins, arnold@skeeve.com, Public Domain +# May 1993 +# Revised October 2000 +# Revised December 2010 +# Revised July 2017 +@namespace "foo" # this is foo + +@namespace "bar" # this is bar + +@namespace "passwd" # move to passwd namespace + +BEGIN { + # tailor this to suit your system + Awklib = "/usr/local/libexec/awk/" +} + + +function awk::endpwent() +{ + Count = 0 +} + +function awk::getpwent() +{ + Init() + if (Count < Total) { + return Bycount[++Count] + } + return "" +} + +function awk::getpwnam(name) +{ + Init() + return Byname[name] +} + +function awk::getpwuid(uid) +{ + Init() + return Byuid[uid] +} + +function Init(oldfs, oldrs, olddol0, pwcat, using_fw, using_fpat) +{ + if (Inited) { + return + } + oldfs = awk::FS + oldrs = awk::RS + olddol0 = $0 + using_fw = (awk::PROCINFO["FS"] == "FIELDWIDTHS") + using_fpat = (awk::PROCINFO["FS"] == "FPAT") + awk::FS = ":" + awk::RS = "\n" + pwcat = Awklib "pwcat" + while ((pwcat | getline) > 0) { + Byname[$1] = $0 + Byuid[$3] = $0 + Bycount[++Total] = $0 + } + close(pwcat) + Count = 0 + Inited = 1 + awk::FS = oldfs + if (using_fw) { + awk::FIELDWIDTHS = awk::FIELDWIDTHS + } else if (using_fpat) { + awk::FPAT = awk::FPAT + } + awk::RS = oldrs + $0 = olddol0 +} diff --git a/test/profile0.ok b/test/profile0.ok index 2e3c5728..42c464ba 100644 --- a/test/profile0.ok +++ b/test/profile0.ok @@ -1,6 +1,6 @@ # Rule(s) 2 NR == 1 { # 1 - 1 print $0 + 1 print } diff --git a/test/profile10.ok b/test/profile10.ok index 13f0b67b..0f77bd38 100644 --- a/test/profile10.ok +++ b/test/profile10.ok @@ -17,14 +17,12 @@ BEGIN { # Comment 0 print "MNO" # Comment 16 } # Comment 17 switch (q) { - case "a": - # Comment 18 + # Comment 18 + case "a": # Comment 19 case "b": - # Comment 19 - break # Comment 20 - # Comment 21 - default: - # Comment 22 + # Comment 20 + break # Comment 21 + default: # Comment 22 break # Comment 23 } # Comment 24 diff --git a/test/profile11.awk b/test/profile11.awk new file mode 100644 index 00000000..06ede8ac --- /dev/null +++ b/test/profile11.awk @@ -0,0 +1,321 @@ + +# comments/for.awk +BEGIN { + for (i = 1; i <= 10; i++) print i + + for (i = 1; i <= 10; i++) # comment 0 + print i + + for (i = 1; # comment 1a + i <= 10; i++) print i + + for (i = 1; i <= 10; # comment 2a + i++) print i + + for (i = 1; # comment 1b + i <= 10; # comment 2b + i++) print i + + for (i = 1; # comment 1c + i <= 10; # comment 2c + i++) # comment 3c + print i +} + +# comments/for0.awk +BEGIN { + for (iggy in foo) # comment 5 + # comment 6 + ; +} + +# comments/for1.awk +BEGIN { + for (iggy in foo) # comment 1 + # comment 2 + { + print iggy + } + + for (iggy in foo) # comment 3 + # comment 4 + print iggy + + for (iggy in foo) # comment 5 + # comment 6 + ; +} + +# comments/for2.awk +BEGIN { + for (;;) print i + + for (;;) # comment 0 + print i + + for (; # comment 1a + ;) print i + + for (; ; # comment 2a + ) print i + + for (; # comment 1b + ; # comment 2b + ) print i + + for (; # comment 1c + ; # comment 2c + ) # comment 3c + print i +} + +# comments/for_del.awk +BEGIN { for (iggy in foo) delete foo[iggy] } + +# comments/do.awk +BEGIN { + do # DO comment + { # LBRACE comment + # block comment + print 42 + } # rbrace comment + while (0) # WHILE comment +} + +# comments/do2.awk +BEGIN { + do # DO comment + { # LBRACE comment + # block comment + print 42 + } # rbrace comment + while (0) +} + +# comments2/do.awk +BEGIN { + do # do comment + { # lbrace comment + # block comment + print 42 + } # rbace EOL comment + # rbrace block comment + while (1) # while comment +} + +# comments2/if.awk +BEGIN { + if (a) # IF comment + print "foo" # print comment + + if (a) # IF comment 2 + { # lbrace comment + print "bar" + } + else # ELSE comment + print "baz" +} + +# comments/if0.awk +BEGIN { + if (a) + ; # nothing + else + print "b" +} + +# comments/switch.awk +BEGIN { + a = 5 + switch (a) # switch EOL comment + # switch block comment + { # lbrace EOL comment + # lbrace block comment + case 5: # comment after case + print "five!" + break + # block comment after case + default: # comment after default + print "default" # print comment + break + } # rbrace EOL comment + # rbrace block comment +} + +# comments2/switch.awk +BEGIN { + a = 5 + switch (a) # switch EOL comment + # switch block comment + { # lbrace EOL comment + # lbrace block comment + case 5: + print "five!" + break; + # block comment after case + } # rbrace EOL comment + # rbrace block comment +} + +# comments2/switch0.awk +BEGIN { + a = 5 + switch (a) + { + case 5: # case comment + print "five!" + break + default: # default comment + print "default" + break + } +} + +# comments2/switch1.awk +BEGIN { + a = 5 + switch (a) + { + case 5: + # case comment + print "five!" + break + default: # default comment + print "default" + break + } +} + +# comments2/while.awk +BEGIN { + while (1) # while comment + { # lbrace comment + # block comment + print 42 + } +} + +# comments2/while2.awk +BEGIN { + while (1) # while comment + { # lbrace comment + # block comment + } +} + +# comments2/f.awk +function bar(p1, + p2) +{ + print "foo" +} # rbrace eol bar + # rbrace block bar + +# comments2/function.awk +function baz(p1, # comment + p2) + # comment before braces +{ # lbrace eol + # lbrace block + print "foo" +} # rbrace eol baz + # rbrace block baz + +# comments/function.awk +function funny(param1, # param comment 1 + param2, param3, # param comment 2 + param4) + # Comment between header and body +{ # lbrace EOL comment + # lbrace block comment + print "funny" +} # rbrace EOL comment funny + # rbrace block comment funny + +# comments/function2.awk +function funnyhaha(param1, + param2, param3, + param4) +{ # lbrace EOL comment + # lbrace block comment + print "funny" +} # rbrace EOL comment funnyhaha + # rbrace block comment funnyhaha + +# comments/callcoma.awk +function callme(a, b, c) +{ + printf("a = %s, b = %s, c = %s\n", # format comment + a, # a2 comment + b, # b2 comment + c) +} + +BEGIN { + callme(1, # 1 comment + 2, # 2 comment + 3) +} + +# comments/exp.awk +/foo/, # range comment + # range comment 2 + +# range comment b + +# range comment c +/bar/ { print } + +# comments/load.awk +@load "filefuncs" # get file functions + +BEGIN { + stat("/etc/passwd", data) + for (i in data) + print i, data[i] +} + +# comments/andor.awk +BEGIN { + if (a && # and comment + b || # or comment + c) + print "foo" +} + +# comments/qmcol-qm.awk +BEGIN { + a = 1 ? # qm comment + 2 : + 3 + print a +} + +# comments/qmcol-colon.awk +BEGIN { + a = 1 ? + 2 : # colon comment + 3 + print a +} + +# comments/qmcolboth.awk +BEGIN { + a = 1 ? # qm comment + 2 : # colon comment + 3 + print a +} + +# test beginning of line block comments (com2.awk) +BEGIN { + print "hi" # comment 1 +# comment 2 + print "there" + + if (foo) { + print "hello" # comment 3 +# comment 4 + print "world" + } +} diff --git a/test/profile11.ok b/test/profile11.ok new file mode 100644 index 00000000..77f4dd7f --- /dev/null +++ b/test/profile11.ok @@ -0,0 +1,371 @@ +@load "filefuncs" # get file functions + +# comments/for.awk +BEGIN { + for (i = 1; i <= 10; i++) { + print i + } + for (i = 1; i <= 10; i++) { # comment 0 + print i + } + for (i = 1; # comment 1a + i <= 10; i++) { + print i + } + for (i = 1; i <= 10; # comment 2a + i++) { + print i + } + for (i = 1; # comment 1b + i <= 10; # comment 2b + i++) { + print i + } + for (i = 1; # comment 1c + i <= 10; # comment 2c + i++) { # comment 3c + print i + } +} + +# comments/for0.awk +BEGIN { + for (iggy in foo) { + # comment 5 + + # comment 6 + } +} + +# comments/for1.awk +BEGIN { + for (iggy in foo) { + # comment 1 + + # comment 2 + print iggy + } + for (iggy in foo) { + # comment 3 + + # comment 4 + print iggy + } + for (iggy in foo) { + # comment 5 + + # comment 6 + } +} + +# comments/for2.awk +BEGIN { + for (;;) { + print i + } + for (;;) { # comment 0 + print i + } + for (; # comment 1a + ; ) { + print i + } + for (; ; # comment 2a + ) { + print i + } + for (; # comment 1b + ; # comment 2b + ) { + print i + } + for (; # comment 1c + ; # comment 2c + ) { # comment 3c + print i + } +} + +# comments/for_del.awk +BEGIN { + for (iggy in foo) { + delete foo[iggy] + } +} + +# comments/do.awk +BEGIN { + do { # DO comment + # LBRACE comment + # block comment + print 42 + } while (0) # WHILE comment + # rbrace comment +} + +# comments/do2.awk +BEGIN { + do { # DO comment + # LBRACE comment + # block comment + print 42 + } while (0) # rbrace comment +} + +# comments2/do.awk +BEGIN { + do { # do comment + # lbrace comment + # block comment + print 42 + } while (1) # while comment + # rbace EOL comment + # rbrace block comment +} + +# comments2/if.awk +BEGIN { + if (a) { + # IF comment + print "foo" # print comment + } + if (a) { # lbrace comment + # IF comment 2 + print "bar" + } else { + # ELSE comment + print "baz" + } +} + +# comments/if0.awk +BEGIN { + if (a) { + # nothing + } else { + print "b" + } +} + +# comments/switch.awk +BEGIN { + a = 5 + switch (a) { + # switch EOL comment + + # switch block comment + + # lbrace EOL comment + + # lbrace block comment + case 5: # comment after case + print "five!" + break + # block comment after case + default: # comment after default + print "default" # print comment + break + } + # rbrace EOL comment + # rbrace block comment +} + +# comments2/switch.awk +BEGIN { + a = 5 + switch (a) { + # switch EOL comment + + # switch block comment + + # lbrace EOL comment + + # lbrace block comment + case 5: + print "five!" + break + # block comment after case + } + # rbrace EOL comment + # rbrace block comment +} + +# comments2/switch0.awk +BEGIN { + a = 5 + switch (a) { + case 5: # case comment + print "five!" + break + default: # default comment + print "default" + break + } +} + +# comments2/switch1.awk +BEGIN { + a = 5 + switch (a) { + case 5: + # case comment + print "five!" + break + default: # default comment + print "default" + break + } +} + +# comments2/while.awk +BEGIN { + while (1) { + # while comment + # lbrace comment + # block comment + print 42 + } +} + +# comments2/while2.awk +BEGIN { + while (1) { + # while comment + # lbrace comment + # block comment + } +} + +BEGIN { + callme(1, # 1 comment + 2, # 2 comment + 3) +} + +# comments/load.awk +BEGIN { + stat("/etc/passwd", data) + for (i in data) { + print i, data[i] + } +} + +# comments/andor.awk +BEGIN { + if (a && # and comment + b || # or comment + c) { + print "foo" + } +} + +# comments/qmcol-qm.awk +BEGIN { + a = 1 ? # qm comment + 2 : 3 + print a +} + +# comments/qmcol-colon.awk +BEGIN { + a = 1 ? 2 : # colon comment + 3 + print a +} + +# comments/qmcolboth.awk +BEGIN { + a = 1 ? # qm comment + 2 : # colon comment + 3 + print a +} + +# test beginning of line block comments (com2.awk) +BEGIN { + print "hi" # comment 1 + # comment 2 + print "there" + if (foo) { + print "hello" # comment 3 + # comment 4 + print "world" + } +} + +# comments/exp.awk +# range comment +# range comment 2 + +# range comment b + +# range comment c +/foo/, /bar/ { + print +} + + +# comments2/f.awk +function bar(p1, p2) +{ + print "foo" +} + +# rbrace eol bar + +# rbrace block bar + +# comments2/function.awk + +# comment + +# comment before braces +function baz(p1, p2) +{ + # lbrace eol + # lbrace block + print "foo" +} + +# rbrace EOL comment funnyhaha + +# rbrace block comment funnyhaha + +# comments/callcoma.awk +function callme(a, b, c) +{ + printf "a = %s, b = %s, c = %s\n", # format comment + a, # a2 comment + b, # b2 comment + c +} + +# rbrace eol baz + +# rbrace block baz + +# comments/function.awk + +# param comment 1 + +# param comment 2 + +# Comment between header and body +function funny(param1, param2, param3, param4) +{ + # lbrace EOL comment + # lbrace block comment + print "funny" +} + +# rbrace EOL comment funny + +# rbrace block comment funny + +# comments/function2.awk +function funnyhaha(param1, param2, param3, param4) +{ + # lbrace EOL comment + # lbrace block comment + print "funny" +} diff --git a/test/profile5.ok b/test/profile5.ok index c8abf1fb..e15e96a2 100644 --- a/test/profile5.ok +++ b/test/profile5.ok @@ -3,7 +3,7 @@ BEGIN { } #___________________________________________________________________________________ -BEGIN { +BEGIN { ############################################################################ BINMODE = "rw" SUBSEP = "\000" _NULARR[""] @@ -24,7 +24,7 @@ BEGIN { } #___________________________________________________________________________________ -BEGIN { +BEGIN { ############################################################################# _delay_perfmsdelay = 11500 } @@ -36,12 +36,13 @@ BEGIN { BEGIN { } -BEGIN { ########################################################################### +########################################################################### +BEGIN { _addlib("_EXTFN") } #___________________________________________________________________________________ -BEGIN { +BEGIN { ############################################################################# delete _XCHR delete _ASC delete _CHR @@ -101,7 +102,7 @@ BEGIN { } #___________________________________________________________________________________ -BEGIN { +BEGIN { ############################################################################# _SYS_STDCON = "CON" _CON_WIDTH = match(_cmd("MODE " _SYS_STDCON " 2>NUL"), /Columns:[ \t]*([0-9]+)/, A) ? strtonum(A[1]) : 80 } @@ -111,7 +112,7 @@ BEGIN { } #___________________________________________________________________________________ -BEGIN { +BEGIN { ############################################################################# if (_SYS_STDOUT == "") { _SYS_STDOUT = "/dev/stdout" } @@ -133,7 +134,7 @@ BEGIN { } #___________________________________________________________________________________ -BEGIN { +BEGIN { ############################################################################# _tInBy = "\212._tInBy" _tgenuid_init() _UIDS[""] @@ -165,7 +166,7 @@ BEGIN { } #___________________________________________________________________________________ -BEGIN { +BEGIN { ############################################################################# if (_gawk_scriptlevel < 1) { _ERRLOG_TF = 1 _ERRLOG_VF = 1 @@ -186,7 +187,8 @@ BEGIN { _shortcut_init() } -BEGIN { ######################################################### +######################################################### +BEGIN { _addlib("_eXTFN") } @@ -195,7 +197,8 @@ BEGIN { _extfn_init() } -BEGIN { ############################################################ +############################################################ +BEGIN { _addlib("_sHARE") } @@ -282,7 +285,7 @@ BEGIN { #BootDevice BuildNumber BuildType Caption CodeSet CountryCode CreationClassName CSCreationClassName CSDVersion CSName CurrentTimeZone DataExecutionPrevention_32BitApplications DataExecutionPrevention_Available DataExecutionPrevention_Drivers DataExecutionPrevention_SupportPolicy Debug Description Distributed EncryptionLevel ForegroundApplicationBoost FreePhysicalMemory FreeSpaceInPagingFiles FreeVirtualMemory InstallDate LargeSystemCache LastBootUpTime LocalDateTime Locale Manufacturer MaxNumberOfProcesses MaxProcessMemorySize MUILanguages Name NumberOfLicensedUsers NumberOfProcesses NumberOfUsers OperatingSystemSKU Organization OSArchitecture OSLanguage OSProductSuite OSType OtherTypeDescription PAEEnabled PlusProductID PlusVersionNumber Primary ProductType RegisteredUser SerialNumber ServicePackMajorVersion ServicePackMinorVersion SizeStoredInPagingFiles Status SuiteMask SystemDevice SystemDirectory SystemDrive TotalSwapSpaceSize TotalVirtualMemorySize TotalVisibleMemorySize Version WindowsDirectory #\Device\HarddiskVolume1 7601 Multiprocessor Free Microsoft Windows Server 2008 R2 Enterprise 1252 1 Win32_OperatingSystem Win32_ComputerSystem Service Pack 1 CPU 180 TRUE TRUE TRUE 3 FALSE FALSE 256 0 6925316 33518716 41134632 20110502192745.000000+180 20130426120425.497469+180 20130510134606.932000+180 0409 Microsoft Corporation -1 8589934464 {"en-US"} Microsoft Windows Server 2008 R2 Enterprise |C:\Windows|\Device\Harddisk0\Partition2 0 116 2 10 64-bit 1033 274 18 TRUE 3 Windows User 55041-507-2389175-84833 1 0 33554432 OK 274 \Device\HarddiskVolume2 C:\Windows\system32 C: 50311020 16758448 6.1.7601 C:\Windows -BEGIN { +BEGIN { ############################################################################ a = ENVIRON["EGAWK_CMDLINE"] gsub(/^[ \t]*/, "", a) a = _lib_CMDLN(a) @@ -302,13 +305,13 @@ BEGIN { } #_____________________________________________________________________________ -END { +END { ######################################################################## _EXIT() } #_______________________________________________________________________ ######################################################################## -END { +END { ############################################################################### if (_gawk_scriptlevel < 1) { close(_errlog_file) p = _Zimport(_rdfile(_errlog_file), _N()) @@ -329,7 +332,7 @@ END { #_____________________________________________________________________________ # _rQBRO(ptr) - Returns brothers total quantity. [TESTED] # If !ptr then returns "". -END { +END { ############################################################################### if (_gawk_scriptlevel < 1) { if (! _fileio_notdeltmpflag) { _FILEIO_TMPATHS[_FILEIO_TMPRD] @@ -629,7 +632,7 @@ END { # var _gawk_scriptlevel #___________________________________________________________________________________ #################################################################################### -END { +END { ############################################################################### if (_constatstrln > 0) { _constat() } @@ -757,8 +760,8 @@ function _DS(c, t, P, a, A) { ###################################################### switch (c) { + #___________________________________________________________ case "_lib_CMDLN": - #___________________________________________________________ return t #_____________________________________________________ case "_lib_APPLY": @@ -922,14 +925,15 @@ function _FILEIO(c, t, P, A) } ############################################################ + +#_____________________________________________________________________________ function _FILEVER(c, t, P, a, A) { - #_____________________________________________________________________________ + ################################################# switch (c) { + #___________________________________________________________ case "_lib_CMDLN": - ################################################# return t - #___________________________________________________________ #_____________________________________________________ case "_lib_APPLY": return @@ -1494,11 +1498,13 @@ function _addlist(A, v) } ############################################ + +#_______________________________________________________________________ function _bearray(A) { - #_______________________________________________________________________ + #################################################### if (isarray(A) || (A == 0 && A == "")) { - return 1 #################################################### + return 1 } } @@ -2534,10 +2540,12 @@ function _ffaccr(A, t, p, P) } ################## + +#_______________________________________________________________________ function _fframe(A, t, p) { - #_______________________________________________________________________ - return _fframe_i0(A, t, p, A[""]) ################################################# + ################################################# + return _fframe_i0(A, t, p, A[""]) } #___________________________________________________________ @@ -2874,14 +2882,15 @@ function _formatstrd_init() } #__________________________________________________________________________________ + +#################################################################################### + + + + +#___________________________________________________________________________________ function _formatstrs(t) { - #################################################################################### - - - - - #___________________________________________________________________________________ _formatstrq0 = split(t, _FORMATSTRA, /['\x00-\x1F\x80-\xFF]/, _FORMATSTRB) _formatstrs0 = "" for (t = 1; t < _formatstrq0; t++) { @@ -3026,8 +3035,8 @@ function _getchrln(s, w) ################################################# if (s == "") { return + #if ( w!=w+0 || w<0 ) w=_CON_WIDTH } - #if ( w!=w+0 || w<0 ) w=_CON_WIDTH if (length(s) < w) { if (s in _GETCHRLN) { if (length(_getchrlnt0 = _GETCHRLN[s]) >= w) { @@ -3453,9 +3462,10 @@ function _insframe(A, f) } ######################## + +#_________________________________________________________________ function _inspass(A, f) { - #_________________________________________________________________ A[f] = A[""] A[""] = f } @@ -3782,9 +3792,10 @@ function _newdir(f) } ############################## + +#_______________________________________________________________________ function _nop(p0, p1, p2, p3) { - #_______________________________________________________________________ } #_____________________________________________________ @@ -4202,14 +4213,15 @@ function _qstrq(t) } ################################################################ + +#_____________________________________________________________________________ function _rEG(c, t, P, a, A) { - #_____________________________________________________________________________ + ##################################################### switch (c) { + #___________________________________________________________ case "_lib_CMDLN": - ##################################################### return t - #___________________________________________________________ #_____________________________________________________ case "_lib_APPLY": return @@ -4255,10 +4267,12 @@ function _rFCHLD(p) } ######################## p="", !v + +#_______________________________________________________________________ function _rLBRO(p) { - #_______________________________________________________________________ - if (p) { ###################################################### + ###################################################### + if (p) { if (p in _tPARENT) { return _tLCHLD[_tPARENT[p]] } @@ -4271,10 +4285,12 @@ function _rLBRO(p) } ######################## p="" + +#_______________________________________________________________________ function _rLCHLD(p) { - #_______________________________________________________________________ - if ((p) && (p in _tLCHLD)) { ##################################################### + ##################################################### + if ((p) && (p in _tLCHLD)) { return _tLCHLD[p] } return "" @@ -4288,40 +4304,48 @@ function _rLINK(p) } ######################## p="" + +#_______________________________________________________________________ function _rNEXT(p) { - #_______________________________________________________________________ - if ((p) && (p in _tNEXT)) { ###################################################### + ###################################################### + if ((p) && (p in _tNEXT)) { return _tNEXT[p] } return "" } ######################## p="" + +#_______________________________________________________________________ function _rPARENT(p) { - #_______________________________________________________________________ - if ((p) && (p in _tPARENT)) { #################################################### + #################################################### + if ((p) && (p in _tPARENT)) { return _tPARENT[p] } return "" } ######################## p="" + +#_______________________________________________________________________ function _rPREV(p) { - #_______________________________________________________________________ - if ((p) && (p in _tPREV)) { ###################################################### + ###################################################### + if ((p) && (p in _tPREV)) { return _tPREV[p] } return "" } ######################## p="" + +#_______________________________________________________________________ function _rQBRO(p, c, p1) { - #_______________________________________________________________________ - if (p) { ################################################ + ################################################ + if (p) { if (p in _tPARENT) { return _tQCHLD[_tPARENT[p]] } @@ -4341,10 +4365,12 @@ function _rQBRO(p, c, p1) } ######################## p="" + +#_______________________________________________________________________ function _rQCHLD(p) { - #_______________________________________________________________________ - if ((p) && (p in _tQCHLD)) { ##################################################### + ##################################################### + if ((p) && (p in _tQCHLD)) { return _tQCHLD[p] } return "" @@ -4909,14 +4935,15 @@ function _rxpfn(R, t, p, i, f, A) } ############################################################## + +#_____________________________________________________________________________ function _sHARE(c, t, P, a, A) { - #_____________________________________________________________________________ + ################################################### switch (c) { + #___________________________________________________________ case "_lib_CMDLN": - ################################################### return t - #___________________________________________________________ #_____________________________________________________ case "_lib_APPLY": return @@ -4936,14 +4963,15 @@ function _sHARE(c, t, P, a, A) } ################################################################ + +#_____________________________________________________________________________ function _sYS(c, t, P, a, A) { - #_____________________________________________________________________________ + ##################################################### switch (c) { + #___________________________________________________________ case "_lib_CMDLN": - ##################################################### return t - #___________________________________________________________ #_____________________________________________________ case "_lib_APPLY": return @@ -5004,9 +5032,9 @@ function _setmpath(p, a) if ((p) && (a = _filerd(p))) { if (_FILEIO_TMPRD) { _FILEIO_TMPATHS[_FILEIO_TMPRD] + #if ( _filexist(a) ) _del(a) + #_cmd("rd " a " /S /Q 2>NUL"); _cmd("del " a " /Q 2>NUL") } - #if ( _filexist(a) ) _del(a) - #_cmd("rd " a " /S /Q 2>NUL"); _cmd("del " a " /Q 2>NUL") return (_FILEIO_TMPRD = a) } else { return _warning("`" p "': cannot set temporary folder" (ERRNO ? (": " ERRNO) : "")) @@ -5051,27 +5079,26 @@ function _shortcut(D, S) if (isarray(D)) { if (isarray(S)) { _addarrmask(D, S, _SHORTCUTWSTRUC) - } else if (S == 0 && S == "") { # array,array2* - copy from array2 to array shorcut-specific elements - _addarrmask(D, _SHORTCUTDEFAULT, _SHORTCUTWSTRUC) - } else if (_isnotfileptr(S)) { # array* - define shortcut-specific elements in array by default values - _addarrmask(D, _[S], _SHORTCUTWSTRUC) + } else if (S == 0 && S == "") { + _addarrmask(D, _SHORTCUTDEFAULT, _SHORTCUTWSTRUC) # array,array2* - copy from array2 to array shorcut-specific elements + } else if (_isnotfileptr(S)) { + _addarrmask(D, _[S], _SHORTCUTWSTRUC) # array* - define shortcut-specific elements in array by default values } else if (_rd_shortcut(D, S)) { - return # array,ptr* - copy from array _[ptr] to array shorcut-specific elements - } + return + } # array,ptr* - copy from array _[ptr] to array shorcut-specific elements } else if (D == 0 && D == "") { - return _NOP # array,filepath* - define in array shortcut-specific elements by reading its from shortcut file filepath(load shortcut) - # -* - no action(return -) + return _NOP # -* - no action(return -) } else if (_isnotfileptr(D)) { if (isarray(S)) { - _addarrmask(_[D], S, _SHORTCUTWSTRUC) - } else if (S == 0 && S == "") { # ptr,array* - copy from array to array _[ptr] shorcut-specific elements - _addarrmask(_[D], _SHORTCUTDEFAULT, _SHORTCUTWSTRUC) - } else if (_isnotfileptr(S)) { # ptr* - define shortcut-specifc elements in array _[ptr] by default values - _addarrmask(_[D], _[S], _SHORTCUTWSTRUC) + _addarrmask(_[D], S, _SHORTCUTWSTRUC) # array,filepath* - define in array shortcut-specific elements by reading its from shortcut file filepath(load shortcut) + } else if (S == 0 && S == "") { + _addarrmask(_[D], _SHORTCUTDEFAULT, _SHORTCUTWSTRUC) # ptr,array* - copy from array to array _[ptr] shorcut-specific elements + } else if (_isnotfileptr(S)) { + _addarrmask(_[D], _[S], _SHORTCUTWSTRUC) # ptr* - define shortcut-specifc elements in array _[ptr] by default values } else if (_rd_shortcut(_[D], S)) { - return # ptr,ptr2* - copy from array _[ptr2] to array _[ptr] shorcut-specific elements - } - } else { # ptr,filepath* - define in array _[ptr] shortcut-specific elements by reading its from shortcut file filepath(load shortcut) + return + } # ptr,ptr2* - copy from array _[ptr2] to array _[ptr] shorcut-specific elements + } else { if (isarray(S) && _wr_shortcut(D, S)) { return # filepath,array* - [over]write shorcut file filepath; shortcut parameters will be defined by shortcut-specific elements in array(save shortcut) } else if (S == 0 && S == "" && _wr_shortcut(D, _SHORTCUTDEFAULT)) { @@ -5080,7 +5107,8 @@ function _shortcut(D, S) return # filepath,ptr* - [over]write shorcut file filepath; shortcut parameters will be defined by shortcut-specific elements in array _[ptr](save shortcut) } else if (_rd_shortcut(_SHRTCUTA1, S) || _wr_shortcut(D, _SHRTCUTA1)) { return - } } # filepath,filepath2* - [over]write shorcut file filepath; shortcut parameters will be defined from shortcut file filepath2(copy shortcut) + } # ptr,filepath* - define in array _[ptr] shortcut-specific elements by reading its from shortcut file filepath(load shortcut) + } # filepath,filepath2* - [over]write shorcut file filepath; shortcut parameters will be defined from shortcut file filepath2(copy shortcut) return 1 } @@ -5433,8 +5461,8 @@ function _sysinfo(D, h) function _tOBJ(c, t, P) { switch (c) { + #___________________________________________________________ case "_lib_CMDLN": - #___________________________________________________________ return t #___________________________________________________________ case "_lib_APPLY": @@ -6291,30 +6319,34 @@ function _th0(p, p1, p2, p3) } ########################################## + +#_________________________________________________________________ function _th1(p0, p, p2, p3) { - #_________________________________________________________________ return p } ############################## + +#_________________________________________________________________ function _th10(p0, p1) { - #_________________________________________________________________ return (p1 p0) } ############################## + +#_________________________________________________________________ function _th2(p0, p1, r, p3) { - #_________________________________________________________________ return p } ############################## + +#_________________________________________________________________ function _th3(p0, p1, p2, r) { - #_________________________________________________________________ return p } @@ -7234,10 +7266,10 @@ function _wFBRO(p, v, a) } ######################## p=ptr, v=0 return v } - } else { ######################## p=ptr, v="" + } else { if (p == 0) { return v ######################## p=0 - } + } ######################## p=ptr, v="" if (v) { return _texclude(v) ######################## p="", v=ptr - exclude v } @@ -7325,10 +7357,10 @@ function _wFCHLD(p, v, a) } return v } - } else { ######################## p=ptr, v="" > ignore action + } else { if (p == 0) { return v ######################## p=0 - } + } ######################## p=ptr, v="" > ignore action return v } } @@ -7436,10 +7468,10 @@ function _wLBRO(p, v, a) } ######################## p=ptr, v=0 return v } - } else { ######################## p=ptr, v="" + } else { if (p == 0) { return v ######################## p=0 - } + } ######################## p=ptr, v="" if (v) { return _texclude(v) ######################## p="", v=ptr - exclude v } @@ -7527,10 +7559,10 @@ function _wLCHLD(p, v, a) } return v } - } else { ######################## p=ptr, v="" > ignore action + } else { if (p == 0) { return v ######################## p=0 - } + } ######################## p=ptr, v="" > ignore action return v } } @@ -7606,10 +7638,10 @@ function _wNEXT(p, v, a, b) } ######################## p=ptr, v=0 return v } - } else { ######################## p=ptr, v="" + } else { if (p == 0) { return v ######################## p=0 - } + } ######################## p=ptr, v="" if (v) { return _texclude(v) ######################## p="", v=ptr - exclude v } @@ -7688,10 +7720,10 @@ function _wPREV(p, v, a, b) } ######################## p=ptr, v=0 return v } - } else { ######################## p=ptr, v="" + } else { if (p == 0) { return v ######################## p=0 - } + } ######################## p=ptr, v="" if (v) { return _texclude(v) ######################## p="", v=ptr - exclude v } @@ -7712,10 +7744,10 @@ function _wQCHLD(p, v) ############################################# if (p) { if (v) { - } else { ######################## p=ptr, v=ptr + } else { if (v == 0) { if (p in _tFCHLD) { ######################## p=ptr, v=0 > delete all chld - v = _tFCHLD[p] + v = _tFCHLD[p] ######################## p=ptr, v=ptr delete _tFCHLD[p] delete _tLCHLD[p] delete _tQCHLD[p] @@ -7726,9 +7758,9 @@ function _wQCHLD(p, v) } return v } - } else { ######################## p=ptr, v="" > ignore action + } else { if (p == 0) { - return v + return v ######################## p=ptr, v="" > ignore action } ######################## p=0 return v } diff --git a/test/sourcesplit.ok b/test/sourcesplit.ok index 7ed6ff82..c883f51c 100644 --- a/test/sourcesplit.ok +++ b/test/sourcesplit.ok @@ -1 +1,3 @@ -5 +gawk: cmd. line:1: BEGIN { a = 5; +gawk: cmd. line:1: ^ unexpected newline or end of string +EXIT CODE: 1 diff --git a/test/symtab6.ok b/test/symtab6.ok index 7de717a0..23a1633d 100644 --- a/test/symtab6.ok +++ b/test/symtab6.ok @@ -1,28 +1,2 @@ -ARGC: 1 -ARGIND: 0 -ARGV: array, 1 elements -BINMODE: 0 -CONVFMT: "%.6g" -ERRNO: "" -FIELDWIDTHS: "" -FILENAME: "" -FNR: 0 -FPAT: "[^[:space:]]+" -FS: " " -FUNCTAB: array, 41 elements -IGNORECASE: 0 -LINT: 0 -NF: 0 -NR: 0 -OFMT: "%.6g" -OFS: " " -ORS: "\n" -PREC: 53 -RLENGTH: 0 -ROUNDMODE: "N" -RS: "\n" -RSTART: 0 -RT: "" -SUBSEP: "\034" -SYMTAB: array, 29 elements -TEXTDOMAIN: "messages" +gawk: ./symtab6.awk:1: fatal: cannot assign to arbitrary elements of SYMTAB +EXIT CODE: 2 diff --git a/test/symtab7.ok b/test/symtab7.ok index 28328831..37de1a49 100644 --- a/test/symtab7.ok +++ b/test/symtab7.ok @@ -1,2 +1,2 @@ -30 -40 +gawk: symtab7.awk:4: (FILENAME=- FNR=1) fatal: cannot assign to arbitrary elements of SYMTAB +EXIT CODE: 2 diff --git a/test/testext.ok b/test/testext.ok index 897a7336..fbc3c263 100644 --- a/test/testext.ok +++ b/test/testext.ok @@ -86,6 +86,9 @@ message_string = hello, world new_array["hello"] = "world" new_array["answer"] = "42" +test::testval = in namespace test +test::test_function() called. + at_exit2 called (should be first): data = NULL, exit_status = 0 at_exit1 called (should be second): (data is & data_for_1), data value = 0xdeadbeef, exit_status = 0 at_exit0 called (should be third): data = NULL, exit_status = 0 diff --git a/test/unterm.ok b/test/unterm.ok index 760d3703..399f626a 100644 --- a/test/unterm.ok +++ b/test/unterm.ok @@ -1,5 +1,5 @@ gawk: unterm.awk:1: BEGIN{x=".........................................................................................................................................................................................................................................................} gawk: unterm.awk:1: ^ unterminated string -gawk: unterm.awk:1: BEGIN{x=".........................................................................................................................................................................................................................................................} -gawk: unterm.awk:1: ^ syntax error +gawk: unterm.awk:1: (END OF FILE) +gawk: unterm.awk:1: ^ source files / command-line arguments must contain complete functions or rules EXIT CODE: 1 |