summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWill Estes <westes575@gmail.com>2014-06-24 14:01:53 -0400
committerWill Estes <westes575@gmail.com>2014-11-12 05:14:28 -0500
commit9b9780e3c7fd90bddeb3faebe0743e33089ff119 (patch)
treeaddd823ddf260f411cc226202d7bcda9e85b6d40 /tests
parentaaf002227e8bfb3009092717df6776b3fb1875ca (diff)
refactor cxx_yywrap test for new test suite layout
Diffstat (limited to 'tests')
-rw-r--r--tests/.gitignore2
-rw-r--r--tests/Makefile.am12
-rw-r--r--tests/cxx_yywrap.ll (renamed from tests/test-c++-yywrap/scanner.l)2
-rw-r--r--tests/cxx_yywrap.txt (renamed from tests/test-c++-yywrap/test.input)0
-rw-r--r--tests/test-c++-yywrap/.gitignore6
-rw-r--r--tests/test-c++-yywrap/Makefile.am45
-rwxr-xr-xtests/testwrapper.sh15
7 files changed, 27 insertions, 55 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
index 5e1c540..43248bf 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -31,6 +31,8 @@ cxx_basic
cxx_basic.cc
cxx_multiple_scanners
cxx_multiple_scanners_[12].cc
+cxx_yywrap.i3
+cxx_yywrap.cc
debug_nr
debug_nr.c
debug_r
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6ebafef..346ed10 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -27,7 +27,7 @@ TESTS = $(check_PROGRAMS) options.cn
# automake knows how to distinguish between the various kinds of tests
# we have.
-TEST_EXTENSIONS = .reject .table .direct .cn
+TEST_EXTENSIONS = .reject .table .direct .cn .i3
LOG_COMPILER = $(srcdir)/testwrapper.sh
AM_LOG_FLAGS = -d $(srcdir) -r
@@ -44,9 +44,12 @@ AM_DIRECT_LOG_FLAGS = -d $(srcdir)
CN_LOG_COMPILER=$(srcdir)/options.cn
AM_CN_LOG_FLAGS=$(FLEX)
+I3_LOG_COMPILER=$(srcdir)/testwrapper.sh
+AM_I3_LOG_FLAGS=-i $(srcdir)/cxx_yywrap.txt -i $(srcdir)/cxx_yywrap.txt -i $(srcdir)/cxx_yywrap.txt
+
AM_YFLAGS = -d -p test
-check_PROGRAMS = $(simple_tests) $(reject_tests) $(TABLE_TESTS) $(DIRECT_TESTS)
+check_PROGRAMS = $(simple_tests) $(reject_tests) $(TABLE_TESTS) $(DIRECT_TESTS) $(I3_TESTS)
simple_tests = \
alloc_extra \
@@ -96,6 +99,9 @@ DIRECT_TESTS = \
rescan_nr.direct \
rescan_r.direct
+ I3_TESTS = \
+ cxx_yywrap.i3
+
alloc_extra_SOURCES = alloc_extra.l
array_nr_SOURCES = array_nr.l
array_r_SOURCES = array_r.l
@@ -109,6 +115,7 @@ c_cxx_r_SOURCES = c_cxx_r.lll
ccl_SOURCES = ccl.l
cxx_basic_SOURCES = cxx_basic.ll
cxx_multiple_scanners_SOURCES = cxx_multiple_scanners_main.cc cxx_multiple_scanners_1.ll cxx_multiple_scanners_2.ll
+cxx_yywrap_i3_SOURCES = cxx_yywrap.ll
debug_nr_SOURCES = debug_nr.l
debug_r_SOURCES = debug_r.l
extended_SOURCES = extended.l
@@ -181,6 +188,7 @@ basic_nr.txt \
ccl.txt \
cxx_basic.txt \
cxx_multiple_scanners.txt \
+ cxx_yywrap.txt \
debug_nr.txt \
debug_r.txt \
extended.txt \
diff --git a/tests/test-c++-yywrap/scanner.l b/tests/cxx_yywrap.ll
index 433ad08..0947cec 100644
--- a/tests/test-c++-yywrap/scanner.l
+++ b/tests/cxx_yywrap.ll
@@ -28,7 +28,7 @@
%}
-%option 8bit outfile="scanner.cpp" prefix="test"
+%option 8bit prefix="test"
%option nounput nomain
%option warn c++
diff --git a/tests/test-c++-yywrap/test.input b/tests/cxx_yywrap.txt
index 7288a40..7288a40 100644
--- a/tests/test-c++-yywrap/test.input
+++ b/tests/cxx_yywrap.txt
diff --git a/tests/test-c++-yywrap/.gitignore b/tests/test-c++-yywrap/.gitignore
deleted file mode 100644
index 31ef089..0000000
--- a/tests/test-c++-yywrap/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-Makefile
-Makefile.in
-scanner.cpp
-OUTPUT
-.deps
-test-c++-yywrap
diff --git a/tests/test-c++-yywrap/Makefile.am b/tests/test-c++-yywrap/Makefile.am
deleted file mode 100644
index 014452b..0000000
--- a/tests/test-c++-yywrap/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-# This file is part of flex.
-
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-
-# Neither the name of the University nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-
-# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE.
-
-
-FLEX = $(top_builddir)/flex
-
-EXTRA_DIST = scanner.l test.input
-CLEANFILES = scanner.cpp scanner.h $(testname)$(EXEEXT) OUTPUT $(OBJS)
-OBJS = scanner.o
-
-AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
-LFLAGS = -+
-#LDFLAGS =
-
-testname = test-c++-yywrap
-
-scanner.cpp: $(srcdir)/scanner.l
- $(FLEX) $(LFLAGS) $<
-
-$(testname)$(EXEEXT): $(OBJS)
- $(CXX) $(CXXFLAGS) -o $@ $(LDFLAGS) $(OBJS)
-
-test: $(testname)$(EXEEXT)
- ./$(testname)$(EXEEXT) $(srcdir)/test.input $(srcdir)/test.input $(srcdir)/test.input
-
-.cpp.o:
- $(CXX) $(CXXFLAGS) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $<
diff --git a/tests/testwrapper.sh b/tests/testwrapper.sh
index 97f2a88..2d0b7b7 100755
--- a/tests/testwrapper.sh
+++ b/tests/testwrapper.sh
@@ -6,12 +6,20 @@
INPUT_DIRECTORY=""
INPUT_NAME=""
+INPUT_COUNT=0
USE_REDIRECT=0
while getopts :d:i:rt OPTION ; do
case $OPTION in
d) INPUT_DIRECTORY=$OPTARG ;;
- i) INPUT_NAME="$OPTARG" ;;
+ i)
+ if [ "$INPUT_NAME" == "" ] ; then
+ INPUT_NAME="$OPTARG"
+ else
+ INPUT_NAME="$INPUT_NAME $OPTARG"
+ fi
+ INPUT_COUNT=$(($INPUT_COUNT+1))
+ ;;
r) USE_REDIRECT=1 ;;
t) USE_TABLES=1 ;;
esac
@@ -21,6 +29,11 @@ TESTNAME="${!OPTIND}"
INPUT_NAME=${INPUT_NAME:-`basename $TESTNAME`.txt}
+if [ $INPUT_COUNT -gt 1 ] ; then
+ $TESTNAME ${USE_TABLES:+${INPUT_DIRECTORY}/${TESTNAME}.tables} ${INPUT_NAME}
+ exit $?
+ fi
+
if [ -f ${INPUT_DIRECTORY}/${INPUT_NAME} ] ; then
if [ $USE_REDIRECT == 1 ] ; then
$TESTNAME ${USE_TABLES:+${INPUT_DIRECTORY}/${TESTNAME}.tables} < $INPUT_DIRECTORY/$INPUT_NAME