From 385f22a32c3794615d713e519ae290eb09b2c4d2 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 7 Jan 2015 22:07:24 +0200 Subject: Bug fix in regexp parsing. --- test/ChangeLog | 5 +++++ test/Makefile.am | 7 +++++-- test/Makefile.in | 12 ++++++++++-- test/Maketests | 5 +++++ test/regexpbrack.awk | 2 ++ test/regexpbrack.in | 0 test/regexpbrack.ok | 0 7 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 test/regexpbrack.awk create mode 100644 test/regexpbrack.in create mode 100644 test/regexpbrack.ok (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index 8d39af74..95134f6b 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2015-01-07 Arnold D. Robbins + + * Makefile.am (regexpbrack): New test. + * regexpbrack.awk, regexpbrack.in, regexpbrack.ok: New files. + 2014-12-24 Arnold D. Robbins * Makefile.am (badbuild): New test. diff --git a/test/Makefile.am b/test/Makefile.am index b93f851f..df0da10c 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,7 +1,7 @@ # # test/Makefile.am --- automake input file for gawk # -# Copyright (C) 1988-2014 the Free Software Foundation, Inc. +# Copyright (C) 1988-2015 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -742,6 +742,9 @@ EXTRA_DIST = \ regeq.awk \ regeq.in \ regeq.ok \ + regexpbrack.awk \ + regexpbrack.in \ + regexpbrack.ok \ regexprange.awk \ regexprange.ok \ reginttrad.awk \ @@ -999,7 +1002,7 @@ BASIC_TESTS = \ paramdup paramres paramtyp paramuninitglobal parse1 parsefld parseme \ pcntplus posix2008sub prdupval prec printf0 printf1 prmarscl prmreuse \ prt1eval prtoeval \ - rand range1 rebt8b1 redfilnm regeq regexprange regrange reindops \ + rand range1 rebt8b1 redfilnm regeq regexpbrack regexprange regrange reindops \ reparse resplit rri1 rs rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 \ rstest3 rstest4 rstest5 rswhite \ scalar sclforin sclifin sortempty sortglos splitargv splitarr splitdef \ diff --git a/test/Makefile.in b/test/Makefile.in index 7a281eca..5bd39f45 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -17,7 +17,7 @@ # # test/Makefile.am --- automake input file for gawk # -# Copyright (C) 1988-2014 the Free Software Foundation, Inc. +# Copyright (C) 1988-2015 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -989,6 +989,9 @@ EXTRA_DIST = \ regeq.awk \ regeq.in \ regeq.ok \ + regexpbrack.awk \ + regexpbrack.in \ + regexpbrack.ok \ regexprange.awk \ regexprange.ok \ reginttrad.awk \ @@ -1245,7 +1248,7 @@ BASIC_TESTS = \ paramdup paramres paramtyp paramuninitglobal parse1 parsefld parseme \ pcntplus posix2008sub prdupval prec printf0 printf1 prmarscl prmreuse \ prt1eval prtoeval \ - rand range1 rebt8b1 redfilnm regeq regexprange regrange reindops \ + rand range1 rebt8b1 redfilnm regeq regexpbrack regexprange regrange reindops \ reparse resplit rri1 rs rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 \ rstest3 rstest4 rstest5 rswhite \ scalar sclforin sclifin sortempty sortglos splitargv splitarr splitdef \ @@ -3122,6 +3125,11 @@ regeq: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +regexpbrack: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + regexprange: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index e1b92bf9..4104f142 100644 --- a/test/Maketests +++ b/test/Maketests @@ -697,6 +697,11 @@ regeq: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +regexpbrack: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + regexprange: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/regexpbrack.awk b/test/regexpbrack.awk new file mode 100644 index 00000000..136cd194 --- /dev/null +++ b/test/regexpbrack.awk @@ -0,0 +1,2 @@ +/[]+()0-9.,$%/'"-]*$/ +/^[]+()0-9.,$%/'"-]*$/ diff --git a/test/regexpbrack.in b/test/regexpbrack.in new file mode 100644 index 00000000..e69de29b diff --git a/test/regexpbrack.ok b/test/regexpbrack.ok new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3 From f70399532bd105c5f42ca040846aa537a8fa27bc Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 7 Jan 2015 22:12:50 +0200 Subject: Fix count$ in printf for dynamic width/precision. --- test/ChangeLog | 5 +++++ test/Makefile.am | 4 +++- test/Makefile.in | 9 ++++++++- test/Maketests | 5 +++++ test/printfbad4.awk | 5 +++++ test/printfbad4.ok | 2 ++ 6 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 test/printfbad4.awk create mode 100644 test/printfbad4.ok (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index 95134f6b..8d6086b3 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -3,6 +3,11 @@ * Makefile.am (regexpbrack): New test. * regexpbrack.awk, regexpbrack.in, regexpbrack.ok: New files. + Unrelated: + + * Makefile.am (printfbad4): New test. + * printfbad4.awk, printfbad4.ok: New files. + 2014-12-24 Arnold D. Robbins * Makefile.am (badbuild): New test. diff --git a/test/Makefile.am b/test/Makefile.am index df0da10c..12bde88d 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -692,6 +692,8 @@ EXTRA_DIST = \ printfbad2.ok \ printfbad3.awk \ printfbad3.ok \ + printfbad4.awk \ + printfbad4.ok \ printfloat.awk \ printhuge.awk \ printhuge.ok \ @@ -1029,7 +1031,7 @@ GAWK_EXT_TESTS = \ lint lintold lintwarn \ manyfiles match1 match2 match3 mbstr1 \ nastyparm next nondec nondec2 \ - patsplit posix printfbad1 printfbad2 printfbad3 printhuge procinfs \ + patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \ profile1 profile2 profile3 profile4 profile5 profile6 profile7 pty1 \ rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin rsstart1 \ rsstart2 rsstart3 rstest6 shadow sortfor sortu split_after_fpat \ diff --git a/test/Makefile.in b/test/Makefile.in index 5bd39f45..55650e18 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -939,6 +939,8 @@ EXTRA_DIST = \ printfbad2.ok \ printfbad3.awk \ printfbad3.ok \ + printfbad4.awk \ + printfbad4.ok \ printfloat.awk \ printhuge.awk \ printhuge.ok \ @@ -1275,7 +1277,7 @@ GAWK_EXT_TESTS = \ lint lintold lintwarn \ manyfiles match1 match2 match3 mbstr1 \ nastyparm next nondec nondec2 \ - patsplit posix printfbad1 printfbad2 printfbad3 printhuge procinfs \ + patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \ profile1 profile2 profile3 profile4 profile5 profile6 profile7 pty1 \ rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin rsstart1 \ rsstart2 rsstart3 rstest6 shadow sortfor sortu split_after_fpat \ @@ -3590,6 +3592,11 @@ printfbad3: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +printfbad4: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + procinfs: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index 4104f142..5c4c40f9 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1162,6 +1162,11 @@ printfbad3: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +printfbad4: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + procinfs: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/printfbad4.awk b/test/printfbad4.awk new file mode 100644 index 00000000..dd9220ae --- /dev/null +++ b/test/printfbad4.awk @@ -0,0 +1,5 @@ +BEGIN { + for (i = 1; i <= 10; i++) { + printf "%03$*d %2$d \n", 4, 5, i + } +} diff --git a/test/printfbad4.ok b/test/printfbad4.ok new file mode 100644 index 00000000..71eed3d6 --- /dev/null +++ b/test/printfbad4.ok @@ -0,0 +1,2 @@ +gawk: printfbad4.awk:3: fatal: fatal: must use `count$' on all formats or none +EXIT CODE: 2 -- cgit v1.2.3 From b1f63ac08d7da89ac7e8af4df5ca835527fc5b24 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 7 Jan 2015 22:23:19 +0200 Subject: Load PROCINFO and ENVIRON if using extensions. --- test/ChangeLog | 4 ++++ test/testext.ok | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index 8d6086b3..2cc88514 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -8,6 +8,10 @@ * Makefile.am (printfbad4): New test. * printfbad4.awk, printfbad4.ok: New files. + Unrelated: + + * testext.ok: Adjust for code changes. + 2014-12-24 Arnold D. Robbins * Makefile.am (badbuild): New test. diff --git a/test/testext.ok b/test/testext.ok index 9b36bf72..a828ecb2 100644 --- a/test/testext.ok +++ b/test/testext.ok @@ -15,7 +15,7 @@ try_modify_environ: set_array_element of ENVIRON failed try_modify_environ: marking element "testext" for deletion try_del_environ() could not delete element - pass try_del_environ() could not add an element - pass -var_test: sym_lookup of PROCINFO passed - did not get a value +var_test: sym_lookup of PROCINFO passed - got a value! var_test: sym_lookup of ARGC passed - got a value! var_test: sym_update of ARGC failed - correctly var_test: sym_update("testvar") succeeded -- cgit v1.2.3