From 3086fc063cb4bec53431b5f1ea9b2341f0aceeb5 Mon Sep 17 00:00:00 2001 From: Will Estes Date: Wed, 4 Jun 2014 19:15:28 -0400 Subject: [PATCH] refactor header_r test for new test suite layout --- tests/.gitignore | 2 + tests/Makefile.am | 14 +++-- .../test.input => header_r.txt} | 0 .../{test-header-r/main.c => header_r_main.c} | 2 +- .../scanner.l => header_r_scanner.l} | 2 +- tests/test-header-r/.gitignore | 6 --- tests/test-header-r/Makefile.am | 54 ------------------- 7 files changed, 15 insertions(+), 65 deletions(-) rename tests/{test-header-r/test.input => header_r.txt} (100%) rename tests/{test-header-r/main.c => header_r_main.c} (98%) rename tests/{test-header-r/scanner.l => header_r_scanner.l} (95%) delete mode 100644 tests/test-header-r/.gitignore delete mode 100644 tests/test-header-r/Makefile.am diff --git a/tests/.gitignore b/tests/.gitignore index 4a9e55d..f7dd131 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -30,3 +30,5 @@ extended extended.c header_nr header_nr_scanner.[ch] +header_r +header_r_scanner.[ch] diff --git a/tests/Makefile.am b/tests/Makefile.am index 1a47e14..4595c88 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -39,7 +39,8 @@ check_PROGRAMS = \ debug_nr \ debug_r \ extended \ - header_nr + header_nr \ + header_r alloc_extra_SOURCES = alloc_extra.l array_nr_SOURCES = array_nr.l @@ -54,6 +55,7 @@ debug_nr_SOURCES = debug_nr.l debug_r_SOURCES = debug_r.l extended_SOURCES = extended.l header_nr_SOURCES = header_nr_scanner.l header_nr_main.c +header_r_SOURCES = header_r_scanner.l header_r_main.c BUILT_SOURCES = \ bison_nr_scanner.h \ @@ -62,7 +64,8 @@ BUILT_SOURCES = \ bison_yylloc_scanner.h \ bison_yylval_parser.h \ bison_yylval_scanner.h \ - header_nr_scanner.h + header_nr_scanner.h \ + header_r_scanner.h EXTRA_DIST = \ README \ @@ -83,7 +86,9 @@ basic_nr.txt \ debug_r.txt \ extended.txt \ header_nr_scanner.h \ - header_nr.txt + header_nr.txt \ + header_r_scanner.h \ + header_r.txt # specify how to process .l files in order to test the flex built by make all @@ -103,3 +108,6 @@ bison_yylval_scanner.h: bison_yylval_scanner.c header_nr_main$(objext): header_nr_scanner.h header_nr_scanner.h: header_nr_scanner.c + +header_r_main$(objext): header_r_scanner.h +header_r_scanner.h: header_r_scanner.c diff --git a/tests/test-header-r/test.input b/tests/header_r.txt similarity index 100% rename from tests/test-header-r/test.input rename to tests/header_r.txt diff --git a/tests/test-header-r/main.c b/tests/header_r_main.c similarity index 98% rename from tests/test-header-r/main.c rename to tests/header_r_main.c index 353a63e..6c3dd8f 100644 --- a/tests/test-header-r/main.c +++ b/tests/header_r_main.c @@ -21,7 +21,7 @@ * PURPOSE. */ -#include "scanner.h" +#include "header_r_scanner.h" /* The scanner itself is not important here. * We simply try to use all the functions that are exported in the diff --git a/tests/test-header-r/scanner.l b/tests/header_r_scanner.l similarity index 95% rename from tests/test-header-r/scanner.l rename to tests/header_r_scanner.l index 9f565c9..3bf53c7 100644 --- a/tests/test-header-r/scanner.l +++ b/tests/header_r_scanner.l @@ -33,7 +33,7 @@ %} %option reentrant -%option 8bit outfile="scanner.c" prefix="test" +%option 8bit prefix="test" header="header_r_scanner.h" %option nounput nomain noyywrap %option warn diff --git a/tests/test-header-r/.gitignore b/tests/test-header-r/.gitignore deleted file mode 100644 index a448111..0000000 --- a/tests/test-header-r/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -scanner.c -scanner.h -test-header-r -OUTPUT diff --git a/tests/test-header-r/Makefile.am b/tests/test-header-r/Makefile.am deleted file mode 100644 index abd22a2..0000000 --- a/tests/test-header-r/Makefile.am +++ /dev/null @@ -1,54 +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 - -builddir = @builddir@ - -EXTRA_DIST = scanner.l test.input main.c -CLEANFILES = scanner.c scanner.h $(testname)$(EXEEXT) OUTPUT $(OBJS) -OBJS = scanner.o main.o - -AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir) -I$(builddir) -#LDFLAGS = $(top_srcdir)/libfl.a -LFLAGS = --header="scanner.h" -#YFLAGS = --defines --output=parser.c - -testname = test-header-r - -scanner.c: $(srcdir)/scanner.l - $(FLEX) $(LFLAGS) $< - -parser.c: $(srcdir)/parser.y - $(BISON) $(YFLAGS) $< - -$(testname)$(EXEEXT): $(OBJS) - $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES) - -test: $(testname)$(EXEEXT) - ./$(testname)$(EXEEXT) < $(srcdir)/test.input - -.c.o: - $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $< - -scanner.h: scanner.c -main.o: scanner.h -- 2.40.0