From 5e5e1e890b276d93f09317883dd7ce8555c6a1a8 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 15 Aug 2014 14:00:22 +0300 Subject: Adjust -L option in usage output, update test. --- test/ChangeLog | 4 ++++ test/badargs.ok | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index d396a049..ba9bef3b 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2014-08-15 Arnold D. Robbins + + * badargs.ok: Adjust after revising text for -L option. + 2014-08-12 Arnold D. Robbins * ofs1.ok: Updated to match corrected behavior in gawk. diff --git a/test/badargs.ok b/test/badargs.ok index 8d34be1f..1664ec1c 100644 --- a/test/badargs.ok +++ b/test/badargs.ok @@ -17,7 +17,7 @@ Short options: GNU long options: (extensions) -h --help -i includefile --include=includefile -l library --load=library - -L [fatal] --lint[=fatal] + -L[fatal|invalid] --lint[=fatal|invalid] -M --bignum -N --use-lc-numeric -n --non-decimal-data -- cgit v1.2.3 From cb92ab7aa657c57446cc9e0087f1364adaac8fee Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 4 Sep 2014 08:52:50 +0300 Subject: Improve printing empty for loop header in profiler. --- test/ChangeLog | 4 ++++ test/profile2.ok | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index ba9bef3b..c6a102b4 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2014-09-04 Arnold D. Robbins + + * profile2.ok: Update after code improvement in profiler. + 2014-08-15 Arnold D. Robbins * badargs.ok: Adjust after revising text for -L option. diff --git a/test/profile2.ok b/test/profile2.ok index fe76a2c9..50c7e190 100644 --- a/test/profile2.ok +++ b/test/profile2.ok @@ -7,7 +7,7 @@ 1 asplit("BEGIN:END:atan2:break:close:continue:cos:delete:" "do:else:exit:exp:for:getline:gsub:if:in:index:int:" "length:log:match:next:print:printf:rand:return:sin:" "split:sprintf:sqrt:srand:sub:substr:system:while", keywords, ":") 1 split("00:00:00:00:00:00:00:00:00:00:" "20:10:10:12:12:11:07:00:00:00:" "08:08:08:08:08:33:08:00:00:00:" "08:44:08:36:08:08:08:00:00:00:" "08:44:45:42:42:41:08", machine, ":") 1 state = 1 - 571 for (; ; ) { + 571 for (;;) { 571 symb = lex() 571 nextstate = substr(machine[state symb], 1, 1) 571 act = substr(machine[state symb], 2, 1) @@ -109,7 +109,7 @@ 571 function lex() { - 1702 for (; ; ) { + 1702 for (;;) { 1702 if (tok == "(eof)") { return 7 } -- cgit v1.2.3 From 611353597e20081bd0c72617e24fa5ff4c63dac1 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 4 Sep 2014 09:38:08 +0300 Subject: Make indirect calls work on built-in and extension functions. --- test/ChangeLog | 2 ++ test/functab4.ok | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index c6a102b4..3d20eaac 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,6 +1,8 @@ 2014-09-04 Arnold D. Robbins * profile2.ok: Update after code improvement in profiler. + * functab4.ok: Update after making indirect calls of + extension functions work. :-) 2014-08-15 Arnold D. Robbins diff --git a/test/functab4.ok b/test/functab4.ok index 70a520b7..8eaab508 100644 --- a/test/functab4.ok +++ b/test/functab4.ok @@ -1,3 +1,2 @@ x = chdir -gawk: functab4.awk:11: fatal: cannot (yet) call extension functions indirectly -EXIT CODE: 2 +we are now in --> /tmp -- cgit v1.2.3 From 16a26e063e9c62bff0478fa210d875c4eed2b7c0 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 5 Sep 2014 08:31:38 +0300 Subject: Portability fix for functab4 test. --- test/ChangeLog | 6 ++++++ test/functab4.awk | 26 +++++++++++++++++++++----- test/functab4.ok | 6 ++++-- 3 files changed, 31 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index 3d20eaac..02580b43 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,9 @@ +2014-09-05 Arnold D. Robbins + + * functab4.awk: Changed to use stat instead of chdir since + /tmp isn't /tmp on all systems (e.g. Mac OS X). Thanks to + Hermann Peifer for the report. + 2014-09-04 Arnold D. Robbins * profile2.ok: Update after code improvement in profiler. diff --git a/test/functab4.awk b/test/functab4.awk index 0d9d4267..196fcc6d 100644 --- a/test/functab4.awk +++ b/test/functab4.awk @@ -6,9 +6,25 @@ function foo() } BEGIN { - x = FUNCTAB["chdir"] - print "x =", x - @x("/tmp") - printf "we are now in --> " - system("/bin/pwd || /usr/bin/pwd") + f = FUNCTAB["foo"] + @f() + + ret1 = stat(".", data1) + print "ret1 =", ret1 + + f = "stat" + ret2 = @f(".", data2) + print "ret2 =", ret2 + + problem = 0 + for (i in data1) { + if (! isarray(data1[i])) { +# print i, data1[i] + if (! (i in data2) || data1[i] != data2[i]) { + printf("mismatch element \"%s\"\n", i) + problems++ + } + } + } + print(problems ? (problems+0) "encountered" : "no problems encountered") } diff --git a/test/functab4.ok b/test/functab4.ok index 8eaab508..2b76cd88 100644 --- a/test/functab4.ok +++ b/test/functab4.ok @@ -1,2 +1,4 @@ -x = chdir -we are now in --> /tmp +foo! +ret1 = 0 +ret2 = 0 +no problems encountered -- cgit v1.2.3 From c30a04c8d3a2eef06338934f577fe3416f40d529 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 5 Sep 2014 08:35:18 +0300 Subject: New test, indirect call of builtin functions. --- test/ChangeLog | 4 ++++ test/Makefile.am | 4 +++- test/Makefile.in | 9 ++++++++- test/Maketests | 5 +++++ test/indirectcall2.awk | 11 +++++++++++ test/indirectcall2.ok | 4 ++++ 6 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 test/indirectcall2.awk create mode 100644 test/indirectcall2.ok (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index 02580b43..ae1232c6 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -4,6 +4,10 @@ /tmp isn't /tmp on all systems (e.g. Mac OS X). Thanks to Hermann Peifer for the report. + Sort of related: + + * indirectcall2.awk, indirectcall2.ok: New files. + 2014-09-04 Arnold D. Robbins * profile2.ok: Update after code improvement in profiler. diff --git a/test/Makefile.am b/test/Makefile.am index ede44523..a4ebe2d5 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -421,6 +421,8 @@ EXTRA_DIST = \ indirectcall.awk \ indirectcall.in \ indirectcall.ok \ + indirectcall2.awk \ + indirectcall2.ok \ inftest.awk \ inftest.ok \ inplace.in \ @@ -1008,7 +1010,7 @@ GAWK_EXT_TESTS = \ gensub gensub2 getlndir gnuops2 gnuops3 gnureops \ icasefs icasers id igncdym igncfs ignrcas2 ignrcase \ incdupe incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 \ - include include2 indirectcall \ + include include2 indirectcall indirectcall2 \ lint lintold lintwarn \ manyfiles match1 match2 match3 mbstr1 \ nastyparm next nondec nondec2 \ diff --git a/test/Makefile.in b/test/Makefile.in index 196e125c..02249f2f 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -667,6 +667,8 @@ EXTRA_DIST = \ indirectcall.awk \ indirectcall.in \ indirectcall.ok \ + indirectcall2.awk \ + indirectcall2.ok \ inftest.awk \ inftest.ok \ inplace.in \ @@ -1253,7 +1255,7 @@ GAWK_EXT_TESTS = \ gensub gensub2 getlndir gnuops2 gnuops3 gnureops \ icasefs icasers id igncdym igncfs ignrcas2 ignrcase \ incdupe incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 \ - include include2 indirectcall \ + include include2 indirectcall indirectcall2 \ lint lintold lintwarn \ manyfiles match1 match2 match3 mbstr1 \ nastyparm next nondec nondec2 \ @@ -3468,6 +3470,11 @@ indirectcall: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +indirectcall2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + lint: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index 0841ae77..5c34af9e 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1082,6 +1082,11 @@ indirectcall: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +indirectcall2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + lint: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/indirectcall2.awk b/test/indirectcall2.awk new file mode 100644 index 00000000..8f3c9483 --- /dev/null +++ b/test/indirectcall2.awk @@ -0,0 +1,11 @@ +BEGIN { + Quarter_pi = 3.1415927 / 4 + print sin(Quarter_pi) + + f = "sin" + print @f(Quarter_pi) + + print substr("abcdefgh", 2, 3) + f = "substr" + print @f("abcdefgh", 2, 3) +} diff --git a/test/indirectcall2.ok b/test/indirectcall2.ok new file mode 100644 index 00000000..05bee4b1 --- /dev/null +++ b/test/indirectcall2.ok @@ -0,0 +1,4 @@ +0.707107 +0.707107 +bcd +bcd -- cgit v1.2.3 From 0f5cb955662136ad4a93e35db5721dd986dfd55b Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 5 Sep 2014 11:21:38 +0300 Subject: Add builtin functions to FUNCTAB and PROCINFO["identifiers"] and doc. --- test/ChangeLog | 1 + test/id.ok | 80 +++++++++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 61 insertions(+), 20 deletions(-) (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index ae1232c6..fce42e04 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -7,6 +7,7 @@ Sort of related: * indirectcall2.awk, indirectcall2.ok: New files. + * id.ok: Updated. 2014-09-04 Arnold D. Robbins diff --git a/test/id.ok b/test/id.ok index d31573de..a9f540e7 100644 --- a/test/id.ok +++ b/test/id.ok @@ -1,32 +1,72 @@ -FUNCTAB -> array -ARGV -> array -SYMTAB -> array -ORS -> scalar -ROUNDMODE -> scalar -i -> untyped OFS -> scalar +rand -> builtin +ARGC -> scalar +dcgettext -> builtin +gsub -> builtin +PREC -> scalar +match -> builtin +ARGIND -> scalar +int -> builtin ERRNO -> scalar +ARGV -> array +log -> builtin +sprintf -> builtin +ROUNDMODE -> scalar +strftime -> builtin +systime -> builtin +and -> builtin +srand -> builtin FNR -> scalar +asort -> builtin +atan2 -> builtin +cos -> builtin +TEXTDOMAIN -> scalar +ORS -> scalar +split -> builtin +RSTART -> scalar +compl -> builtin +bindtextdomain -> builtin +exp -> builtin +or -> builtin +fflush -> builtin +gensub -> builtin LINT -> scalar +dcngettext -> builtin +index -> builtin IGNORECASE -> scalar -NR -> scalar -function1 -> user -ARGIND -> scalar -NF -> scalar -TEXTDOMAIN -> scalar +system -> builtin CONVFMT -> scalar +sqrt -> builtin +rshift -> builtin +tolower -> builtin +FS -> scalar +BINMODE -> scalar +sin -> builtin +asorti -> builtin FIELDWIDTHS -> scalar -ARGC -> scalar +function1 -> user +FILENAME -> scalar +close -> builtin +mktime -> builtin +FUNCTAB -> array +NF -> scalar +isarray -> builtin an_array -> untyped -PROCINFO -> array -PREC -> scalar +patsplit -> builtin +NR -> scalar SUBSEP -> scalar -FPAT -> scalar -RS -> scalar -FS -> scalar +extension -> builtin +i -> untyped +sub -> builtin OFMT -> scalar RLENGTH -> scalar +substr -> builtin +FPAT -> scalar +RS -> scalar +xor -> builtin RT -> scalar -BINMODE -> scalar -FILENAME -> scalar -RSTART -> scalar +PROCINFO -> array +lshift -> builtin +SYMTAB -> array +strtonum -> builtin +toupper -> builtin -- cgit v1.2.3