aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt90
-rw-r--r--test/ChangeLog25
-rw-r--r--test/Makefile.am4
-rw-r--r--test/Makefile.in9
-rw-r--r--test/Maketests5
-rw-r--r--test/asortbool.awk19
-rw-r--r--test/asortbool.ok6
-rw-r--r--test/dumpvars.ok2
-rw-r--r--test/functab5.ok1
-rw-r--r--test/id.ok1
-rw-r--r--test/intest.awk4
-rw-r--r--test/rwarray.awk11
-rw-r--r--test/symtab11.ok1
-rw-r--r--test/symtab8.ok2
14 files changed, 84 insertions, 96 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
deleted file mode 100644
index fee5eeca..00000000
--- a/test/CMakeLists.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-#
-# test/CMakeLists.txt --- CMake input file for gawk
-#
-# Copyright (C) 2013
-# the Free Software Foundation, Inc.
-#
-# This file is part of GAWK, the GNU implementation of the
-# AWK Programming Language.
-#
-# GAWK is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# GAWK is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-#
-
-## process this file with CMake to produce Makefile
-
-if(WIN32)
- set(SHELL_PREFIX "C:\\MinGW\\msys\\1.0\\bin\\sh")
-endif()
-
-# Find the names of the groups of tests in Makefile.am.
-file(READ ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.am ALL_GROUPS)
-string(REGEX MATCHALL "[A-Z_]*_TESTS " ALL_GROUPS "${ALL_GROUPS}")
-string(REGEX REPLACE "_TESTS " ";" ALL_GROUPS "${ALL_GROUPS}")
-# For each group of test cases, search through Makefile.am and find the test cases.
-foreach(testgroup ${ALL_GROUPS} )
- file(READ ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.am ONE_GROUP)
- string(REGEX MATCH "${testgroup}_TESTS = [a-z0-9_ \\\n\t]*" ONE_GROUP "${ONE_GROUP}")
- string(REGEX REPLACE "${testgroup}_TESTS = " "" ONE_GROUP "${ONE_GROUP}")
- string(REGEX REPLACE "[\\\n\t]" "" ONE_GROUP "${ONE_GROUP}")
- string(REGEX REPLACE " " ";" ONE_GROUP "${ONE_GROUP}")
- # Use each name of a test case to start a script that executes the test case.
- foreach(testcase ${ONE_GROUP} )
- add_test("${testgroup}.${testcase}" ${SHELL_PREFIX} ${CMAKE_SOURCE_DIR}/cmake/basictest ${CMAKE_BINARY_DIR}/gawk${CMAKE_EXECUTABLE_SUFFIX} ${testcase})
- endforeach(testcase)
-endforeach(testgroup)
-
-# Create an empty configuration file for customizing test execution.
-set(CTestCustom ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
-file(WRITE ${CTestCustom} "# DO NOT EDIT, THIS FILE WILL BE OVERWRITTEN\n" )
-# Test case SHLIB.filefuncs needs a file named gawkapi.o in source directory.
-file(APPEND ${CTestCustom} "file(COPY ${CMAKE_SOURCE_DIR}/README DESTINATION ${CMAKE_SOURCE_DIR}/gawkapi.o)\n")
-# Exclude test cases from execution that make no sense on a certain platform.
-file(APPEND ${CTestCustom} "set(CTEST_CUSTOM_TESTS_IGNORE\n")
-if(WIN32)
- file(APPEND ${CTestCustom} " BASIC.exitval2\n")
- file(APPEND ${CTestCustom} " BASIC.hsprint\n")
- file(APPEND ${CTestCustom} " BASIC.rstest4\n")
- file(APPEND ${CTestCustom} " BASIC.rstest5\n")
- file(APPEND ${CTestCustom} " UNIX.getlnhd\n")
- file(APPEND ${CTestCustom} " UNIX.pid\n")
- file(APPEND ${CTestCustom} " GAWK_EXT.beginfile1\n")
- file(APPEND ${CTestCustom} " GAWK_EXT.beginfile2\n")
- file(APPEND ${CTestCustom} " GAWK_EXT.clos1way\n")
- file(APPEND ${CTestCustom} " GAWK_EXT.devfd\n")
- file(APPEND ${CTestCustom} " GAWK_EXT.devfd1\n")
- file(APPEND ${CTestCustom} " GAWK_EXT.devfd2\n")
- file(APPEND ${CTestCustom} " GAWK_EXT.getlndir\n")
- file(APPEND ${CTestCustom} " GAWK_EXT.posix\n")
- file(APPEND ${CTestCustom} " GAWK_EXT.pty1\n")
- file(APPEND ${CTestCustom} " INET.inetdayu\n")
- file(APPEND ${CTestCustom} " INET.inetdayt\n")
- file(APPEND ${CTestCustom} " INET.inetechu\n")
- file(APPEND ${CTestCustom} " INET.inetecht\n")
- file(APPEND ${CTestCustom} " MACHINE.double2\n")
- file(APPEND ${CTestCustom} " LOCALE_CHARSET.fmttest\n")
- file(APPEND ${CTestCustom} " LOCALE_CHARSET.lc_num1\n")
- file(APPEND ${CTestCustom} " LOCALE_CHARSET.mbfw1\n")
- file(APPEND ${CTestCustom} " SHLIB.filefuncs\n")
- file(APPEND ${CTestCustom} " SHLIB.fnmatch\n")
- file(APPEND ${CTestCustom} " SHLIB.fork\n")
- file(APPEND ${CTestCustom} " SHLIB.fork2\n")
- file(APPEND ${CTestCustom} " SHLIB.fts\n")
- file(APPEND ${CTestCustom} " SHLIB.functab4\n")
- file(APPEND ${CTestCustom} " SHLIB.readdir\n")
- file(APPEND ${CTestCustom} " SHLIB.revtwoway\n")
- file(APPEND ${CTestCustom} " SHLIB.rwarray\n")
-endif()
-file(APPEND ${CTestCustom} ")\n")
-
diff --git a/test/ChangeLog b/test/ChangeLog
index c3dcd555..4fab85b2 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -49,16 +49,41 @@
2021-05-05 Arnold D. Robbins <arnold@skeeve.com>
+ * CMakeLists.txt: Removed.
+
+2021-05-05 Arnold D. Robbins <arnold@skeeve.com>
+
* Makefile.am (iolint): Fix for out-of-tree builds.
(testext): Ditto
* iolint.ok: Updated.
+2021-05-02 Arnold D. Robbins <arnold@skeeve.com>
+
+ * asortbool.awk, functab5.ok, id.ok, rwarrray.awk,
+ symtab11.ok: Revise after code changes.
+
+2021-04-28 Arnold D. Robbins <arnold@skeeve.com>
+
+ * asortbool.ok: Revise after code changes.
+ * rwarray.awk: Ditto.
+
2021-04-14 Arnold D. Robbins <arnold@skeeve.com>
* noeffect.awk: Add more test cases. Thanks to Wolfgang Laun
<wolfgang.laun@gmail.com>.
* lintwarn.ok, noeffect.ok: Updated after code and test changes.
+2021-03-30 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): asortbool, new test.
+ * asortbool.awk, asortbool.ok: New files.
+ * rwarray.awk: Add test of saving/restoring bool values.
+
+2021-03-08 Arnold D. Robbins <arnold@skeeve.com>
+
+ * dumpvars.ok, functab5.ok, id.ok, intest.awk, symtab11.ok,
+ symtab8.ok: Updated after code changes.
+
2021-02-13 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (EXTRA_DIST): argcasfile, new test.
diff --git a/test/Makefile.am b/test/Makefile.am
index 7ee23813..94dba463 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -133,6 +133,8 @@ EXTRA_DIST = \
assignnumfield.ok \
assignnumfield2.awk \
assignnumfield2.ok \
+ asortbool.awk \
+ asortbool.ok \
awkpath.ok \
back89.awk \
back89.in \
@@ -1432,7 +1434,7 @@ UNIX_TESTS = \
GAWK_EXT_TESTS = \
aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort arraysort2 \
- arraytype \
+ arraytype asortbool \
backw badargs beginfile1 beginfile2 binmode1 \
charasbytes colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \
clos1way6 crlf \
diff --git a/test/Makefile.in b/test/Makefile.in
index 79ca9a3b..18ccdfcb 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -396,6 +396,8 @@ EXTRA_DIST = \
assignnumfield.ok \
assignnumfield2.awk \
assignnumfield2.ok \
+ asortbool.awk \
+ asortbool.ok \
awkpath.ok \
back89.awk \
back89.in \
@@ -1695,7 +1697,7 @@ UNIX_TESTS = \
GAWK_EXT_TESTS = \
aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort arraysort2 \
- arraytype \
+ arraytype asortbool \
backw badargs beginfile1 beginfile2 binmode1 \
charasbytes colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \
clos1way6 crlf \
@@ -4266,6 +4268,11 @@ arraytype:
then $(CMP) "$(srcdir)"/$@-mpfr.ok _$@ && rm -f _$@ ; \
else $(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ ; fi
+asortbool:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
backw:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 12cc1644..ac6c98b6 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1330,6 +1330,11 @@ arraytype:
then $(CMP) "$(srcdir)"/$@-mpfr.ok _$@ && rm -f _$@ ; \
else $(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ ; fi
+asortbool:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
backw:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/asortbool.awk b/test/asortbool.awk
new file mode 100644
index 00000000..3ee02cb2
--- /dev/null
+++ b/test/asortbool.awk
@@ -0,0 +1,19 @@
+BEGIN {
+ a[1] = "foo"
+ a[2] = -45
+ a[3] = 45
+ a[4][1] = 47
+ a[5] = mkbool(1)
+ a[6] = mkbool(0)
+
+ asort(a, b, "@val_type_asc")
+
+ j = length(b)
+ for (i = 1; i <= j; i++) {
+ printf("%d, %s: ", i, typeof(b[i]))
+ if (isarray(b[i]))
+ print b[i][1]
+ else
+ print b[i]
+ }
+}
diff --git a/test/asortbool.ok b/test/asortbool.ok
new file mode 100644
index 00000000..623e417a
--- /dev/null
+++ b/test/asortbool.ok
@@ -0,0 +1,6 @@
+1, number: -45
+2, number|bool: 0
+3, number|bool: 1
+4, number: 45
+5, string: foo
+6, array: 47
diff --git a/test/dumpvars.ok b/test/dumpvars.ok
index 85d1c859..7caecd35 100644
--- a/test/dumpvars.ok
+++ b/test/dumpvars.ok
@@ -9,7 +9,7 @@ FILENAME: "-"
FNR: 3
FPAT: "[^[:space:]]+"
FS: " "
-FUNCTAB: array, 41 elements
+FUNCTAB: array, 42 elements
IGNORECASE: 0
LINT: 0
NF: 1
diff --git a/test/functab5.ok b/test/functab5.ok
index 9ac4295d..d27f1393 100644
--- a/test/functab5.ok
+++ b/test/functab5.ok
@@ -21,6 +21,7 @@ length'
log'
lshift'
match'
+mkbool'
mktime'
or'
patsplit'
diff --git a/test/id.ok b/test/id.ok
index ab4df74a..941d5add 100644
--- a/test/id.ok
+++ b/test/id.ok
@@ -52,6 +52,7 @@ length -> builtin
log -> builtin
lshift -> builtin
match -> builtin
+mkbool -> builtin
mktime -> builtin
or -> builtin
patsplit -> builtin
diff --git a/test/intest.awk b/test/intest.awk
index f030d07a..18e0cc4d 100644
--- a/test/intest.awk
+++ b/test/intest.awk
@@ -1,4 +1,4 @@
BEGIN {
- bool = ((b = 1) in c);
- print bool, b # gawk-3.0.1 prints "0 "; should print "0 1"
+ bool_result = ((b = 1) in c);
+ print bool_result, b # gawk-3.0.1 prints "0 "; should print "0 1"
}
diff --git a/test/rwarray.awk b/test/rwarray.awk
index 86a4b589..eae22304 100644
--- a/test/rwarray.awk
+++ b/test/rwarray.awk
@@ -11,6 +11,9 @@ BEGIN {
split("-2.4", f)
dict[strnum_sub] = f[1]
+ bool_sub = "bool-sub"
+ dict[bool_sub] = mkbool(1)
+
n = asorti(dict, dictindices)
for (i = 1; i <= n; i++)
printf("dict[%s] = %s\n", dictindices[i], dict[dictindices[i]]) > "orig.out"
@@ -51,4 +54,12 @@ BEGIN {
if (typeof(dict[strnum_sub]) != "strnum")
printf("dict[\"%s\"] should be strnum, is %s\n",
strnum_sub, typeof(dict[strnum_sub]));
+
+ if (typeof(dict[bool_sub]) != "number|bool")
+ printf("dict[\"%s\"] should be number|bool, is %s\n",
+ bool_sub, typeof(dict[bool_sub]));
+
+ if ((dict[bool_sub] "") != "1")
+ printf("dict[\"%s\"] should be 1, is %s\n",
+ bool_sub, dict[bool_sub]);
}
diff --git a/test/symtab11.ok b/test/symtab11.ok
index 7d4be46c..c46d3aed 100644
--- a/test/symtab11.ok
+++ b/test/symtab11.ok
@@ -53,6 +53,7 @@ BEGIN -- Functab is next
[log] = log
[lshift] = lshift
[match] = match
+[mkbool] = mkbool
[mktime] = mktime
[or] = or
[patsplit] = patsplit
diff --git a/test/symtab8.ok b/test/symtab8.ok
index da29b585..0cf40fe9 100644
--- a/test/symtab8.ok
+++ b/test/symtab8.ok
@@ -9,7 +9,7 @@ FIELDWIDTHS: ""
FNR: 1
FPAT: "[^[:space:]]+"
FS: " "
-FUNCTAB: array, 41 elements
+FUNCTAB: array, 42 elements
IGNORECASE: 0
LINT: 0
NF: 1