diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-16 13:22:00 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-16 13:22:00 +0300 |
commit | 6cc7d587a710606d3fe52222707739c7cc1b8651 (patch) | |
tree | 2b6360852d8f966bd83eeb6efd8af90f8e9b83f9 /test | |
parent | e888f1834b88270590b7e04d64c03c75863e4565 (diff) | |
download | gawk-6cc7d587a710606d3fe52222707739c7cc1b8651.tar.gz |
Move to gawk-3.1.3.gawk-3.1.3
Diffstat (limited to 'test')
74 files changed, 2192 insertions, 88 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 3da3d663..88bcbb79 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,97 @@ +Mon Jul 7 11:01:43 2003 Arnold D. Robbins <arnold@skeeve.com> + + * Release 3.1.3: Release tar file made. + +Fri Jul 4 11:12:07 2003 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (poundbang2): Removed. + (poundbang): Added env var settings. + +Thu Jun 26 15:44:33 2003 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (match2, whiny): new test. + * match2.awk, match2.ok: new files. + * whiny.awk, whiny.ok: new files. + +Thu Jun 26 14:51:40 2003 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am: Use double quotes for sed invocation to make + life easier (eventually) for DOS version of Makefile. + * pipeio2.awk, pipio2.ok: Ditto. + +Wed Jun 18 12:32:14 2003 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (AWK): Use LC_ALL=$${GAWKLOCALE:-C} and + same for LANG when running awk. Provides sane locale for + tests with ability to override it if need be. + (all tests): Removed explicit setting of LC_ALL and LANG. + * Gentests: Ditto. + +Wed May 28 08:02:33 CEST 2003 Stepan Kasal <kasal@math.cas.cz> + + * Makefile.am (uninit4): new test. + * uninit4.awk, uninit4.ok: new files. + +Wed May 28 06:30:23 2003 Stepan Kasal <kasal@math.cas.cz> + + * Makefile.am (aryprm4 aryprm5 aryprm6 aryprm7 aryprm8 scalar uninit3): + new tests. + * aryprm4.awk aryprm4.ok aryprm5.awk aryprm5.ok aryprm6.awk aryprm6.ok: + aryprm7.awk aryprm7.ok aryprm8.awk aryprm8.ok scalar.awk scalar.ok: + uninit3.awk uninit3.ok: new files. + +Tue May 27 14:27:50 2003 Stepan Kasal <kasal@math.cas.cz> + + * Makefile.am (aryprm1, aryprm2, aryprm3, sortempty): New tests. + * aryprm1.awk, aryprm1.ok, aryprm2.awk, aryprm2.ok: New files. + * aryprm3.awk, aryprm3.ok, sortempty.awk, sortempty.ok: dtto + * prmarscl.ok: The actual error message has changed. + +Tue May 27 08:23:51 2003 Stepan Kasal <kasal@math.cas.cz> + + * arrayref3.ok, arrayref4.ok, fnaryscl.ok: Error messages reformatted. + +Sun Jun 8 17:18:06 2003 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (fmttest, strtonum, nested, gsubtst5, delarpm2): New tests. + * fmttest.awk, fmttest.ok: New files. From Nelson Beebe, + <beebe@math.utah.edu>. + * strtonum.awk, strtonum.ok: New files. + * nested.awk, nested.in, nested.ok: New files. + * gsubtst5.awk, gsubtst5.in, gsubtst5.ok: New files. + * delarpm2.awk, delarpm2.ok: New files. (Also from Nelson Beebe.) + + * switch2.awk: Currently unused test for switch code. + +Wed May 14 16:49:53 2003 Arnold D. Robbins <arnold@skeeve.com> + + * Gentests: Add LC_ALL=C LANG=C to generated tests. + * Makefile.am: All other manual tests: ditto. + +Sun May 11 15:27:55 2003 Stepan Kasal <kasal@math.cas.cz> + + * Makefile.am (rsnulbig, rsnulbig2): New tests. + * rsnulbig.ok, rsnulbig2.ok: New files. + +Sun May 11 15:00:20 2003 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (arrayprm2, arrayprm3, arryref2, arryref3, arryref4, + arryref5, rstest3, rstest4, rstest5): New tests. + * arrayprm2.awk, arrayprm2.ok, arrayprm3.awk, arrayprm3.ok, arryref2.ok, + arryref3.ok, arryref4.ok, arryref5.ok, rstest3.awk, rstest3.ok, rstest4.awk, + rstest4.ok, rstest5.awk, rstest5.ok: New files. + +Sun May 11 12:20:59 2003 Arnold D. Robbins <arnold@skeeve.com> + + * strftime.awk: Remove seconds from input and strftime output, + to decrease chance of failing on second boundary. + * Makefile.am (strftime): Tweak message appropriately. + +Tue Mar 25 08:35:42 2003 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (fnarray2): New test. + * fnarray2.awk, fnarray2.ok: New files. + Wed Mar 19 14:10:31 2003 Arnold D. Robbins <arnold@skeeve.com> This time for sure. @@ -18,7 +112,7 @@ Tue Mar 4 10:32:23 2003 Arnold D. Robbins <arnold@skeeve.com> 2003-02-17 Jim Meyering <jim@meyering.net> * Makefile.am (check): Don't depend on the pass-fail rule that - reports any failures. Otherwise, `make -j' that rule's commands + reports any failures. Otherwise, for `make -j' that rule's commands could run before all tests had completed, resulting in spurious failures or potentially, even unreported failures. Instead, just `$(MAKE) pass-fail'. diff --git a/test/Makefile.am b/test/Makefile.am index fb0917b4..0a4b68e3 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -42,17 +42,45 @@ EXTRA_DIST = \ argtest.ok \ arrayparm.awk \ arrayparm.ok \ + arrayprm2.awk \ + arrayprm2.ok \ + arrayprm3.awk \ + arrayprm3.ok \ arrayref.awk \ arrayref.ok \ + arrymem1.awk \ + arrymem1.ok \ + arryref2.awk \ + arryref2.ok \ + arryref3.awk \ + arryref3.ok \ + arryref4.awk \ + arryref4.ok \ + arryref5.awk \ + arryref5.ok \ arynasty.awk \ arynasty.ok \ arynocls.awk \ arynocls.in \ arynocls.ok \ + aryprm1.awk \ + aryprm1.ok \ + aryprm2.awk \ + aryprm2.ok \ + aryprm3.awk \ + aryprm3.ok \ + aryprm4.awk \ + aryprm4.ok \ + aryprm5.awk \ + aryprm5.ok \ + aryprm6.awk \ + aryprm6.ok \ + aryprm7.awk \ + aryprm7.ok \ + aryprm8.awk \ + aryprm8.ok \ arysubnm.awk \ arysubnm.ok \ - arrymem1.awk \ - arrymem1.ok \ asgext.awk \ asgext.in \ asgext.ok \ @@ -95,6 +123,8 @@ EXTRA_DIST = \ defref.ok \ delarprm.awk \ delarprm.ok \ + delarpm2.awk \ + delarpm2.ok \ dynlj.awk \ dynlj.ok \ eofsplit.awk \ @@ -110,11 +140,15 @@ EXTRA_DIST = \ fldchgnf.awk \ fldchgnf.in \ fldchgnf.ok \ + fmttest.awk \ + fmttest.ok \ fnamedat.awk \ fnamedat.in \ fnamedat.ok \ fnarray.awk \ fnarray.ok \ + fnarray2.awk \ + fnarray2.ok \ fnarydel.awk \ fnarydel.ok \ fnaryscl.awk \ @@ -183,6 +217,9 @@ EXTRA_DIST = \ gsubtst3.ok \ gsubtst4.awk \ gsubtst4.ok \ + gsubtst5.awk \ + gsubtst5.in \ + gsubtst5.ok \ gtlnbufv.awk \ hsprint.awk \ hsprint.ok \ @@ -227,6 +264,8 @@ EXTRA_DIST = \ manyfiles.ok \ match1.awk \ match1.ok \ + match2.awk \ + match2.ok \ math.awk \ math.ok \ membug1.awk \ @@ -242,6 +281,9 @@ EXTRA_DIST = \ nasty2.ok \ negexp.awk \ negexp.ok \ + nested.awk \ + nested.in \ + nested.ok \ nfldstr.awk \ nfldstr.in \ nfldstr.ok \ @@ -339,6 +381,7 @@ EXTRA_DIST = \ printf1.awk \ printf1.ok \ printfloat.awk \ + printlang.awk \ prmarscl.awk \ prmarscl.ok \ prmreuse.awk \ @@ -387,13 +430,23 @@ EXTRA_DIST = \ rsnul1nl.awk \ rsnul1nl.in \ rsnul1nl.ok \ + rsnulbig.ok \ + rsnulbig2.ok \ rstest1.awk \ rstest1.ok \ rstest2.awk \ rstest2.ok \ + rstest3.awk \ + rstest3.ok \ + rstest4.awk \ + rstest4.ok \ + rstest5.awk \ + rstest5.ok \ rswhite.awk \ rswhite.in \ rswhite.ok \ + scalar.awk \ + scalar.ok \ sclforin.awk \ sclforin.ok \ sclifin.awk \ @@ -402,6 +455,8 @@ EXTRA_DIST = \ shadow.ok \ sort1.awk \ sort1.ok \ + sortempty.awk \ + sortempty.ok \ space.ok \ splitargv.awk \ splitargv.in \ @@ -421,6 +476,8 @@ EXTRA_DIST = \ strtod.awk \ strtod.in \ strtod.ok \ + strtonum.awk \ + strtonum.ok \ strftime.awk \ strftlng.awk \ strftlng.ok \ @@ -431,6 +488,7 @@ EXTRA_DIST = \ swaplns.awk \ swaplns.in \ swaplns.ok \ + switch2.awk \ synerr1.awk \ synerr1.ok \ tradanch.awk \ @@ -439,59 +497,75 @@ EXTRA_DIST = \ tweakfld.awk \ tweakfld.in \ tweakfld.ok \ - uninitialized.awk \ - uninitialized.ok \ uninit2.awk \ uninit2.ok \ + uninit3.awk \ + uninit3.ok \ + uninit4.awk \ + uninit4.ok \ + uninitialized.awk \ + uninitialized.ok \ + whiny.awk \ + whiny.in \ + whiny.ok \ zeroe0.awk \ zeroe0.ok \ zeroflag.awk \ zeroflag.ok # try to keep these sorted -BASIC_TESTS = addcomma anchgsub argarray arrayparm arrayref arrymem1 arynasty \ - arynocls arysubnm asgext awkpath back89 backgsub childin clobber \ - clsflnam compare compare2 concat1 convfmt datanonl defref delarprm \ - dynlj eofsplit fldchg fldchgnf fnamedat fnarray fnarydel fnaryscl \ - fnasgnm fnmisc fnparydl forsimp fsbs fsrs fstabplus funsemnl funsmnam \ - funstack getline getline2 getline3 getlnbuf getnr2tb getnr2tm gsubasgn gsubtest \ - gsubtst2 gsubtst3 gsubtst4 hsprint inputred intest intprec leaddig leadnl \ - litoct longsub longwrds math membug1 messages minusstr mmap8k \ - nasty nasty2 negexp nfldstr nfneg nfset nlfldsep nlinstr nlstrina \ - noeffect nofmtch noloop1 noloop2 nonl noparms nors nulrsend \ - numindex numsubstr octsub ofmt ofmtbig ofmtfidl ofmts onlynl \ - opasnidx opasnslf paramdup paramtyp parseme pcntplus prdupval prec \ - printf0 printf1 prmarscl prmreuse prt1eval prtoeval psx96sub rand rebt8b1 \ - rebt8b2 redfilnm regeq reindops reparse resplit rs rsnul1nl \ - rstest1 rstest2 rswhite sclforin sclifin splitargv splitarr splitdef \ - splitvar splitwht sprintfc strtod subslash substr swaplns synerr1 \ - tradanch tweakfld uninitialized uninit2 zeroe0 zeroflag +BASIC_TESTS = addcomma anchgsub argarray arrayparm arrayref arrymem1 \ + arrayprm2 arrayprm3 arryref2 arryref3 arryref4 arryref5 arynasty \ + arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \ + aryprm8 arysubnm asgext awkpath back89 backgsub childin clobber \ + clsflnam compare compare2 concat1 convfmt datanonl defref \ + delarprm delarpm2 dynlj eofsplit fldchg fldchgnf fmttest fnamedat \ + fnarray fnarray2 fnarydel fnaryscl fnasgnm fnmisc fnparydl \ + forsimp fsbs fsrs fstabplus funsemnl funsmnam funstack getline \ + getline2 getline3 getlnbuf getnr2tb getnr2tm gsubasgn gsubtest \ + gsubtst2 gsubtst3 gsubtst4 gsubtst5 hsprint inputred intest \ + intprec leaddig leadnl litoct longsub longwrds math membug1 \ + messages minusstr mmap8k nasty nasty2 negexp nested nfldstr \ + nfneg nfset nlfldsep nlinstr nlstrina noeffect nofmtch noloop1 \ + noloop2 nonl noparms nors nulrsend numindex numsubstr octsub ofmt \ + ofmtbig ofmtfidl ofmts onlynl opasnidx opasnslf paramdup paramtyp \ + parseme pcntplus prdupval prec printf0 printf1 prmarscl prmreuse \ + prt1eval prtoeval psx96sub rand rebt8b1 rebt8b2 redfilnm regeq \ + reindops reparse resplit rs rsnul1nl rsnulbig rsnulbig2 rstest1 \ + rstest2 rstest3 rstest4 rstest5 rswhite scalar sclforin sclifin \ + sortempty splitargv splitarr splitdef splitvar splitwht sprintfc \ + strtod subslash substr swaplns synerr1 tradanch tweakfld uninit2 \ + uninit3 uninit4 uninitialized zeroe0 zeroflag UNIX_TESTS = fflush getlnhd pid pipeio1 pipeio2 poundbang space strftlng GAWK_EXT_TESTS = argtest asort asorti badargs clos1way fieldwdth fsfwfs \ gensub gnuops2 gnureops icasefs icasers igncdym igncfs ignrcase lint \ - match1 manyfiles nondec posix procinfs regx8bit rebuf reint shadow \ - sort1 strftime + match1 match2 manyfiles nondec posix procinfs regx8bit rebuf reint \ + shadow sort1 strtonum strftime whiny EXTRA_TESTS = regtest inftest INET_TESTS = inetechu inetecht inetdayu inetdayt # List of the tests which should be run with --lint option: -NEED_LINT = defref noeffect nofmtch shadow uninitialized uninit2 +NEED_LINT = defref noeffect nofmtch shadow uninit2 uninit3 uninit4 uninitialized # List of the files that appear in manual tests or are for reserve testing: -GENTESTS_UNUSED = Makefile.in gtlnbufv.awk printfloat.awk +GENTESTS_UNUSED = Makefile.in gtlnbufv.awk printfloat.awk switch2.awk CMP = cmp AWKPROG = ../gawk$(EXEEXT) -AWK = LC_ALL=C $(AWKPROG) + +# This business forces the locale to be C for running the tests, +# unless we override it to something else for testing. +AWK = LC_ALL=$${GAWKLOCALE:-C} LANG=$${GAWKLOCALE:-C} $(AWKPROG) # Message stuff is to make it a little easier to follow. # Make the pass-fail last and dependent on others to avoid # spurious errors if `make -j' in effect. check: msg \ + printlang \ basic-msg-start basic basic-msg-end \ unix-msg-start unix-tests unix-msg-end \ extend-msg-start gawk-extensions extend-msg-end @@ -514,6 +588,9 @@ msg:: @echo 'some systems may omit a leading zero and the floating point' @echo 'precision may lead to slightly different output in a few cases.' +printlang:: + @$(AWK) -f $(srcdir)/printlang.awk + basic-msg-start: @echo "======== Starting basic tests ========" @@ -547,7 +624,7 @@ poundbang:: else \ sed "s;/tmp/gawk;../$(AWKPROG);" < $(srcdir)/poundbang.awk > ./_pbd.awk ; \ chmod +x ./_pbd.awk ; \ - ./_pbd.awk $(srcdir)/poundbang.awk > _`basename $@`; \ + LC_ALL=$${GAWKLOCALE:-C} LANG=$${GAWKLOCALE:-C} ./_pbd.awk $(srcdir)/poundbang.awk > _`basename $@`; \ fi @-$(CMP) $(srcdir)/poundbang.awk _`basename $@` && rm -f _`basename $@` _pbd.awk @@ -581,7 +658,7 @@ manyfiles:: @mkdir junk @$(AWK) 'BEGIN { for (i = 1; i <= 300; i++) print i, i}' >_$@ @$(AWK) -f $(srcdir)/manyfiles.awk _$@ _$@ - @wc -l junk/* | $(AWK) '$$1 != 2' | wc -l | sed 's/ *//g' > _$@ + @wc -l junk/* | $(AWK) '$$1 != 2' | wc -l | sed "s/ *//g" > _$@ @rm -rf junk ; $(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ compare:: @@ -592,7 +669,7 @@ compare:: inftest:: @echo $@ @echo This test is very machine specific... - @$(AWK) -f $(srcdir)/inftest.awk | sed 's/inf/Inf/g' >_$@ + @$(AWK) -f $(srcdir)/inftest.awk | sed "s/inf/Inf/g" >_$@ @-$(CMP) $(srcdir)/inftest.ok _$@ && rm -f _$@ getline2:: @@ -621,7 +698,7 @@ nonl:: @-$(CMP) $(srcdir)/nonl.ok _$@ && rm -f _$@ strftime:: - @echo This test could fail on slow machines or on a second boundary, + @echo This test could fail on slow machines or on a minute boundary, @echo so if it does, double check the actual results: @echo $@ @LC_ALL=C; export LC_ALL; LANG=C; export LANG; \ @@ -659,7 +736,7 @@ tradanch:: # command so that pid.sh is fork'ed as a child before being exec'ed. pid:: @echo pid - @AWKPATH=$(srcdir) AWK=$(AWKPROG) LC_ALL=C $(SHELL) $(srcdir)/pid.sh $$$$ > _`basename $@` ; : + @AWKPATH=$(srcdir) AWK=$(AWKPROG) $(SHELL) $(srcdir)/pid.sh $$$$ > _`basename $@` ; : @-$(CMP) $(srcdir)/pid.ok _`basename $@` && rm -f _`basename $@` _`basename $@`.in strftlng:: @@ -756,6 +833,27 @@ printf0:: @$(AWK) --posix -f $(srcdir)/$@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +rsnulbig:: + @echo $@ + @ : Suppose that block size for pipe is at most 128kB: + @$(AWK) 'BEGIN { for (i = 1; i <= 128*64+1; i++) print "abcdefgh123456\n" }' 2>&1 | \ + $(AWK) 'BEGIN { RS = ""; ORS = "\n\n" }; { print }' 2>&1 | \ + $(AWK) '/^[^a]/; END{ print NR }' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +rsnulbig2:: + @echo $@ + @$(AWK) 'BEGIN { ORS = ""; n = "\n"; for (i = 1; i <= 10; i++) n = (n n); \ + for (i = 1; i <= 128; i++) print n; print "abc\n" }' 2>&1 | \ + $(AWK) 'BEGIN { RS = ""; ORS = "\n\n" };{ print }' 2>&1 | \ + $(AWK) '/^[^a]/; END { print NR }' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +whiny:: + @echo $@ + @WHINY_USERS=1 $(AWK) -f $(srcdir)/$@.awk $(srcdir)/$@.in >_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + # Targets generated for other tests: include Maketests diff --git a/test/Makefile.in b/test/Makefile.in index 135f689e..0c918524 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.7.3 from Makefile.am. +# Makefile.in generated by automake 1.7.5 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 @@ -67,7 +67,10 @@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ -AWK = LC_ALL=C $(AWKPROG) + +# This business forces the locale to be C for running the tests, +# unless we override it to something else for testing. +AWK = LC_ALL=$${GAWKLOCALE:-C} LANG=$${GAWKLOCALE:-C} $(AWKPROG) BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ @@ -184,17 +187,45 @@ EXTRA_DIST = \ argtest.ok \ arrayparm.awk \ arrayparm.ok \ + arrayprm2.awk \ + arrayprm2.ok \ + arrayprm3.awk \ + arrayprm3.ok \ arrayref.awk \ arrayref.ok \ + arrymem1.awk \ + arrymem1.ok \ + arryref2.awk \ + arryref2.ok \ + arryref3.awk \ + arryref3.ok \ + arryref4.awk \ + arryref4.ok \ + arryref5.awk \ + arryref5.ok \ arynasty.awk \ arynasty.ok \ arynocls.awk \ arynocls.in \ arynocls.ok \ + aryprm1.awk \ + aryprm1.ok \ + aryprm2.awk \ + aryprm2.ok \ + aryprm3.awk \ + aryprm3.ok \ + aryprm4.awk \ + aryprm4.ok \ + aryprm5.awk \ + aryprm5.ok \ + aryprm6.awk \ + aryprm6.ok \ + aryprm7.awk \ + aryprm7.ok \ + aryprm8.awk \ + aryprm8.ok \ arysubnm.awk \ arysubnm.ok \ - arrymem1.awk \ - arrymem1.ok \ asgext.awk \ asgext.in \ asgext.ok \ @@ -237,6 +268,8 @@ EXTRA_DIST = \ defref.ok \ delarprm.awk \ delarprm.ok \ + delarpm2.awk \ + delarpm2.ok \ dynlj.awk \ dynlj.ok \ eofsplit.awk \ @@ -252,11 +285,15 @@ EXTRA_DIST = \ fldchgnf.awk \ fldchgnf.in \ fldchgnf.ok \ + fmttest.awk \ + fmttest.ok \ fnamedat.awk \ fnamedat.in \ fnamedat.ok \ fnarray.awk \ fnarray.ok \ + fnarray2.awk \ + fnarray2.ok \ fnarydel.awk \ fnarydel.ok \ fnaryscl.awk \ @@ -325,6 +362,9 @@ EXTRA_DIST = \ gsubtst3.ok \ gsubtst4.awk \ gsubtst4.ok \ + gsubtst5.awk \ + gsubtst5.in \ + gsubtst5.ok \ gtlnbufv.awk \ hsprint.awk \ hsprint.ok \ @@ -369,6 +409,8 @@ EXTRA_DIST = \ manyfiles.ok \ match1.awk \ match1.ok \ + match2.awk \ + match2.ok \ math.awk \ math.ok \ membug1.awk \ @@ -384,6 +426,9 @@ EXTRA_DIST = \ nasty2.ok \ negexp.awk \ negexp.ok \ + nested.awk \ + nested.in \ + nested.ok \ nfldstr.awk \ nfldstr.in \ nfldstr.ok \ @@ -481,6 +526,7 @@ EXTRA_DIST = \ printf1.awk \ printf1.ok \ printfloat.awk \ + printlang.awk \ prmarscl.awk \ prmarscl.ok \ prmreuse.awk \ @@ -529,13 +575,23 @@ EXTRA_DIST = \ rsnul1nl.awk \ rsnul1nl.in \ rsnul1nl.ok \ + rsnulbig.ok \ + rsnulbig2.ok \ rstest1.awk \ rstest1.ok \ rstest2.awk \ rstest2.ok \ + rstest3.awk \ + rstest3.ok \ + rstest4.awk \ + rstest4.ok \ + rstest5.awk \ + rstest5.ok \ rswhite.awk \ rswhite.in \ rswhite.ok \ + scalar.awk \ + scalar.ok \ sclforin.awk \ sclforin.ok \ sclifin.awk \ @@ -544,6 +600,8 @@ EXTRA_DIST = \ shadow.ok \ sort1.awk \ sort1.ok \ + sortempty.awk \ + sortempty.ok \ space.ok \ splitargv.awk \ splitargv.in \ @@ -563,6 +621,8 @@ EXTRA_DIST = \ strtod.awk \ strtod.in \ strtod.ok \ + strtonum.awk \ + strtonum.ok \ strftime.awk \ strftlng.awk \ strftlng.ok \ @@ -573,6 +633,7 @@ EXTRA_DIST = \ swaplns.awk \ swaplns.in \ swaplns.ok \ + switch2.awk \ synerr1.awk \ synerr1.ok \ tradanch.awk \ @@ -581,10 +642,17 @@ EXTRA_DIST = \ tweakfld.awk \ tweakfld.in \ tweakfld.ok \ - uninitialized.awk \ - uninitialized.ok \ uninit2.awk \ uninit2.ok \ + uninit3.awk \ + uninit3.ok \ + uninit4.awk \ + uninit4.ok \ + uninitialized.awk \ + uninitialized.ok \ + whiny.awk \ + whiny.in \ + whiny.ok \ zeroe0.awk \ zeroe0.ok \ zeroflag.awk \ @@ -592,31 +660,36 @@ EXTRA_DIST = \ # try to keep these sorted -BASIC_TESTS = addcomma anchgsub argarray arrayparm arrayref arrymem1 arynasty \ - arynocls arysubnm asgext awkpath back89 backgsub childin clobber \ - clsflnam compare compare2 concat1 convfmt datanonl defref delarprm \ - dynlj eofsplit fldchg fldchgnf fnamedat fnarray fnarydel fnaryscl \ - fnasgnm fnmisc fnparydl forsimp fsbs fsrs fstabplus funsemnl funsmnam \ - funstack getline getline2 getline3 getlnbuf getnr2tb getnr2tm gsubasgn gsubtest \ - gsubtst2 gsubtst3 gsubtst4 hsprint inputred intest intprec leaddig leadnl \ - litoct longsub longwrds math membug1 messages minusstr mmap8k \ - nasty nasty2 negexp nfldstr nfneg nfset nlfldsep nlinstr nlstrina \ - noeffect nofmtch noloop1 noloop2 nonl noparms nors nulrsend \ - numindex numsubstr octsub ofmt ofmtbig ofmtfidl ofmts onlynl \ - opasnidx opasnslf paramdup paramtyp parseme pcntplus prdupval prec \ - printf0 printf1 prmarscl prmreuse prt1eval prtoeval psx96sub rand rebt8b1 \ - rebt8b2 redfilnm regeq reindops reparse resplit rs rsnul1nl \ - rstest1 rstest2 rswhite sclforin sclifin splitargv splitarr splitdef \ - splitvar splitwht sprintfc strtod subslash substr swaplns synerr1 \ - tradanch tweakfld uninitialized uninit2 zeroe0 zeroflag +BASIC_TESTS = addcomma anchgsub argarray arrayparm arrayref arrymem1 \ + arrayprm2 arrayprm3 arryref2 arryref3 arryref4 arryref5 arynasty \ + arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \ + aryprm8 arysubnm asgext awkpath back89 backgsub childin clobber \ + clsflnam compare compare2 concat1 convfmt datanonl defref \ + delarprm delarpm2 dynlj eofsplit fldchg fldchgnf fmttest fnamedat \ + fnarray fnarray2 fnarydel fnaryscl fnasgnm fnmisc fnparydl \ + forsimp fsbs fsrs fstabplus funsemnl funsmnam funstack getline \ + getline2 getline3 getlnbuf getnr2tb getnr2tm gsubasgn gsubtest \ + gsubtst2 gsubtst3 gsubtst4 gsubtst5 hsprint inputred intest \ + intprec leaddig leadnl litoct longsub longwrds math membug1 \ + messages minusstr mmap8k nasty nasty2 negexp nested nfldstr \ + nfneg nfset nlfldsep nlinstr nlstrina noeffect nofmtch noloop1 \ + noloop2 nonl noparms nors nulrsend numindex numsubstr octsub ofmt \ + ofmtbig ofmtfidl ofmts onlynl opasnidx opasnslf paramdup paramtyp \ + parseme pcntplus prdupval prec printf0 printf1 prmarscl prmreuse \ + prt1eval prtoeval psx96sub rand rebt8b1 rebt8b2 redfilnm regeq \ + reindops reparse resplit rs rsnul1nl rsnulbig rsnulbig2 rstest1 \ + rstest2 rstest3 rstest4 rstest5 rswhite scalar sclforin sclifin \ + sortempty splitargv splitarr splitdef splitvar splitwht sprintfc \ + strtod subslash substr swaplns synerr1 tradanch tweakfld uninit2 \ + uninit3 uninit4 uninitialized zeroe0 zeroflag UNIX_TESTS = fflush getlnhd pid pipeio1 pipeio2 poundbang space strftlng GAWK_EXT_TESTS = argtest asort asorti badargs clos1way fieldwdth fsfwfs \ gensub gnuops2 gnureops icasefs icasers igncdym igncfs ignrcase lint \ - match1 manyfiles nondec posix procinfs regx8bit rebuf reint shadow \ - sort1 strftime + match1 match2 manyfiles nondec posix procinfs regx8bit rebuf reint \ + shadow sort1 strtonum strftime whiny EXTRA_TESTS = regtest inftest @@ -624,14 +697,15 @@ EXTRA_TESTS = regtest inftest INET_TESTS = inetechu inetecht inetdayu inetdayt # List of the tests which should be run with --lint option: -NEED_LINT = defref noeffect nofmtch shadow uninitialized uninit2 +NEED_LINT = defref noeffect nofmtch shadow uninit2 uninit3 uninit4 uninitialized # List of the files that appear in manual tests or are for reserve testing: -GENTESTS_UNUSED = Makefile.in gtlnbufv.awk printfloat.awk +GENTESTS_UNUSED = Makefile.in gtlnbufv.awk printfloat.awk switch2.awk CMP = cmp AWKPROG = ../gawk$(EXEEXT) subdir = test +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = @@ -641,7 +715,7 @@ DIST_COMMON = README $(srcdir)/Maketests ChangeLog Makefile.am \ all: all-am .SUFFIXES: -$(srcdir)/Makefile.in: Makefile.am $(srcdir)/Maketests $(top_srcdir)/configure.in $(ACLOCAL_M4) +$(srcdir)/Makefile.in: Makefile.am $(srcdir)/Maketests $(top_srcdir)/configure.ac $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu test/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @@ -690,7 +764,6 @@ check: check-am all-am: Makefile installdirs: - install: install-am install-exec: install-exec-am install-data: install-data-am @@ -773,6 +846,7 @@ uninstall-am: uninstall-info-am # Make the pass-fail last and dependent on others to avoid # spurious errors if `make -j' in effect. check: msg \ + printlang \ basic-msg-start basic basic-msg-end \ unix-msg-start unix-tests unix-msg-end \ extend-msg-start gawk-extensions extend-msg-end @@ -795,6 +869,9 @@ msg:: @echo 'some systems may omit a leading zero and the floating point' @echo 'precision may lead to slightly different output in a few cases.' +printlang:: + @$(AWK) -f $(srcdir)/printlang.awk + basic-msg-start: @echo "======== Starting basic tests ========" @@ -827,7 +904,7 @@ poundbang:: else \ sed "s;/tmp/gawk;../$(AWKPROG);" < $(srcdir)/poundbang.awk > ./_pbd.awk ; \ chmod +x ./_pbd.awk ; \ - ./_pbd.awk $(srcdir)/poundbang.awk > _`basename $@`; \ + LC_ALL=$${GAWKLOCALE:-C} LANG=$${GAWKLOCALE:-C} ./_pbd.awk $(srcdir)/poundbang.awk > _`basename $@`; \ fi @-$(CMP) $(srcdir)/poundbang.awk _`basename $@` && rm -f _`basename $@` _pbd.awk @@ -861,7 +938,7 @@ manyfiles:: @mkdir junk @$(AWK) 'BEGIN { for (i = 1; i <= 300; i++) print i, i}' >_$@ @$(AWK) -f $(srcdir)/manyfiles.awk _$@ _$@ - @wc -l junk/* | $(AWK) '$$1 != 2' | wc -l | sed 's/ *//g' > _$@ + @wc -l junk/* | $(AWK) '$$1 != 2' | wc -l | sed "s/ *//g" > _$@ @rm -rf junk ; $(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ compare:: @@ -872,7 +949,7 @@ compare:: inftest:: @echo $@ @echo This test is very machine specific... - @$(AWK) -f $(srcdir)/inftest.awk | sed 's/inf/Inf/g' >_$@ + @$(AWK) -f $(srcdir)/inftest.awk | sed "s/inf/Inf/g" >_$@ @-$(CMP) $(srcdir)/inftest.ok _$@ && rm -f _$@ getline2:: @@ -901,7 +978,7 @@ nonl:: @-$(CMP) $(srcdir)/nonl.ok _$@ && rm -f _$@ strftime:: - @echo This test could fail on slow machines or on a second boundary, + @echo This test could fail on slow machines or on a minute boundary, @echo so if it does, double check the actual results: @echo $@ @LC_ALL=C; export LC_ALL; LANG=C; export LANG; \ @@ -939,7 +1016,7 @@ tradanch:: # command so that pid.sh is fork'ed as a child before being exec'ed. pid:: @echo pid - @AWKPATH=$(srcdir) AWK=$(AWKPROG) LC_ALL=C $(SHELL) $(srcdir)/pid.sh $$$$ > _`basename $@` ; : + @AWKPATH=$(srcdir) AWK=$(AWKPROG) $(SHELL) $(srcdir)/pid.sh $$$$ > _`basename $@` ; : @-$(CMP) $(srcdir)/pid.ok _`basename $@` && rm -f _`basename $@` _`basename $@`.in strftlng:: @@ -1035,6 +1112,27 @@ printf0:: @echo $@ @$(AWK) --posix -f $(srcdir)/$@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +rsnulbig:: + @echo $@ + @ : Suppose that block size for pipe is at most 128kB: + @$(AWK) 'BEGIN { for (i = 1; i <= 128*64+1; i++) print "abcdefgh123456\n" }' 2>&1 | \ + $(AWK) 'BEGIN { RS = ""; ORS = "\n\n" }; { print }' 2>&1 | \ + $(AWK) '/^[^a]/; END{ print NR }' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +rsnulbig2:: + @echo $@ + @$(AWK) 'BEGIN { ORS = ""; n = "\n"; for (i = 1; i <= 10; i++) n = (n n); \ + for (i = 1; i <= 128; i++) print n; print "abc\n" }' 2>&1 | \ + $(AWK) 'BEGIN { RS = ""; ORS = "\n\n" };{ print }' 2>&1 | \ + $(AWK) '/^[^a]/; END { print NR }' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +whiny:: + @echo $@ + @WHINY_USERS=1 $(AWK) -f $(srcdir)/$@.awk $(srcdir)/$@.in >_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program addcomma: @@ -1062,11 +1160,81 @@ arrymem1: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +arrayprm2: + @echo arrayprm2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +arrayprm3: + @echo arrayprm3 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +arryref2: + @echo arryref2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +arryref3: + @echo arryref3 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +arryref4: + @echo arryref4 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +arryref5: + @echo arryref5 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + arynasty: @echo arynasty @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +aryprm1: + @echo aryprm1 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +aryprm2: + @echo aryprm2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +aryprm3: + @echo aryprm3 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +aryprm4: + @echo aryprm4 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +aryprm5: + @echo aryprm5 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +aryprm6: + @echo aryprm6 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +aryprm7: + @echo aryprm7 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +aryprm8: + @echo aryprm8 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + arysubnm: @echo arysubnm @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1127,6 +1295,11 @@ delarprm: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +delarpm2: + @echo delarpm2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + dynlj: @echo dynlj @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1147,6 +1320,11 @@ fldchgnf: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +fmttest: + @echo fmttest + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + fnamedat: @echo fnamedat @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1157,6 +1335,11 @@ fnarray: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +fnarray2: + @echo fnarray2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + fnarydel: @echo fnarydel @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1257,6 +1440,11 @@ gsubtst4: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +gsubtst5: + @echo gsubtst5 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + hsprint: @echo hsprint @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1322,6 +1510,11 @@ negexp: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +nested: + @echo nested + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + nfldstr: @echo nfldstr @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1547,11 +1740,31 @@ rstest2: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +rstest3: + @echo rstest3 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +rstest4: + @echo rstest4 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +rstest5: + @echo rstest5 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + rswhite: @echo rswhite @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +scalar: + @echo scalar + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + sclforin: @echo sclforin @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1562,6 +1775,11 @@ sclifin: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +sortempty: + @echo sortempty + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + splitargv: @echo splitargv @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1617,13 +1835,23 @@ synerr1: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ -uninitialized: - @echo uninitialized +uninit2: + @echo uninit2 @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ -uninit2: - @echo uninit2 +uninit3: + @echo uninit3 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +uninit4: + @echo uninit4 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +uninitialized: + @echo uninitialized @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ @@ -1717,6 +1945,11 @@ match1: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +match2: + @echo match2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + nondec: @echo nondec @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1752,6 +1985,11 @@ sort1: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +strtonum: + @echo strtonum + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + # end of file Maketests # Targets generated for other tests: diff --git a/test/Maketests b/test/Maketests index 97179e7b..27108d6d 100644 --- a/test/Maketests +++ b/test/Maketests @@ -25,11 +25,81 @@ arrymem1: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +arrayprm2: + @echo arrayprm2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +arrayprm3: + @echo arrayprm3 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +arryref2: + @echo arryref2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +arryref3: + @echo arryref3 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +arryref4: + @echo arryref4 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +arryref5: + @echo arryref5 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + arynasty: @echo arynasty @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +aryprm1: + @echo aryprm1 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +aryprm2: + @echo aryprm2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +aryprm3: + @echo aryprm3 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +aryprm4: + @echo aryprm4 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +aryprm5: + @echo aryprm5 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +aryprm6: + @echo aryprm6 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +aryprm7: + @echo aryprm7 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +aryprm8: + @echo aryprm8 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + arysubnm: @echo arysubnm @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -90,6 +160,11 @@ delarprm: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +delarpm2: + @echo delarpm2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + dynlj: @echo dynlj @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -110,6 +185,11 @@ fldchgnf: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +fmttest: + @echo fmttest + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + fnamedat: @echo fnamedat @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -120,6 +200,11 @@ fnarray: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +fnarray2: + @echo fnarray2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + fnarydel: @echo fnarydel @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -220,6 +305,11 @@ gsubtst4: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +gsubtst5: + @echo gsubtst5 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + hsprint: @echo hsprint @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -285,6 +375,11 @@ negexp: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +nested: + @echo nested + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + nfldstr: @echo nfldstr @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -510,11 +605,31 @@ rstest2: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +rstest3: + @echo rstest3 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +rstest4: + @echo rstest4 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +rstest5: + @echo rstest5 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + rswhite: @echo rswhite @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +scalar: + @echo scalar + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + sclforin: @echo sclforin @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -525,6 +640,11 @@ sclifin: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +sortempty: + @echo sortempty + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + splitargv: @echo splitargv @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -580,13 +700,23 @@ synerr1: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ -uninitialized: - @echo uninitialized +uninit2: + @echo uninit2 @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ -uninit2: - @echo uninit2 +uninit3: + @echo uninit3 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +uninit4: + @echo uninit4 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +uninitialized: + @echo uninitialized @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ @@ -680,6 +810,11 @@ match1: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +match2: + @echo match2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + nondec: @echo nondec @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -715,4 +850,9 @@ sort1: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +strtonum: + @echo strtonum + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + # end of file Maketests diff --git a/test/arrayprm2.awk b/test/arrayprm2.awk new file mode 100644 index 00000000..35a92cc8 --- /dev/null +++ b/test/arrayprm2.awk @@ -0,0 +1,67 @@ +# From spcecdt@armory.com Wed Apr 30 11:08:48 2003 +# Return-Path: <spcecdt@armory.com> +# Received: from localhost (skeeve [127.0.0.1]) +# by skeeve.com (8.12.5/8.12.5) with ESMTP id h3U7uZWr015489 +# for <arnold@localhost>; Wed, 30 Apr 2003 11:08:48 +0300 +# Received: from actcom.co.il [192.114.47.1] +# by localhost with POP3 (fetchmail-5.9.0) +# for arnold@localhost (single-drop); Wed, 30 Apr 2003 11:08:48 +0300 (IDT) +# Received: by actcom.co.il (mbox arobbins) +# (with Cubic Circle's cucipop (v1.31 1998/05/13) Wed Apr 30 11:05:01 2003) +# X-From_: spcecdt@armory.com Wed Apr 30 04:06:46 2003 +# Received: from smtp1.actcom.net.il by actcom.co.il with ESMTP +# (8.11.6/actcom-0.2) id h3U16iv04111 for <arobbins@actcom.co.il>; +# Wed, 30 Apr 2003 04:06:45 +0300 (EET DST) +# (rfc931-sender: mail.actcom.co.il [192.114.47.13]) +# Received: from f7.net (consort.superb.net [209.61.216.22]) +# by smtp1.actcom.net.il (8.12.8/8.12.8) with ESMTP id h3U16nEv009589 +# for <arobbins@actcom.co.il>; Wed, 30 Apr 2003 04:06:50 +0300 +# Received: from fencepost.gnu.org (fencepost.gnu.org [199.232.76.164]) +# by f7.net (8.11.7/8.11.6) with ESMTP id h3U16gj29182 +# for <arnold@skeeve.com>; Tue, 29 Apr 2003 21:06:42 -0400 +# Received: from monty-python.gnu.org ([199.232.76.173]) +# by fencepost.gnu.org with esmtp (Exim 4.10) +# id 19Ag3W-00029w-00 +# for bug-gawk@gnu.org; Tue, 29 Apr 2003 21:06:42 -0400 +# Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) +# id 19Ag1V-0001AN-00 +# for bug-gawk@gnu.org; Tue, 29 Apr 2003 21:04:39 -0400 +# Received: from deepthought.armory.com ([192.122.209.42] helo=armory.com) +# by monty-python.gnu.org with smtp (Exim 4.10.13) +# id 19Ag1V-0001A3-00 +# for bug-gawk@gnu.org; Tue, 29 Apr 2003 21:04:37 -0400 +# Date: Tue, 29 Apr 2003 18:04:35 -0700 +# From: "John H. DuBois III" <spcecdt@armory.com> +# To: bug-gawk@gnu.org +# Subject: gawk 3.1.2a bug +# Message-ID: <20030430010434.GA4278@armory.com> +# Mime-Version: 1.0 +# Content-Type: text/plain; charset=us-ascii +# Content-Disposition: inline +# User-Agent: Mutt/1.3.28i +# X-Www: http://www.armory.com./~spcecdt/ +# Sender: spcecdt@armory.com +# X-Spam-Status: No, hits=-7.2 required=5.0 +# tests=SIGNATURE_SHORT_DENSE,SPAM_PHRASE_00_01,USER_AGENT, +# USER_AGENT_MUTT +# version=2.41 +# X-Spam-Level: +# X-SpamBouncer: 1.4 (10/07/01) +# X-SBClass: OK +# Status: RO +# +# gawk-3.1.2a 'BEGIN {foo(bar)};function foo(baz){split("x",baz)}' +# gawk-3.1.2a: cmd. line:1: fatal: split: second argument is not an array +# +# John +# -- +# John DuBois spcecdt@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/ +# +BEGIN { + foo(bar) +} + +function foo(baz) +{ + split("x", baz) +} diff --git a/test/arrayprm2.ok b/test/arrayprm2.ok new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/arrayprm2.ok diff --git a/test/arrayprm3.awk b/test/arrayprm3.awk new file mode 100644 index 00000000..a41e587c --- /dev/null +++ b/test/arrayprm3.awk @@ -0,0 +1,56 @@ +# From spcecdt@armory.com Fri May 2 13:24:46 2003 +# Return-Path: <spcecdt@armory.com> +# Received: from localhost (skeeve [127.0.0.1]) +# by skeeve.com (8.12.5/8.12.5) with ESMTP id h42AChum021950 +# for <arnold@localhost>; Fri, 2 May 2003 13:24:46 +0300 +# Received: from actcom.co.il [192.114.47.1] +# by localhost with POP3 (fetchmail-5.9.0) +# for arnold@localhost (single-drop); Fri, 02 May 2003 13:24:46 +0300 (IDT) +# Received: by actcom.co.il (mbox arobbins) +# (with Cubic Circle's cucipop (v1.31 1998/05/13) Fri May 2 13:23:37 2003) +# X-From_: spcecdt@armory.com Fri May 2 00:43:51 2003 +# Received: from smtp1.actcom.net.il by actcom.co.il with ESMTP +# (8.11.6/actcom-0.2) id h41Lhm500217 for <arobbins@actcom.co.il>; +# Fri, 2 May 2003 00:43:49 +0300 (EET DST) +# (rfc931-sender: lmail.actcom.co.il [192.114.47.13]) +# Received: from f7.net (consort.superb.net [209.61.216.22]) +# by smtp1.actcom.net.il (8.12.8/8.12.8) with ESMTP id h41LiGcO022817 +# for <arobbins@actcom.co.il>; Fri, 2 May 2003 00:44:18 +0300 +# Received: from armory.com (deepthought.armory.com [192.122.209.42]) +# by f7.net (8.11.7/8.11.6) with SMTP id h41Lhj106516 +# for <arnold@skeeve.com>; Thu, 1 May 2003 17:43:46 -0400 +# Date: Thu, 1 May 2003 14:43:45 -0700 +# From: "John H. DuBois III" <spcecdt@armory.com> +# To: Aharon Robbins <arnold@skeeve.com> +# Subject: Re: gawk 3.1.2a bug +# Message-ID: <20030501214345.GA24615@armory.com> +# References: <200305011738.h41Hcg76017565@localhost.localdomain> +# Mime-Version: 1.0 +# Content-Type: text/plain; charset=us-ascii +# Content-Disposition: inline +# In-Reply-To: <200305011738.h41Hcg76017565@localhost.localdomain> +# User-Agent: Mutt/1.3.28i +# X-Www: http://www.armory.com./~spcecdt/ +# Sender: spcecdt@armory.com +# X-SpamBouncer: 1.4 (10/07/01) +# X-SBClass: OK +# Status: RO +# +# On Thu, May 01, 2003 at 08:38:42PM +0300, Aharon Robbins wrote: +# > > That worked, thanks. +# > +# > Great. Your report motivated me to find everywhere such additional +# > code ought to be needed. I think I did so. --Arnold +# +# Here's another one (perhaps fixed by your additional work): +# +BEGIN { foo(a) } +function foo(a) { bar(a); print "" in a } +function bar(a) { a[""]; } +# +# Prints 1 with gawk-3.1.1; 0 with 3.1.2a. +# +# John +# -- +# John DuBois spcecdt@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/ +# diff --git a/test/arrayprm3.ok b/test/arrayprm3.ok new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/test/arrayprm3.ok @@ -0,0 +1 @@ +1 diff --git a/test/arryref2.awk b/test/arryref2.awk new file mode 100644 index 00000000..202a0409 --- /dev/null +++ b/test/arryref2.awk @@ -0,0 +1,18 @@ +BEGIN { + foo(a) + + for (i in a) + print i, a[i] +} + +function foo(b) +{ + bar(b) + b[2] = "local" +} + +function bar(c) +{ + a[3] = "global" + c[1] = "local2" +} diff --git a/test/arryref2.ok b/test/arryref2.ok new file mode 100644 index 00000000..71aa9ed9 --- /dev/null +++ b/test/arryref2.ok @@ -0,0 +1,3 @@ +1 local2 +2 local +3 global diff --git a/test/arryref3.awk b/test/arryref3.awk new file mode 100644 index 00000000..e234ee52 --- /dev/null +++ b/test/arryref3.awk @@ -0,0 +1,18 @@ +BEGIN { + foo(a) + + for (i in a) + print i, a[i] +} + +function foo(b) +{ + a[1] = "global" + b[2] = "local" + bar(b) +} + +function bar(c) +{ + c = 12 +} diff --git a/test/arryref3.ok b/test/arryref3.ok new file mode 100644 index 00000000..eec04b63 --- /dev/null +++ b/test/arryref3.ok @@ -0,0 +1,2 @@ +gawk: arryref3.awk:17: fatal: attempt to use array `c (from b, from a)' in a scalar context +EXIT CODE: 2 diff --git a/test/arryref4.awk b/test/arryref4.awk new file mode 100644 index 00000000..072eade6 --- /dev/null +++ b/test/arryref4.awk @@ -0,0 +1,17 @@ +BEGIN { + foo(a) + + print a +} + +function foo(b) +{ + a = "global" + b[2] = "local" +# bar(b) +} + +function bar(c) +{ + c = 12 +} diff --git a/test/arryref4.ok b/test/arryref4.ok new file mode 100644 index 00000000..11cebfb4 --- /dev/null +++ b/test/arryref4.ok @@ -0,0 +1,2 @@ +gawk: arryref4.awk:10: fatal: attempt to use scalar parameter `b' as an array +EXIT CODE: 2 diff --git a/test/arryref5.awk b/test/arryref5.awk new file mode 100644 index 00000000..babff9c3 --- /dev/null +++ b/test/arryref5.awk @@ -0,0 +1,17 @@ +BEGIN { + foo(a) + + print a +} + +function foo(b) +{ + b[2] = "local" + a = "global" +# bar(b) +} + +function bar(c) +{ + c = 12 +} diff --git a/test/arryref5.ok b/test/arryref5.ok new file mode 100644 index 00000000..7b542fbf --- /dev/null +++ b/test/arryref5.ok @@ -0,0 +1,2 @@ +gawk: arryref5.awk:10: fatal: attempt to use array `a' in a scalar context +EXIT CODE: 2 diff --git a/test/aryprm1.awk b/test/aryprm1.awk new file mode 100644 index 00000000..e5bb9915 --- /dev/null +++ b/test/aryprm1.awk @@ -0,0 +1,9 @@ +function f(a) { + if (3 in a) + print 7 + a = 5 +} + +BEGIN { + f(arr) +} diff --git a/test/aryprm1.ok b/test/aryprm1.ok new file mode 100644 index 00000000..99ffd8f8 --- /dev/null +++ b/test/aryprm1.ok @@ -0,0 +1,2 @@ +gawk: aryprm1.awk:4: fatal: attempt to use array `a (from arr)' in a scalar context +EXIT CODE: 2 diff --git a/test/aryprm2.awk b/test/aryprm2.awk new file mode 100644 index 00000000..00dd7638 --- /dev/null +++ b/test/aryprm2.awk @@ -0,0 +1,8 @@ +function f(a) { + delete a + a *= 5 +} + +BEGIN { + f(arr) +} diff --git a/test/aryprm2.ok b/test/aryprm2.ok new file mode 100644 index 00000000..c8585c9a --- /dev/null +++ b/test/aryprm2.ok @@ -0,0 +1,2 @@ +gawk: aryprm2.awk:3: fatal: attempt to use array `a (from arr)' in a scalar context +EXIT CODE: 2 diff --git a/test/aryprm3.awk b/test/aryprm3.awk new file mode 100644 index 00000000..c38ab588 --- /dev/null +++ b/test/aryprm3.awk @@ -0,0 +1,10 @@ +function f(a, i) { + for (i in a) + delete a[i] + if (a == 0) + print 7 +} + +BEGIN { + f(arr) +} diff --git a/test/aryprm3.ok b/test/aryprm3.ok new file mode 100644 index 00000000..63c51312 --- /dev/null +++ b/test/aryprm3.ok @@ -0,0 +1,2 @@ +gawk: aryprm3.awk:6: fatal: attempt to use array `a (from arr)' in a scalar context +EXIT CODE: 2 diff --git a/test/aryprm4.awk b/test/aryprm4.awk new file mode 100644 index 00000000..09427f6b --- /dev/null +++ b/test/aryprm4.awk @@ -0,0 +1,7 @@ +function f(x){ + x = 1 +} +BEGIN { + f(a) + a[1] +} diff --git a/test/aryprm4.ok b/test/aryprm4.ok new file mode 100644 index 00000000..9307e4ab --- /dev/null +++ b/test/aryprm4.ok @@ -0,0 +1,2 @@ +gawk: aryprm4.awk:6: fatal: attempt to use scalar `a' as array +EXIT CODE: 2 diff --git a/test/aryprm5.awk b/test/aryprm5.awk new file mode 100644 index 00000000..a4aac367 --- /dev/null +++ b/test/aryprm5.awk @@ -0,0 +1,6 @@ +function f(x){ + x[1] = x +} +BEGIN { + f(a) +} diff --git a/test/aryprm5.ok b/test/aryprm5.ok new file mode 100644 index 00000000..1ce41199 --- /dev/null +++ b/test/aryprm5.ok @@ -0,0 +1,2 @@ +gawk: aryprm5.awk:2: fatal: attempt to use scalar parameter `x' as an array +EXIT CODE: 2 diff --git a/test/aryprm6.awk b/test/aryprm6.awk new file mode 100644 index 00000000..b12b2782 --- /dev/null +++ b/test/aryprm6.awk @@ -0,0 +1,7 @@ +function f(x){ + a + x[1] = 3 +} +BEGIN { + f(a) +} diff --git a/test/aryprm6.ok b/test/aryprm6.ok new file mode 100644 index 00000000..8561ddf2 --- /dev/null +++ b/test/aryprm6.ok @@ -0,0 +1,2 @@ +gawk: aryprm6.awk:3: fatal: attempt to use scalar parameter `x' as an array +EXIT CODE: 2 diff --git a/test/aryprm7.awk b/test/aryprm7.awk new file mode 100644 index 00000000..b442b4da --- /dev/null +++ b/test/aryprm7.awk @@ -0,0 +1,6 @@ +function f(x, y){ + y[1] = x +} +BEGIN { + f(a, a) +} diff --git a/test/aryprm7.ok b/test/aryprm7.ok new file mode 100644 index 00000000..00e28967 --- /dev/null +++ b/test/aryprm7.ok @@ -0,0 +1,2 @@ +gawk: aryprm7.awk:2: fatal: attempt to use scalar parameter `y' as an array +EXIT CODE: 2 diff --git a/test/aryprm8.awk b/test/aryprm8.awk new file mode 100644 index 00000000..b294abb6 --- /dev/null +++ b/test/aryprm8.awk @@ -0,0 +1,22 @@ +BEGIN { + f(0, a) # nothing + f(1, a) +} +function f(i, a) { + if (i == 0) return + g(a, a) + pr(a) +} +function g(x, y) { + h(y, x, y) +} +function h(b, c, d) { + b[1] = 1 + c[1] = 2 # rewrite + print b[1], d[1] + c[2] = 1 + b[2] = 2 # should rewrite +} +function pr(x) { + print x[1], x[2] +} diff --git a/test/aryprm8.ok b/test/aryprm8.ok new file mode 100644 index 00000000..fad54c24 --- /dev/null +++ b/test/aryprm8.ok @@ -0,0 +1,2 @@ +2 2 +2 2 diff --git a/test/delarpm2.awk b/test/delarpm2.awk new file mode 100644 index 00000000..ad0ed3df --- /dev/null +++ b/test/delarpm2.awk @@ -0,0 +1,95 @@ +# From beebe@math.utah.edu Sat May 17 21:31:27 2003 +# Return-Path: <beebe@math.utah.edu> +# Received: from localhost (aahz [127.0.0.1]) +# by skeeve.com (8.12.5/8.12.5) with ESMTP id h4HIQmCw001380 +# for <arnold@localhost>; Sat, 17 May 2003 21:31:27 +0300 +# Received: from actcom.co.il [192.114.47.1] +# by localhost with POP3 (fetchmail-5.9.0) +# for arnold@localhost (single-drop); Sat, 17 May 2003 21:31:27 +0300 (IDT) +# Received: by actcom.co.il (mbox arobbins) +# (with Cubic Circle's cucipop (v1.31 1998/05/13) Sat May 17 21:34:07 2003) +# X-From_: beebe@sunshine.math.utah.edu Fri May 16 20:38:45 2003 +# Received: from smtp1.actcom.net.il by actcom.co.il with ESMTP +# (8.11.6/actcom-0.2) id h4GHcd226764 for <arobbins@actcom.co.il>; +# Fri, 16 May 2003 20:38:40 +0300 (EET DST) +# (rfc931-sender: mail.actcom.co.il [192.114.47.13]) +# Received: from f7.net (consort.superb.net [209.61.216.22]) +# by smtp1.actcom.net.il (8.12.8/8.12.8) with ESMTP id h4GHgBc2023067 +# for <arobbins@actcom.co.il>; Fri, 16 May 2003 20:42:13 +0300 +# Received: from sunshine.math.utah.edu (sunshine.math.utah.edu [128.110.198.2]) +# by f7.net (8.11.7/8.11.6) with ESMTP id h4GHcbf09202 +# for <arnold@skeeve.com>; Fri, 16 May 2003 13:38:37 -0400 +# Received: from suncore.math.utah.edu (IDENT:r8KQWmkF4jVMLBhxpojXGNCAnBZB38ET@suncore.math.utah.edu [128.110.198.5]) +# by sunshine.math.utah.edu (8.9.3p2/8.9.3) with ESMTP id LAA09111; +# Fri, 16 May 2003 11:38:34 -0600 (MDT) +# Received: (from beebe@localhost) +# by suncore.math.utah.edu (8.9.3p2/8.9.3) id LAA01743; +# Fri, 16 May 2003 11:38:34 -0600 (MDT) +# Date: Fri, 16 May 2003 11:38:34 -0600 (MDT) +# From: "Nelson H. F. Beebe" <beebe@math.utah.edu> +# To: "Arnold Robbins" <arnold@skeeve.com> +# Cc: beebe@math.utah.edu +# X-US-Mail: "Center for Scientific Computing, Department of Mathematics, 110 +# LCB, University of Utah, 155 S 1400 E RM 233, Salt Lake City, UT +# 84112-0090, USA" +# X-Telephone: +1 801 581 5254 +# X-FAX: +1 801 585 1640, +1 801 581 4148 +# X-URL: http://www.math.utah.edu/~beebe +# Subject: gawk-3.1.2[ab]: bug in delete +# Message-ID: <CMM.0.92.0.1053106714.beebe@suncore.math.utah.edu> +# +# I discovered yesterday that one of my tools got broken by the upgrade +# to gawk-3.1.2a and gawk-3.1.2b. For now, I've temporarily reset +# /usr/local/bin/gawk on the Sun Solaris and Intel GNU/Linux systems +# back to be gawk-3.1.2. +# +# This morning, I isolated the problem to the following small test case: +# +# % cat bug.awk + BEGIN { + clear_array(table) + foo(table) + for (key in table) + print key, table[k] + clear_array(table) + exit(0) + } + + function clear_array(array, key) + { + for (key in array) + delete array[key] + } + + function foo(a) + { + a[1] = "one" + a[2] = "two" + } +# +# With nawk, mawk, and also gawk-3.1.2 or earlier, I get this: +# +# % mawk -f bug.awk +# 1 +# 2 +# +# However, with the two most recent gawk releases, I get: +# +# % gawk-3.1.2b -f bug.awk +# gawk-3.1.2b: bug.awk:12: fatal: delete: illegal use of variable `table' as +# array +# +# If the first clear_array() statement is commented out, it runs. +# However, the problem is that in a large program, it may not be easy to +# identify places where it is safe to invoke delete, so I believe the +# old behavior is more desirable. +# +# ------------------------------------------------------------------------------- +# - Nelson H. F. Beebe Tel: +1 801 581 5254 - +# - Center for Scientific Computing FAX: +1 801 581 4148 - +# - University of Utah Internet e-mail: beebe@math.utah.edu - +# - Department of Mathematics, 110 LCB beebe@acm.org beebe@computer.org - +# - 155 S 1400 E RM 233 beebe@ieee.org - +# - Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe - +# ------------------------------------------------------------------------------- +# diff --git a/test/delarpm2.ok b/test/delarpm2.ok new file mode 100644 index 00000000..bea5b8a4 --- /dev/null +++ b/test/delarpm2.ok @@ -0,0 +1,2 @@ +1 +2 diff --git a/test/fmttest.awk b/test/fmttest.awk new file mode 100644 index 00000000..e8db0fb7 --- /dev/null +++ b/test/fmttest.awk @@ -0,0 +1,164 @@ +### /u/sy/beebe/xml/shbook/fmttest.awk, Sat May 31 09:13:52 2003 +### Edit by Nelson H. F. Beebe <beebe@math.utah.edu> +### ==================================================================== +### Test the degree of support for printf format items in awk +### implementations. +### +### Usage: +### awk -f fmttest.awk +### [31-May-2003] +### ==================================================================== + +BEGIN { + ## ----------------------------------------------------------------- + print "\n\nFormat item: c\n" + + printf("ABC with %%c : %c\n", "ABC") + printf("123 with %%c : %c\n", 123) + + printf("ABC with %%.15c : %.15c\n", "ABC") + printf("123 with %%.15c : %.15c\n", 123) + + printf("ABC with %%15c : %15c\n", "ABC") + printf("123 with %%15c : %15c\n", 123) + + printf("ABC with %%-15c : %-15c\n", "ABC") + printf("123 with %%-15c : %-15c\n", 123) + + ## ----------------------------------------------------------------- + print "\n\nFormat item: d\n" + + printf("ABC with %%d : %d\n", "ABC") + printf("123 with %%d : %d\n", 123) + + printf("ABC with %%.15d : %.15d\n", "ABC") + printf("123 with %%.15d : %.15d\n", 123) + + printf("ABC with %%15d : %15d\n", "ABC") + printf("123 with %%15d : %15d\n", 123) + + printf("ABC with %%-15d : %-15d\n", "ABC") + printf("123 with %%-15d : %-15d\n", 123) + + ## ----------------------------------------------------------------- + print "\n\nFormat item: e\n" + + printf("ABC with %%e : %e\n", "ABC") + printf("123 with %%e : %e\n", 123) + + printf("ABC with %%.25e : %.25e\n", "ABC") + printf("123 with %%.25e : %.25e\n", 123) + + printf("ABC with %%25e : %25e\n", "ABC") + printf("123 with %%25e : %25e\n", 123) + + printf("ABC with %%-25e : %-25e\n", "ABC") + printf("123 with %%-25e : %-25e\n", 123) + + ## ----------------------------------------------------------------- + print "\n\nFormat item: f\n" + + printf("ABC with %%f : %f\n", "ABC") + printf("123 with %%f : %f\n", 123) + + printf("ABC with %%.25f : %.25f\n", "ABC") + printf("123 with %%.25f : %.25f\n", 123) + + printf("ABC with %%25f : %25f\n", "ABC") + printf("123 with %%25f : %25f\n", 123) + + printf("ABC with %%-25f : %-25f\n", "ABC") + printf("123 with %%-25f : %-25f\n", 123) + + ## ----------------------------------------------------------------- + print "\n\nFormat item: g\n" + + printf("ABC with %%g : %g\n", "ABC") + printf("123 with %%g : %g\n", 123) + + printf("ABC with %%.25g : %.25g\n", "ABC") + printf("123 with %%.25g : %.25g\n", 123) + + printf("ABC with %%25g : %25g\n", "ABC") + printf("123 with %%25g : %25g\n", 123) + + printf("ABC with %%-25g : %-25g\n", "ABC") + printf("123 with %%-25g : %-25g\n", 123) + + ## ----------------------------------------------------------------- + print "\n\nFormat item: o\n" + + printf("ABC with %%o : %o\n", "ABC") + printf("123 with %%o : %o\n", 123) + + printf("ABC with %%.15o : %.15o\n", "ABC") + printf("123 with %%.15o : %.15o\n", 123) + + printf("ABC with %%15o : %15o\n", "ABC") + printf("123 with %%15o : %15o\n", 123) + + printf("ABC with %%-15o : %-15o\n", "ABC") + printf("123 with %%-15o : %-15o\n", 123) + + ## ----------------------------------------------------------------- + print "\n\nFormat item: s\n" + + printf("ABC with %%s : %s\n", "ABC") + printf("123 with %%s : %s\n", 123) + + printf("ABC with %%.15s : %.15s\n", "ABC") + printf("123 with %%.15s : %.15s\n", 123) + + printf("ABC with %%15s : %15s\n", "ABC") + printf("123 with %%15s : %15s\n", 123) + + printf("ABC with %%-15s : %-15s\n", "ABC") + printf("123 with %%-15s : %-15s\n", 123) + + ## ----------------------------------------------------------------- + print "\n\nFormat item: u\n" + + printf("ABC with %%u : %u\n", "ABC") + printf("123 with %%u : %u\n", 123) + + printf("ABC with %%.15u : %.15u\n", "ABC") + printf("123 with %%.15u : %.15u\n", 123) + + printf("ABC with %%15u : %15u\n", "ABC") + printf("123 with %%15u : %15u\n", 123) + + printf("ABC with %%-15u : %-15u\n", "ABC") + printf("123 with %%-15u : %-15u\n", 123) + + ## ----------------------------------------------------------------- + print "\n\nFormat item: x\n" + + printf("ABC with %%x : %x\n", "ABC") + printf("123 with %%x : %x\n", 123) + + printf("ABC with %%.15x : %.15x\n", "ABC") + printf("123 with %%.15x : %.15x\n", 123) + + printf("ABC with %%15x : %15x\n", "ABC") + printf("123 with %%15x : %15x\n", 123) + + printf("ABC with %%-15x : %-15x\n", "ABC") + printf("123 with %%-15x : %-15x\n", 123) + + ## ----------------------------------------------------------------- + print "\n\nFormat item: X\n" + + printf("ABC with %%X : %X\n", "ABC") + printf("123 with %%X : %X\n", 123) + + printf("ABC with %%.15X : %.15X\n", "ABC") + printf("123 with %%.15X : %.15X\n", 123) + + printf("ABC with %%15X : %15X\n", "ABC") + printf("123 with %%15X : %15X\n", 123) + + printf("ABC with %%-15X : %-15X\n", "ABC") + printf("123 with %%-15X : %-15X\n", 123) + + exit(0) +} diff --git a/test/fmttest.ok b/test/fmttest.ok new file mode 100644 index 00000000..753567ac --- /dev/null +++ b/test/fmttest.ok @@ -0,0 +1,120 @@ + + +Format item: c + +ABC with %c : A +123 with %c : { +ABC with %.15c : A +123 with %.15c : { +ABC with %15c : A +123 with %15c : { +ABC with %-15c : A +123 with %-15c : { + + +Format item: d + +ABC with %d : 0 +123 with %d : 123 +ABC with %.15d : 000000000000000 +123 with %.15d : 000000000000123 +ABC with %15d : 0 +123 with %15d : 123 +ABC with %-15d : 0 +123 with %-15d : 123 + + +Format item: e + +ABC with %e : 0.000000e+00 +123 with %e : 1.230000e+02 +ABC with %.25e : 0.0000000000000000000000000e+00 +123 with %.25e : 1.2300000000000000000000000e+02 +ABC with %25e : 0.000000e+00 +123 with %25e : 1.230000e+02 +ABC with %-25e : 0.000000e+00 +123 with %-25e : 1.230000e+02 + + +Format item: f + +ABC with %f : 0.000000 +123 with %f : 123.000000 +ABC with %.25f : 0.0000000000000000000000000 +123 with %.25f : 123.0000000000000000000000000 +ABC with %25f : 0.000000 +123 with %25f : 123.000000 +ABC with %-25f : 0.000000 +123 with %-25f : 123.000000 + + +Format item: g + +ABC with %g : 0 +123 with %g : 123 +ABC with %.25g : 0 +123 with %.25g : 123 +ABC with %25g : 0 +123 with %25g : 123 +ABC with %-25g : 0 +123 with %-25g : 123 + + +Format item: o + +ABC with %o : 0 +123 with %o : 173 +ABC with %.15o : 000000000000000 +123 with %.15o : 000000000000173 +ABC with %15o : 0 +123 with %15o : 173 +ABC with %-15o : 0 +123 with %-15o : 173 + + +Format item: s + +ABC with %s : ABC +123 with %s : 123 +ABC with %.15s : ABC +123 with %.15s : 123 +ABC with %15s : ABC +123 with %15s : 123 +ABC with %-15s : ABC +123 with %-15s : 123 + + +Format item: u + +ABC with %u : 0 +123 with %u : 123 +ABC with %.15u : 000000000000000 +123 with %.15u : 000000000000123 +ABC with %15u : 0 +123 with %15u : 123 +ABC with %-15u : 0 +123 with %-15u : 123 + + +Format item: x + +ABC with %x : 0 +123 with %x : 7b +ABC with %.15x : 000000000000000 +123 with %.15x : 00000000000007b +ABC with %15x : 0 +123 with %15x : 7b +ABC with %-15x : 0 +123 with %-15x : 7b + + +Format item: X + +ABC with %X : 0 +123 with %X : 7B +ABC with %.15X : 000000000000000 +123 with %.15X : 00000000000007B +ABC with %15X : 0 +123 with %15X : 7B +ABC with %-15X : 0 +123 with %-15X : 7B diff --git a/test/fnarray.ok b/test/fnarray.ok index 2ef124b7..3ee41814 100644 --- a/test/fnarray.ok +++ b/test/fnarray.ok @@ -1,3 +1,3 @@ -gawk: fnarray.awk:5: fatal: function `foo' called with space between name and `(', -or used as a variable or an array -EXIT CODE: 2 +gawk: fnarray.awk:5: Num = foo[c] +gawk: fnarray.awk:5: ^ use of non-array as array +EXIT CODE: 1 diff --git a/test/fnarray2.awk b/test/fnarray2.awk new file mode 100644 index 00000000..1723fbf6 --- /dev/null +++ b/test/fnarray2.awk @@ -0,0 +1,5 @@ +function pile(c, r) +{ + r = ++pile[c] +} +{ pile($1) } diff --git a/test/fnarray2.ok b/test/fnarray2.ok new file mode 100644 index 00000000..243e4cc3 --- /dev/null +++ b/test/fnarray2.ok @@ -0,0 +1,3 @@ +gawk: fnarray2.awk:3: r = ++pile[c] +gawk: fnarray2.awk:3: ^ use of non-array as array +EXIT CODE: 1 diff --git a/test/fnaryscl.ok b/test/fnaryscl.ok index 2fecd582..ac840772 100644 --- a/test/fnaryscl.ok +++ b/test/fnaryscl.ok @@ -1,2 +1,2 @@ -gawk: fnaryscl.awk:10: fatal: attempt to use array `c (from b (from a (from foo)))' in a scalar context +gawk: fnaryscl.awk:10: fatal: attempt to use array `c (from b, from a, from foo)' in a scalar context EXIT CODE: 2 diff --git a/test/gsubtst5.awk b/test/gsubtst5.awk new file mode 100644 index 00000000..4bef854f --- /dev/null +++ b/test/gsubtst5.awk @@ -0,0 +1,97 @@ +# From jose@monkey.org Thu Jun 5 11:48:35 2003 +# Return-Path: <jose@monkey.org> +# Received: from localhost (skeeve [127.0.0.1]) +# by skeeve.com (8.12.5/8.12.5) with ESMTP id h558eVvA012655 +# for <arnold@localhost>; Thu, 5 Jun 2003 11:48:35 +0300 +# Received: from actcom.co.il [192.114.47.1] +# by localhost with POP3 (fetchmail-5.9.0) +# for arnold@localhost (single-drop); Thu, 05 Jun 2003 11:48:35 +0300 (IDT) +# Received: by actcom.co.il (mbox arobbins) +# (with Cubic Circle's cucipop (v1.31 1998/05/13) Thu Jun 5 11:47:59 2003) +# X-From_: jose@monkey.org Thu Jun 5 07:14:45 2003 +# Received: from smtp1.actcom.net.il by actcom.co.il with ESMTP +# (8.11.6/actcom-0.2) id h554EdY08108 for <arobbins@actcom.co.il>; +# Thu, 5 Jun 2003 07:14:41 +0300 (EET DST) +# (rfc931-sender: smtp.actcom.co.il [192.114.47.13]) +# Received: from f7.net (consort.superb.net [209.61.216.22]) +# by smtp1.actcom.net.il (8.12.8/8.12.8) with ESMTP id h554G3To008304 +# for <arobbins@actcom.co.il>; Thu, 5 Jun 2003 07:16:05 +0300 +# Received: from fencepost.gnu.org (fencepost.gnu.org [199.232.76.164]) +# by f7.net (8.11.7/8.11.6) with ESMTP id h554Ean08172 +# for <arnold@skeeve.com>; Thu, 5 Jun 2003 00:14:36 -0400 +# Received: from monty-python.gnu.org ([199.232.76.173]) +# by fencepost.gnu.org with esmtp (Exim 4.20) +# id 19Nm96-0001xE-1i +# for arnold@gnu.ai.mit.edu; Thu, 05 Jun 2003 00:14:36 -0400 +# Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) +# id 19Nm8x-0005ge-Dz +# for arnold@gnu.ai.mit.edu; Thu, 05 Jun 2003 00:14:28 -0400 +# Received: from naughty.monkey.org ([66.93.9.164]) +# by monty-python.gnu.org with esmtp (Exim 4.20) +# id 19Nm8w-0005VM-Ko +# for arnold@gnu.ai.mit.edu; Thu, 05 Jun 2003 00:14:26 -0400 +# Received: by naughty.monkey.org (Postfix, from userid 1203) +# id C15511BA97B; Thu, 5 Jun 2003 00:14:19 -0400 (EDT) +# Received: from localhost (localhost [127.0.0.1]) +# by naughty.monkey.org (Postfix) with ESMTP +# id BF9821BA969; Thu, 5 Jun 2003 00:14:19 -0400 (EDT) +# Date: Thu, 5 Jun 2003 00:14:19 -0400 (EDT) +# From: Jose Nazario <jose@monkey.org> +# To: bug-gnu-utils@prep.ai.mit.edu, arnold@gnu.ai.mit.edu, +# netbsd-bugs@netbsd.org +# Subject: bug in gawk/gsub() (not present in nawk) +# Message-ID: <Pine.BSO.4.51.0306050007160.31577@naughty.monkey.org> +# MIME-Version: 1.0 +# Content-Type: TEXT/PLAIN; charset=US-ASCII +# X-Spam-Status: No, hits=-1.2 required=5.0 +# tests=SPAM_PHRASE_00_01,USER_AGENT_PINE +# version=2.41 +# X-Spam-Level: +# X-SpamBouncer: 1.4 (10/07/01) +# X-SBClass: OK +# Status: R +# +# while playing with some tools in data massaging, i had to migrate from an +# openbsd/nawk system to a netbsd/gawk system. i found the folllowing +# behavior, which seems to be a bug. +# +# the following gsub() pattern has a strange effect under gawk which is not +# visible in nawk (at least as compiled on openbsd). the intention is to +# take a string like "This Is a Title: My Title?" and turn it into a +# normalized string: "ThisIsaTitleMyTitle". to do this, i wrote the +# following gross gsub line in an awk script: +# +# gsub(/[\ \"-\/\\:;\[\]\@\?\.\,\$]/, "", $2) +# print $2 +# +# in gawk, as found in netbsd-macppc/1.5.2, this will drop the first letter +# of every word. the resulting string will be "hissitleyitle", while in nawk +# as built on openbsd-3.3 this will get it correct. +# +# any insights? the inconsistency with this relatively naive pattern seems a +# bit odd. (i would up installing nawk built from openbsd sources.) +# +# thanks. sorry i didn't send a better bug report, netbsd folks, i'm not +# much of a netbsd user, and i dont have send-pr set up. yes, this is a +# slightly older version of netbsd and gawk: +# +# $ uname -a +# NetBSD entropy 1.5.2 NetBSD 1.5.2 (GENERIC) #0: Sun Feb 10 02:00:04 EST +# 2002 jose@entropy:/usr/src/sys/arch/macppc/compile/GENERIC macppc +# $ awk --version +# GNU Awk 3.0.3 +# Copyright (C) 1989, 1991-1997 Free Software Foundation. +# +# +# +# thanks. +# +# ___________________________ +# jose nazario, ph.d. jose@monkey.org +# http://monkey.org/~jose/ +# +# +{ + gsub(/[\ \"-\/\\:;\[\]\@\?\.\,\$]/, "") + print +} diff --git a/test/gsubtst5.in b/test/gsubtst5.in new file mode 100644 index 00000000..5d1f1a97 --- /dev/null +++ b/test/gsubtst5.in @@ -0,0 +1 @@ +This Is a Title: My Title? diff --git a/test/gsubtst5.ok b/test/gsubtst5.ok new file mode 100644 index 00000000..b038c8af --- /dev/null +++ b/test/gsubtst5.ok @@ -0,0 +1 @@ +ThisIsaTitleMyTitle diff --git a/test/match2.awk b/test/match2.awk new file mode 100644 index 00000000..b4d9544c --- /dev/null +++ b/test/match2.awk @@ -0,0 +1,6 @@ +function f(a, b, c) +{ + print match("foo", "bar", f) +} + +BEGIN { f(1, 2, 3) } diff --git a/test/match2.ok b/test/match2.ok new file mode 100644 index 00000000..a4a91e85 --- /dev/null +++ b/test/match2.ok @@ -0,0 +1,2 @@ +gawk: match2.awk:3: fatal: match: third argument is not an array +EXIT CODE: 2 diff --git a/test/nested.awk b/test/nested.awk new file mode 100644 index 00000000..5284b550 --- /dev/null +++ b/test/nested.awk @@ -0,0 +1,123 @@ +# From james@ruari-quinn.demon.co.uk Thu Jun 5 11:43:58 2003 +# Return-Path: <james@ruari-quinn.demon.co.uk> +# Received: from localhost (skeeve [127.0.0.1]) +# by skeeve.com (8.12.5/8.12.5) with ESMTP id h558eVui012655 +# for <arnold@localhost>; Thu, 5 Jun 2003 11:43:58 +0300 +# Received: from actcom.co.il [192.114.47.1] +# by localhost with POP3 (fetchmail-5.9.0) +# for arnold@localhost (single-drop); Thu, 05 Jun 2003 11:43:58 +0300 (IDT) +# Received: by actcom.co.il (mbox arobbins) +# (with Cubic Circle's cucipop (v1.31 1998/05/13) Thu Jun 5 11:43:29 2003) +# X-From_: james@ruari-quinn.demon.co.uk Wed Jun 4 20:09:54 2003 +# Received: from smtp1.actcom.net.il by actcom.co.il with ESMTP +# (8.11.6/actcom-0.2) id h54H9oY05088 for <arobbins@actcom.co.il>; +# Wed, 4 Jun 2003 20:09:52 +0300 (EET DST) +# (rfc931-sender: smtp.actcom.co.il [192.114.47.13]) +# Received: from f7.net (consort.superb.net [209.61.216.22]) +# by smtp1.actcom.net.il (8.12.8/8.12.8) with ESMTP id h54HB8To002721 +# for <arobbins@actcom.co.il>; Wed, 4 Jun 2003 20:11:09 +0300 +# Received: from fencepost.gnu.org (fencepost.gnu.org [199.232.76.164]) +# by f7.net (8.11.7/8.11.6) with ESMTP id h54H9li15411 +# for <arnold@skeeve.com>; Wed, 4 Jun 2003 13:09:47 -0400 +# Received: from monty-python.gnu.org ([199.232.76.173]) +# by fencepost.gnu.org with esmtp (Exim 4.20) +# id 19Nbli-0001kD-BL +# for bug-gawk@gnu.org; Wed, 04 Jun 2003 13:09:46 -0400 +# Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) +# id 19NbZ5-0004V2-71 +# for bug-gawk@gnu.org; Wed, 04 Jun 2003 12:56:43 -0400 +# Received: from cicero.e-mis.co.uk ([212.240.194.162]) +# by monty-python.gnu.org with esmtp (Exim 4.20) +# id 19NbYK-0003c7-AP +# for bug-gawk@gnu.org; Wed, 04 Jun 2003 12:55:56 -0400 +# Received: from [10.139.58.254] (helo=tacitus) +# by cicero.e-mis.co.uk with esmtp (Exim 3.35 #1 (Debian)) +# id 19NbWO-0007Qv-00 +# for <bug-gawk@gnu.org>; Wed, 04 Jun 2003 17:53:56 +0100 +# Received: from james by tacitus with local (Exim 3.36 #1 (Debian)) +# id 19NbWO-0000cK-00 +# for <bug-gawk@gnu.org>; Wed, 04 Jun 2003 17:53:56 +0100 +# To: bug-gawk@gnu.org +# Subject: 3.1.0 regression +# Mail-Copies-To: never +# From: James Troup <james@nocrew.org> +# User-Agent: Gnus/5.090017 (Oort Gnus v0.17) Emacs/20.7 (gnu/linux) +# Date: Wed, 04 Jun 2003 17:53:56 +0100 +# Message-ID: <874r35wzq3.fsf@nocrew.org> +# MIME-Version: 1.0 +# Content-Type: text/plain; charset=us-ascii +# Sender: James Troup <james@ruari-quinn.demon.co.uk> +# X-Spam-Status: No, hits=-3.9 required=5.0 +# tests=EMAIL_ATTRIBUTION,SIGNATURE_SHORT_DENSE,SPAM_PHRASE_00_01, +# USER_AGENT +# version=2.41 +# X-Spam-Level: +# X-SpamBouncer: 1.4 (10/07/01) +# X-SBClass: OK +# Status: R +# +# Hi Aharon, +# +# This bug report comes from the Debian bug tracking system. You can +# view the full log at: +# +# http://bugs.debian.org/188345 +# +# Like my other bug, this is a regression from 3.1.0 and I've reproduced +# this problem with 3.1.2d. +# +# "Nikita V. Youshchenko" <yoush@cs.msu.su> writes: +# +# | Package: gawk +# | Version: 1:3.1.2-2 +# | Severity: normal +# | Tags: sid +# | +# | After upgrading gawk from woody to sid, I found one of my scripts not +# | working. I explored this a little and found minimal script to reproduce +# | the problem. +# | +# | File bug.awk is the following: +# | +BEGIN { + WI_total = 0 +} +{ + WI_total++ + { + split ( $1, sws, "_" ) + a = sws[1] + } + print(sws[1]) + print(a) +} +# | +# | The second print should output the same what first print poutputs, but +# | with gawk 3.1.2-2 it outputs nothing: +# | > echo a_b | gawk -f bug.awk +# | a +# | +# | > +# | +# | With gawk from stable I get what expexted: +# | > echo a_b | gawk -f bug.awk +# | a +# | a +# | > +# | +# | If I remove "WI_total++" line, bug disapperas +# | +# | -- System Information: +# | Debian Release: 3.0 +# | Architecture: i386 +# | Kernel: Linux zigzag 2.4.19 16:49:13 MSK 2003 i686 +# | Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.KOI8-R +# | +# | Versions of packages gawk depends on: +# | ii libc6 2.3.1-16 GNU C Library: Shared libraries an +# | +# | -- no debconf information +# +# -- +# James +# diff --git a/test/nested.in b/test/nested.in new file mode 100644 index 00000000..31b658b1 --- /dev/null +++ b/test/nested.in @@ -0,0 +1 @@ +a_b diff --git a/test/nested.ok b/test/nested.ok new file mode 100644 index 00000000..7e8a1653 --- /dev/null +++ b/test/nested.ok @@ -0,0 +1,2 @@ +a +a diff --git a/test/pipeio2.awk b/test/pipeio2.awk index 32d09eee..dbf354bf 100644 --- a/test/pipeio2.awk +++ b/test/pipeio2.awk @@ -28,7 +28,8 @@ BEGIN { while ((com | getline fnam) > 0) { # com_tr = "echo " fnam " | tr [0-9]. ..........." - com_tr = "echo " fnam " | sed 's/[0-9]/./g'" +# com_tr = "echo " fnam " | sed 's/[0-9]/./g'" + com_tr = "echo " fnam " | sed \"s/[0-9]/./g\"" # print "\'" com_tr "\'" print "'" com_tr "'" diff --git a/test/pipeio2.ok b/test/pipeio2.ok index 0bb33245..13b0b9b0 100644 --- a/test/pipeio2.ok +++ b/test/pipeio2.ok @@ -1,16 +1,16 @@ -'echo January 1997 | sed 's/[0-9]/./g'' +'echo January 1997 | sed "s/[0-9]/./g"' January .... -'echo S M Tu W Th F S | sed 's/[0-9]/./g'' +'echo S M Tu W Th F S | sed "s/[0-9]/./g"' S M Tu W Th F S -'echo 1 2 3 4 | sed 's/[0-9]/./g'' +'echo 1 2 3 4 | sed "s/[0-9]/./g"' . . . . -'echo 5 6 7 8 9 10 11 | sed 's/[0-9]/./g'' +'echo 5 6 7 8 9 10 11 | sed "s/[0-9]/./g"' . . . . . .. .. -'echo 12 13 14 15 16 17 18 | sed 's/[0-9]/./g'' +'echo 12 13 14 15 16 17 18 | sed "s/[0-9]/./g"' .. .. .. .. .. .. .. -'echo 19 20 21 22 23 24 25 | sed 's/[0-9]/./g'' +'echo 19 20 21 22 23 24 25 | sed "s/[0-9]/./g"' .. .. .. .. .. .. .. -'echo 26 27 28 29 30 31 | sed 's/[0-9]/./g'' +'echo 26 27 28 29 30 31 | sed "s/[0-9]/./g"' .. .. .. .. .. .. -'echo | sed 's/[0-9]/./g'' +'echo | sed "s/[0-9]/./g"' diff --git a/test/printlang.awk b/test/printlang.awk new file mode 100644 index 00000000..03e06c0e --- /dev/null +++ b/test/printlang.awk @@ -0,0 +1,4 @@ +BEGIN { + printf "\nLocale environment:\n\tLC_ALL=\"%s\" LANG=\"%s\"\n\n", + ENVIRON["LC_ALL"], ENVIRON["LANG"] +} diff --git a/test/rsnulbig.ok b/test/rsnulbig.ok new file mode 100644 index 00000000..10a52093 --- /dev/null +++ b/test/rsnulbig.ok @@ -0,0 +1 @@ +16386 diff --git a/test/rsnulbig2.ok b/test/rsnulbig2.ok new file mode 100644 index 00000000..0cfbf088 --- /dev/null +++ b/test/rsnulbig2.ok @@ -0,0 +1 @@ +2 diff --git a/test/rstest3.awk b/test/rstest3.awk new file mode 100644 index 00000000..3238ffa2 --- /dev/null +++ b/test/rstest3.awk @@ -0,0 +1,73 @@ +# From spcecdt@armory.com Tue Apr 15 17:35:01 2003 +# Return-Path: <spcecdt@armory.com> +# Received: from localhost (aahz [127.0.0.1]) +# by skeeve.com (8.12.5/8.12.5) with ESMTP id h3FEYA6o001541 +# for <arnold@localhost>; Tue, 15 Apr 2003 17:35:01 +0300 +# Received: from actcom.co.il [192.114.47.1] +# by localhost with POP3 (fetchmail-5.9.0) +# for arnold@localhost (single-drop); Tue, 15 Apr 2003 17:35:01 +0300 (IDT) +# Received: by actcom.co.il (mbox arobbins) +# (with Cubic Circle's cucipop (v1.31 1998/05/13) Tue Apr 15 17:38:46 2003) +# X-From_: spcecdt@armory.com Tue Apr 15 11:09:12 2003 +# Received: from smtp1.actcom.net.il by actcom.co.il with ESMTP +# (8.11.6/actcom-0.2) id h3F88uC19825 for <arobbins@actcom.co.il>; +# Tue, 15 Apr 2003 11:09:04 +0300 (EET DST) +# (rfc931-sender: smtp.actcom.co.il [192.114.47.13]) +# Received: from f7.net (consort.superb.net [209.61.216.22]) +# by smtp1.actcom.net.il (8.12.8/8.12.8) with ESMTP id h3F8CgQ7019081 +# for <arobbins@actcom.co.il>; Tue, 15 Apr 2003 11:12:47 +0300 +# Received: from fencepost.gnu.org (fencepost.gnu.org [199.232.76.164]) +# by f7.net (8.11.7/8.11.6) with ESMTP id h3F88oW23381 +# for <arnold@skeeve.com>; Tue, 15 Apr 2003 04:08:50 -0400 +# Received: from monty-python.gnu.org ([199.232.76.173]) +# by fencepost.gnu.org with esmtp (Exim 4.10) +# id 195LUo-0001cv-00 +# for bug-gawk@gnu.org; Tue, 15 Apr 2003 04:08:50 -0400 +# Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) +# id 195LUh-0006n0-00 +# for bug-gawk@gnu.org; Tue, 15 Apr 2003 04:08:44 -0400 +# Received: from deepthought.armory.com ([192.122.209.42] helo=armory.com) +# by monty-python.gnu.org with smtp (Exim 4.10.13) +# id 195LUC-0006JM-00 +# for bug-gawk@gnu.org; Tue, 15 Apr 2003 04:08:13 -0400 +# Date: Tue, 15 Apr 2003 01:08:11 -0700 +# From: "John H. DuBois III" <spcecdt@armory.com> +# To: bug-gawk@gnu.org +# Subject: gawk 3.1.2 fatal bug +# Message-ID: <20030415080811.GA14963@armory.com> +# Mime-Version: 1.0 +# Content-Type: text/plain; charset=us-ascii +# Content-Disposition: inline +# User-Agent: Mutt/1.3.28i +# X-Www: http://www.armory.com./~spcecdt/ +# Sender: spcecdt@armory.com +# X-Spam-Status: No, hits=-7.9 required=5.0 +# tests=SIGNATURE_SHORT_DENSE,SPAM_PHRASE_01_02,USER_AGENT, +# USER_AGENT_MUTT +# version=2.41 +# X-Spam-Level: +# X-SpamBouncer: 1.4 (10/07/01) +# X-SBClass: OK +# Status: RO +# +# This program: +# +# BEGIN { RS = ""; "/bin/echo -n x" | getline } +# +# fails in exactly the same way under SCO OpenServer 5.0.6a using gawk 3.1.2 +# built with gcc 2.95.3 and linux using gawk 3.1.2 built with gcc 3.2.2: +# +# gawk: gawktest:1: fatal error: internal error +# Abort +# +# The same program does not fail with gawk 3.1.1. +# +# John +# -- +# John DuBois spcecdt@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/ +# +# +BEGIN { + RS = "" + "echo x | tr -d '\\12'" | getline +} diff --git a/test/rstest3.ok b/test/rstest3.ok new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/rstest3.ok diff --git a/test/rstest4.awk b/test/rstest4.awk new file mode 100644 index 00000000..ddf06917 --- /dev/null +++ b/test/rstest4.awk @@ -0,0 +1,67 @@ +# From spcecdt@armory.com Mon May 5 14:37:09 2003 +# Return-Path: <spcecdt@armory.com> +# Received: from localhost (skeeve [127.0.0.1]) +# by skeeve.com (8.12.5/8.12.5) with ESMTP id h45B1GvT031993 +# for <arnold@localhost>; Mon, 5 May 2003 14:37:09 +0300 +# Received: from actcom.co.il [192.114.47.1] +# by localhost with POP3 (fetchmail-5.9.0) +# for arnold@localhost (single-drop); Mon, 05 May 2003 14:37:09 +0300 (IDT) +# Received: by actcom.co.il (mbox arobbins) +# (with Cubic Circle's cucipop (v1.31 1998/05/13) Mon May 5 14:35:11 2003) +# X-From_: spcecdt@armory.com Mon May 5 12:20:20 2003 +# Received: from smtp1.actcom.net.il by actcom.co.il with ESMTP +# (8.11.6/actcom-0.2) id h459KC529186 for <arobbins@actcom.co.il>; +# Mon, 5 May 2003 12:20:15 +0300 (EET DST) +# (rfc931-sender: smtp.actcom.co.il [192.114.47.13]) +# Received: from f7.net (consort.superb.net [209.61.216.22]) +# by smtp1.actcom.net.il (8.12.8/8.12.8) with ESMTP id h459LMfl025854 +# for <arobbins@actcom.co.il>; Mon, 5 May 2003 12:21:24 +0300 +# Received: from armory.com (deepthought.armory.com [192.122.209.42]) +# by f7.net (8.11.7/8.11.6) with SMTP id h459K9I26841 +# for <arnold@skeeve.com>; Mon, 5 May 2003 05:20:09 -0400 +# Date: Mon, 5 May 2003 02:20:08 -0700 +# From: "John H. DuBois III" <spcecdt@armory.com> +# To: Aharon Robbins <arnold@skeeve.com> +# Subject: Re: gawk 3.1.2b now available +# Message-ID: <20030505092008.GA15970@armory.com> +# References: <200305041149.h44BnLcm005484@localhost.localdomain> +# Mime-Version: 1.0 +# Content-Type: text/plain; charset=us-ascii +# Content-Disposition: inline +# In-Reply-To: <200305041149.h44BnLcm005484@localhost.localdomain> +# User-Agent: Mutt/1.3.28i +# X-Www: http://www.armory.com./~spcecdt/ +# Sender: spcecdt@armory.com +# X-SpamBouncer: 1.4 (10/07/01) +# X-SBClass: OK +# Status: RO +# +# This is a curious one: +# +# gawk-3.1.2b 'BEGIN { +# while (("echo" | getline) == 1) +# ; +# RS = "" +# "echo \"a\n\nb\"" | getline y +# print x +# }' | hd +# +# The output is: +# +# 0000 00 13 0a ... +# 0003 +# +# (the uninitialized variable 'x' is somehow getting the value <null><control-S>) +# +# John +# -- +# John DuBois spcecdt@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/ +# +BEGIN { + while (("echo" | getline) == 1) + ; + RS = "" + "echo \"a\n\nb\"" | getline y + printf "y = <%s>\n", y # ADR + printf "x = <%s>\n", x # ADR +} diff --git a/test/rstest4.ok b/test/rstest4.ok new file mode 100644 index 00000000..430442fb --- /dev/null +++ b/test/rstest4.ok @@ -0,0 +1,2 @@ +y = <a> +x = <> diff --git a/test/rstest5.awk b/test/rstest5.awk new file mode 100644 index 00000000..09abb4a0 --- /dev/null +++ b/test/rstest5.awk @@ -0,0 +1,60 @@ +# From spcecdt@armory.com Tue May 6 13:42:34 2003 +# Return-Path: <spcecdt@armory.com> +# Received: from localhost (aahz [127.0.0.1]) +# by skeeve.com (8.12.5/8.12.5) with ESMTP id h46AgG53003519 +# for <arnold@localhost>; Tue, 6 May 2003 13:42:34 +0300 +# Received: from actcom.co.il [192.114.47.1] +# by localhost with POP3 (fetchmail-5.9.0) +# for arnold@localhost (single-drop); Tue, 06 May 2003 13:42:34 +0300 (IDT) +# Received: by actcom.co.il (mbox arobbins) +# (with Cubic Circle's cucipop (v1.31 1998/05/13) Tue May 6 13:48:46 2003) +# X-From_: spcecdt@armory.com Tue May 6 13:26:09 2003 +# Received: from smtp1.actcom.net.il by actcom.co.il with ESMTP +# (8.11.6/actcom-0.2) id h46AQ6520133 for <arobbins@actcom.co.il>; +# Tue, 6 May 2003 13:26:07 +0300 (EET DST) +# (rfc931-sender: lmail.actcom.co.il [192.114.47.13]) +# Received: from f7.net (consort.superb.net [209.61.216.22]) +# by smtp1.actcom.net.il (8.12.8/8.12.8) with ESMTP id h46ARSfl010998 +# for <arobbins@actcom.co.il>; Tue, 6 May 2003 13:27:31 +0300 +# Received: from armory.com (deepthought.armory.com [192.122.209.42]) +# by f7.net (8.11.7/8.11.6) with SMTP id h46AQ1I18183 +# for <arnold@skeeve.com>; Tue, 6 May 2003 06:26:01 -0400 +# Date: Tue, 6 May 2003 03:25:59 -0700 +# From: "John H. DuBois III" <spcecdt@armory.com> +# To: Aharon Robbins <arnold@skeeve.com> +# Subject: Re: gawk 3.1.2b now available +# Message-ID: <20030506102559.GA16105@armory.com> +# References: <200305051157.h45Bv4XO003106@localhost.localdomain> +# Mime-Version: 1.0 +# Content-Type: text/plain; charset=us-ascii +# Content-Disposition: inline +# In-Reply-To: <200305051157.h45Bv4XO003106@localhost.localdomain> +# User-Agent: Mutt/1.3.28i +# X-Www: http://www.armory.com./~spcecdt/ +# Sender: spcecdt@armory.com +# X-SpamBouncer: 1.4 (10/07/01) +# X-SBClass: OK +# Status: RO +# +# The patch fixed the previous case, but here's another one - this prints +# <null><control-S>: +# +# BEGIN { +# RS = "" +# "echo 'foo\n\nbaz'" | getline +# "echo 'foo\n\nbaz'" | getline +# "echo 'bar\n\nbaz'" | getline +# print x +# } +# +# John +# -- +# John DuBois spcecdt@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/ +# +BEGIN { + RS = "" + "echo 'foo\n\nbaz'" | getline ; print + "echo 'foo\n\nbaz'" | getline ; print + "echo 'bar\n\nbaz'" | getline ; print + printf "x = <%s>\n", x +} diff --git a/test/rstest5.ok b/test/rstest5.ok new file mode 100644 index 00000000..bf451511 --- /dev/null +++ b/test/rstest5.ok @@ -0,0 +1,4 @@ +foo +baz +bar +x = <> diff --git a/test/scalar.awk b/test/scalar.awk new file mode 100644 index 00000000..9027389b --- /dev/null +++ b/test/scalar.awk @@ -0,0 +1,4 @@ +BEGIN{ + sub(/x/,"",a) + a[1] +} diff --git a/test/scalar.ok b/test/scalar.ok new file mode 100644 index 00000000..6aea31a7 --- /dev/null +++ b/test/scalar.ok @@ -0,0 +1,2 @@ +gawk: scalar.awk:3: fatal: attempt to use scalar `a' as array +EXIT CODE: 2 diff --git a/test/sortempty.awk b/test/sortempty.awk new file mode 100644 index 00000000..6848d953 --- /dev/null +++ b/test/sortempty.awk @@ -0,0 +1 @@ +BEGIN { print asort(a) } diff --git a/test/sortempty.ok b/test/sortempty.ok new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/test/sortempty.ok @@ -0,0 +1 @@ +0 diff --git a/test/strftime.awk b/test/strftime.awk index 8c1f401a..775cd4e5 100644 --- a/test/strftime.awk +++ b/test/strftime.awk @@ -6,10 +6,14 @@ # on cygwin, where the timezone field is empty and there # are two consecutive blanks. +# Additional mucking about to lop off the seconds field; +# helps decrease chance of difference due to a second boundary + { $3 = sprintf("%02d", $3 + 0) + $4 = substr($4, 1, 5) print > "strftime.ok" - $0 = strftime() + $0 = strftime("%a %b %d %H:%M %Z %Y") $NF = $NF print > OUTPUT } diff --git a/test/strtonum.awk b/test/strtonum.awk new file mode 100644 index 00000000..22ad41e2 --- /dev/null +++ b/test/strtonum.awk @@ -0,0 +1,6 @@ +BEGIN { + print strtonum("0x13") + print strtonum("013") + print strtonum("13") + print strtonum(13) +} diff --git a/test/strtonum.ok b/test/strtonum.ok new file mode 100644 index 00000000..9d1e557b --- /dev/null +++ b/test/strtonum.ok @@ -0,0 +1,4 @@ +19 +11 +13 +13 diff --git a/test/switch2.awk b/test/switch2.awk new file mode 100644 index 00000000..f788edbd --- /dev/null +++ b/test/switch2.awk @@ -0,0 +1,59 @@ +# From spcecdt@armory.com Tue Jun 3 11:41:49 2003 +# Return-Path: <spcecdt@armory.com> +# Received: from localhost (skeeve [127.0.0.1]) +# by skeeve.com (8.12.5/8.12.5) with ESMTP id h538fVuW018115 +# for <arnold@localhost>; Tue, 3 Jun 2003 11:41:49 +0300 +# Received: from actcom.co.il [192.114.47.1] +# by localhost with POP3 (fetchmail-5.9.0) +# for arnold@localhost (single-drop); Tue, 03 Jun 2003 11:41:49 +0300 (IDT) +# Received: by actcom.co.il (mbox arobbins) +# (with Cubic Circle's cucipop (v1.31 1998/05/13) Tue Jun 3 11:41:37 2003) +# X-From_: spcecdt@armory.com Mon Jun 2 20:17:30 2003 +# Received: from smtp1.actcom.net.il by actcom.co.il with ESMTP +# (8.11.6/actcom-0.2) id h52HHNY23516 for <arobbins@actcom.co.il>; +# Mon, 2 Jun 2003 20:17:24 +0300 (EET DST) +# (rfc931-sender: mail.actcom.co.il [192.114.47.13]) +# Received: from f7.net (consort.superb.net [209.61.216.22]) +# by smtp1.actcom.net.il (8.12.8/8.12.8) with ESMTP id h52HIHqv028728 +# for <arobbins@actcom.co.il>; Mon, 2 Jun 2003 20:18:18 +0300 +# Received: from armory.com (deepthought.armory.com [192.122.209.42]) +# by f7.net (8.11.7/8.11.6) with SMTP id h52HHKl31637 +# for <arnold@skeeve.com>; Mon, 2 Jun 2003 13:17:20 -0400 +# Date: Mon, 2 Jun 2003 10:17:11 -0700 +# From: "John H. DuBois III" <spcecdt@armory.com> +# To: arnold@skeeve.com +# Subject: gawk 3.1.2c coredump +# Message-ID: <20030602171711.GA3958@armory.com> +# Mime-Version: 1.0 +# Content-Type: text/plain; charset=us-ascii +# Content-Disposition: inline +# User-Agent: Mutt/1.3.28i +# X-Www: http://www.armory.com./~spcecdt/ +# Sender: spcecdt@armory.com +# X-SpamBouncer: 1.4 (10/07/01) +# X-SBClass: OK +# Status: R +# +#!/usr/local/bin/gawk -f +BEGIN { + switch (substr("x",1,1)) { + case /ask.com/: + break + case "google": + break + } +} +# +# The stack says: +# +# #0 0x0806fac2 in r_tree_eval (tree=0x8092000, iscond=0) at eval.c:813 +# #1 0x08070413 in r_tree_eval (tree=0x0, iscond=0) at eval.c:1071 +# #2 0x08070413 in r_tree_eval (tree=0x8092000, iscond=0) at eval.c:1071 +# #3 0x08070413 in r_tree_eval (tree=0x8092000, iscond=0) at eval.c:1071 +# [ this continues on indefinitely - I suppose it ran out of stack eventually ] +# +# John +# -- +# John DuBois spcecdt@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/ +# +# diff --git a/test/uninit3.awk b/test/uninit3.awk new file mode 100644 index 00000000..d0140d54 --- /dev/null +++ b/test/uninit3.awk @@ -0,0 +1,7 @@ +function f(x){ + print x +} + +BEGIN { + f(x) +} diff --git a/test/uninit3.ok b/test/uninit3.ok new file mode 100644 index 00000000..a98ddb04 --- /dev/null +++ b/test/uninit3.ok @@ -0,0 +1,3 @@ +gawk: uninit3.awk:8: warning: function `f': parameter `x' shadows global variable +gawk: uninit3.awk:2: warning: reference to uninitialized variable `x' + diff --git a/test/uninit4.awk b/test/uninit4.awk new file mode 100644 index 00000000..89de7322 --- /dev/null +++ b/test/uninit4.awk @@ -0,0 +1,13 @@ +# test whether --lint catches uninitialized fields: +function pr() +{ + print +} + +BEGIN { + pr() + print $0 + print $(1-1) + print $1 + NF=3; print $2 +} diff --git a/test/uninit4.ok b/test/uninit4.ok new file mode 100644 index 00000000..3ea4da30 --- /dev/null +++ b/test/uninit4.ok @@ -0,0 +1,10 @@ +gawk: uninit4.awk:4: warning: reference to uninitialized field `$0' + +gawk: uninit4.awk:9: warning: reference to uninitialized field `$0' + +gawk: uninit4.awk:10: warning: reference to uninitialized field `$0' + +gawk: uninit4.awk:11: warning: reference to uninitialized field `$1' + +gawk: uninit4.awk:12: warning: reference to uninitialized field `$2' + diff --git a/test/whiny.awk b/test/whiny.awk new file mode 100644 index 00000000..dc86694b --- /dev/null +++ b/test/whiny.awk @@ -0,0 +1,5 @@ +{ word[$0]++ } +END { + for (i in word) + print i +} diff --git a/test/whiny.in b/test/whiny.in new file mode 100644 index 00000000..6c8a2e3a --- /dev/null +++ b/test/whiny.in @@ -0,0 +1,178 @@ +gawk +pattern +scanning +and +processing +language +or +style +options +file +or +style +options +file +or +style +options +file +or +style +options +file +is +the +Project's +implementation +of +the +programming +language. +It +conforms +to +the +definition +of +the +language +in +the +Command +Language +And +Utilities +Standard. +This +version +in +turn +is +based +on +the +description +in +by +Aho, +Kernighan, +and +Weinberger, +with +the +additional +features +found +in +the +System +V +Release +version +of +also +provides +more +recent +Bell +Laboratories +extensions, +and +a +number +of +extensions. +is +the +profiling +version +of +It +is +identical +in +every +way +to +except +that +programs +run +more +slowly, +and +it +automatically +produces +an +execution +profile +in +the +file +when +done. +See +the +option, +below. +The +command +line +consists +of +options +to +itself, +the +program +text +not +supplied +via +the +or +options), +and +values +to +be +made +available +in +the +and +pre-defined +variables. +options +may +be +either +traditional +one +letter +options, +or +style +long +options. +options +start +with +a +single +while +long +options +start +with +Long +options +are +provided +for +both +features +and +for +features. diff --git a/test/whiny.ok b/test/whiny.ok new file mode 100644 index 00000000..973aa5d3 --- /dev/null +++ b/test/whiny.ok @@ -0,0 +1,108 @@ +Aho, +And +Bell +Command +It +Kernighan, +Laboratories +Language +Long +Project's +Release +See +Standard. +System +The +This +Utilities +V +Weinberger, +a +additional +also +an +and +are +automatically +available +based +be +below. +both +by +command +conforms +consists +definition +description +done. +either +every +except +execution +extensions, +extensions. +features +features. +file +for +found +gawk +identical +implementation +in +is +it +itself, +language +language. +letter +line +long +made +may +more +not +number +of +on +one +option, +options +options), +options, +options. +or +pattern +pre-defined +processing +produces +profile +profiling +program +programming +programs +provided +provides +recent +run +scanning +single +slowly, +start +style +supplied +text +that +the +to +traditional +turn +values +variables. +version +via +way +when +while +with |