Add simple test suite.
This commit is contained in:
parent
4e996af1b1
commit
379dc16c5e
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
*.o
|
*.o
|
||||||
*.output
|
*.output
|
||||||
|
*.log
|
||||||
|
*.trs
|
||||||
|
|
||||||
Makefile
|
Makefile
|
||||||
Makefile.in
|
Makefile.in
|
||||||
|
@ -10,7 +10,9 @@ pkgconfig_DATA = libsqlpars.pc
|
|||||||
# TESTS = test/unitester
|
# TESTS = test/unitester
|
||||||
|
|
||||||
# noinst_PROGRAMS = $(TESTS)
|
# noinst_PROGRAMS = $(TESTS)
|
||||||
EXTRA_DIST=sql.y sql.l
|
EXTRA_DIST = sql.y sql.l \
|
||||||
|
test-ok.sh test-fail.sh \
|
||||||
|
fail1.sql ok1.sql
|
||||||
|
|
||||||
sql_SOURCES = exec.c sql-parser.h
|
sql_SOURCES = exec.c sql-parser.h
|
||||||
nodist_sql_SOURCES = sql.c sql.tab.c sql.tab.h sql.lex.h
|
nodist_sql_SOURCES = sql.c sql.tab.c sql.tab.h sql.lex.h
|
||||||
@ -24,3 +26,5 @@ sql.tab.c sql.tab.h: sql.y Makefile
|
|||||||
sql.c sql.lex.h: sql.l Makefile
|
sql.c sql.lex.h: sql.l Makefile
|
||||||
${LEX} -o $@ $<
|
${LEX} -o $@ $<
|
||||||
|
|
||||||
|
TESTS = test-ok.sh test-fail.sh
|
||||||
|
|
||||||
|
1
fail1.sql
Normal file
1
fail1.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
barf
|
1
ok1.sql
Normal file
1
ok1.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
SELECT * FROM foo;
|
12
test-fail.sh
Executable file
12
test-fail.sh
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
for testfn in $srcdir/fail*.sql
|
||||||
|
do
|
||||||
|
cat $testfn | ./sql
|
||||||
|
if [ $? -ne 1 ]
|
||||||
|
then
|
||||||
|
echo "Failed on $testfn"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
12
test-ok.sh
Executable file
12
test-ok.sh
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
for testfn in $srcdir/ok*.sql
|
||||||
|
do
|
||||||
|
cat $testfn | ./sql
|
||||||
|
if [ $? -ne 0 ]
|
||||||
|
then
|
||||||
|
echo "Failed on $testfn"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user