diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2015-06-19 12:40:38 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2015-06-19 12:40:38 +0300 |
commit | f7cd8a03c09a00c4cb520f881bbe838cf76e718f (patch) | |
tree | b4089722a537426cf28d607a2eab7e8be01c29d9 | |
parent | 20037f36ee350ee64699d311e4296be1f0367dd2 (diff) | |
download | egawk-f7cd8a03c09a00c4cb520f881bbe838cf76e718f.tar.gz egawk-f7cd8a03c09a00c4cb520f881bbe838cf76e718f.tar.bz2 egawk-f7cd8a03c09a00c4cb520f881bbe838cf76e718f.zip |
Cleanup files and fix up tests for typed regexes and typeof.
-rw-r--r-- | a.awk | 7 | ||||
-rw-r--r-- | test/ChangeLog | 6 | ||||
-rw-r--r-- | test/Makefile.am | 9 | ||||
-rw-r--r-- | test/Makefile.in | 23 | ||||
-rw-r--r-- | test/Maketests | 12 | ||||
-rw-r--r-- | test/gsubind.awk (renamed from z2.awk) | 3 | ||||
-rw-r--r-- | test/gsubind.ok | 3 | ||||
-rw-r--r-- | test/typedregex1.awk (renamed from hardregex-semantics.awk) | 0 | ||||
-rw-r--r-- | test/typedregex1.ok | 37 | ||||
-rw-r--r-- | test/typeof1.awk (renamed from x.awk) | 0 | ||||
-rw-r--r-- | test/typeof1.ok | 7 | ||||
-rw-r--r-- | y.awk | 1 | ||||
-rw-r--r-- | z.awk | 1 | ||||
-rw-r--r-- | z3.awk | 19 |
14 files changed, 94 insertions, 34 deletions
@@ -1,7 +0,0 @@ -BEGIN { - f = "foo" - p = "o+" - fun = "match" - @fun(f, p) - print RSTART, RLENGTH -} diff --git a/test/ChangeLog b/test/ChangeLog index 59b9fd40..b57a756f 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,9 @@ +2015-06-19 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (gsubind, typedregex1, typeof1): New tests. + * gsubind.awk, gsubind.ok, typedregex1.awk, typedregex1.ok, + typeof1.awk, typeof1.ok: New files. + 2015-06-17 Andrew J. Schorr <aschorr@telemetry-investments.com> * inplace1.ok, inplace2.ok, inplace3.ok: Update line number in error diff --git a/test/Makefile.am b/test/Makefile.am index f13fa2fb..537a5655 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -381,6 +381,8 @@ EXTRA_DIST = \ gnureops.ok \ gsubasgn.awk \ gsubasgn.ok \ + gsubind.awk \ + gsubind.ok \ gsubtest.awk \ gsubtest.ok \ gsubtst2.awk \ @@ -979,6 +981,10 @@ EXTRA_DIST = \ tweakfld.awk \ tweakfld.in \ tweakfld.ok \ + typedregex1.awk \ + typedregex1.ok \ + typeof1.awk \ + typeof1.ok \ uninit2.awk \ uninit2.ok \ uninit3.awk \ @@ -1076,7 +1082,7 @@ GAWK_EXT_TESTS = \ colonwarn clos1way crlf dbugeval delsub devfd devfd1 devfd2 dumpvars errno exit \ fieldwdth fpat1 fpat2 fpat3 fpat4 fpatnull fsfwfs funlen \ functab1 functab2 functab3 fwtest fwtest2 fwtest3 \ - genpot gensub gensub2 getlndir gnuops2 gnuops3 gnureops \ + genpot gensub gensub2 getlndir gnuops2 gnuops3 gnureops gsubind \ icasefs icasers id igncdym igncfs ignrcas2 ignrcase \ incdupe incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 \ include include2 indirectbuiltin indirectcall indirectcall2 \ @@ -1093,6 +1099,7 @@ GAWK_EXT_TESTS = \ splitarg4 strftime \ strtonum switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 \ symtab7 symtab8 symtab9 \ + typedregex1 typeof1 timeout EXTRA_TESTS = inftest regtest diff --git a/test/Makefile.in b/test/Makefile.in index 08c04a02..a8895ed7 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -638,6 +638,8 @@ EXTRA_DIST = \ gnureops.ok \ gsubasgn.awk \ gsubasgn.ok \ + gsubind.awk \ + gsubind.ok \ gsubtest.awk \ gsubtest.ok \ gsubtst2.awk \ @@ -1236,6 +1238,10 @@ EXTRA_DIST = \ tweakfld.awk \ tweakfld.in \ tweakfld.ok \ + typedregex1.awk \ + typedregex1.ok \ + typeof1.awk \ + typeof1.ok \ uninit2.awk \ uninit2.ok \ uninit3.awk \ @@ -1332,7 +1338,7 @@ GAWK_EXT_TESTS = \ colonwarn clos1way crlf dbugeval delsub devfd devfd1 devfd2 dumpvars errno exit \ fieldwdth fpat1 fpat2 fpat3 fpat4 fpatnull fsfwfs funlen \ functab1 functab2 functab3 fwtest fwtest2 fwtest3 \ - genpot gensub gensub2 getlndir gnuops2 gnuops3 gnureops \ + genpot gensub gensub2 getlndir gnuops2 gnuops3 gnureops gsubind \ icasefs icasers id igncdym igncfs ignrcas2 ignrcase \ incdupe incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 \ include include2 indirectbuiltin indirectcall indirectcall2 \ @@ -1349,7 +1355,7 @@ GAWK_EXT_TESTS = \ splitarg4 strftime \ strtonum switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 \ symtab7 symtab8 symtab9 \ - timeout + typedregex1 typeof1 EXTRA_TESTS = inftest regtest INET_TESTS = inetdayu inetdayt inetechu inetecht @@ -1591,6 +1597,7 @@ uninstall-am: .PRECIOUS: Makefile + timeout # Message stuff is to make it a little easier to follow. # Make the pass-fail last and dependent on others to avoid @@ -3648,6 +3655,11 @@ gnureops: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +gsubind: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + icasefs: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -3883,7 +3895,12 @@ symtab7: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ -timeout: +typedregex1: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +typeof1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ diff --git a/test/Maketests b/test/Maketests index 017caa76..a674d5d0 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1092,6 +1092,11 @@ gnureops: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +gsubind: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + icasefs: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1327,7 +1332,12 @@ symtab7: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ -timeout: +typedregex1: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +typeof1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ diff --git a/z2.awk b/test/gsubind.awk index 0a597b22..fce0d818 100644 --- a/z2.awk +++ b/test/gsubind.awk @@ -1,7 +1,8 @@ BEGIN { f = "foo" p = @/o/ -// gsub(p, "q", f) + gsub(p, "q", f) + print f fun = "gsub" @fun(p, "q", f) print f diff --git a/test/gsubind.ok b/test/gsubind.ok new file mode 100644 index 00000000..d25f018a --- /dev/null +++ b/test/gsubind.ok @@ -0,0 +1,3 @@ +fqq +gawk: gsubind.awk:7: fatal: gsub: can be called indirectly only with two arguments +EXIT CODE: 2 diff --git a/hardregex-semantics.awk b/test/typedregex1.awk index fc8ba805..fc8ba805 100644 --- a/hardregex-semantics.awk +++ b/test/typedregex1.awk diff --git a/test/typedregex1.ok b/test/typedregex1.ok new file mode 100644 index 00000000..03ef7cfa --- /dev/null +++ b/test/typedregex1.ok @@ -0,0 +1,37 @@ +switch-case: ok +match ~: ok +match !~: ok +variable match ~: ok +variable match !~: ok +variable as numeric value: ok +variable as string value: ok +typeof constant: ok +typeof variable: ok +conversion to number: ok +typeof variable after conversion: ok +match(constant): ok +match(variable): ok +match(constant) indirect: ok +match(variable) indirect: ok +sub(constant): ok +sub(variable): ok +sub(constant) indirect: ok +sub(variable) indirect: ok +gsub(constant): ok +gsub(variable): ok +gsub(constant) indirect: ok +gsub(variable) indirect: ok +gensub(constant): ok +gensub(variable): ok +gensub(constant) indirect: ok +gensub(variable) indirect: ok +gensub(constant) indirect 2: ok +gensub(variable) indirect 2: ok +split(constant): ok +split(variable): ok +split(constant) indirect: ok +split(variable) indirect: ok +patsplit(constant): ok +patsplit(variable): ok +patsplit(constant) indirect: ok +patsplit(variable) indirect: ok diff --git a/x.awk b/test/typeof1.awk index c301030e..c301030e 100644 --- a/x.awk +++ b/test/typeof1.awk diff --git a/test/typeof1.ok b/test/typeof1.ok new file mode 100644 index 00000000..3a2f6a92 --- /dev/null +++ b/test/typeof1.ok @@ -0,0 +1,7 @@ +scalar_n +untyped +regexp +scalar_s +array scalar_n +regexp +regexp @@ -1 +0,0 @@ -BEGIN { f = "foo" ; sub(@/f/, "q", f); print f } @@ -1 +0,0 @@ -BEGIN { f = "foo" ; p = @/o/ ; gsub(p, "q", f); print f } diff --git a/z3.awk b/z3.awk deleted file mode 100644 index 408f5259..00000000 --- a/z3.awk +++ /dev/null @@ -1,19 +0,0 @@ -function testit(count, re, repl, fun, bi, n1, n2) -{ - $0 = "foo" - n1 = gsub(re, repl) - bi = $0 - - $0 = "foo" - fun = "gsub" - n2 = @fun(re, repl) - printf("%d: n1 = %d, bi -> %s, n2 = %d, indirect -> %s\n", - count, n1, bi, n2, $0) -} - -BEGIN { - testit(1, @/o/, "q") - p = @/o/ -stopme() - testit(2, p, "q") -} |