aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/ChangeLog10
-rw-r--r--test/Makefile.am4
-rw-r--r--test/Makefile.in9
-rw-r--r--test/Maketests5
-rw-r--r--test/functab4.awk26
-rw-r--r--test/functab4.ok6
-rw-r--r--test/indirectcall2.awk11
-rw-r--r--test/indirectcall2.ok4
8 files changed, 66 insertions, 9 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index 47835e75..96bd37e9 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,13 @@
+2014-09-05 Arnold D. Robbins <arnold@skeeve.com>
+
+ * 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.
+
+ Sort of related:
+
+ * indirectcall2.awk, indirectcall2.ok: New files.
+
2014-09-04 Arnold D. Robbins <arnold@skeeve.com>
* profile2.ok: Update after code improvement in profiler.
diff --git a/test/Makefile.am b/test/Makefile.am
index f28b381e..3be8b7cb 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 \
@@ -1010,7 +1012,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 f3b537f3..b9753369 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 \
@@ -1255,7 +1257,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 \
@@ -3476,6 +3478,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/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
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