Commit 5ae88af9 authored by Carl Worth's avatar Carl Worth

test suite: Add expected output for every test.

Rather than using the (munged) output of "gcc -E" we now capture
precisely the output we expect from every test case. This allows us to
stay immune from strange output from gcc (unpredictable whitespace
output---aprticularly with different gcc versions).

This will also allow us to write tests that capture expected error
messages from the preprocessor as well.
parent 14c98a56
......@@ -4,7 +4,4 @@ glcpp-parse.c
glcpp-parse.h
*.o
*~
tests/*.expected
tests/*.gcc
tests/*.glcpp
tests/*.out
......@@ -22,4 +22,4 @@ test: glcpp
clean:
rm -f glcpp glcpp-lex.c glcpp-parse.c *.o *~
rm -f tests/*.out tests/*.gcc tests/*.expected tests/*~
rm -f tests/*.out tests/*~
one fish,two fish,red fish,blue fish
(argument(including parens)for the win)
success_1
success_2
success_1
success_2
success_3
success_1
success_2
success_3
success_1
success_2
success_3
success_1
success_3
success_4
success_1
success_2
success_3
success_1
success_2
success_3
success_1
success_2
success_3
success_1
success_2
success_3
success_3
success_4
success_5
success_1
success_2
success_3
success_4
success_1
success_2
success_3
success_1
success_2
success_3
success_4
success_5
success_6
f = g /h;
l();
m = n
+ p;
more code here
are not treated like comments.
f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1);
f(2 * (2 +(3,4)-0,1)) | f(2 * (~ 5)) & f(2 * (0,1))^m(0,1);
int i[] = { 1, 23, 4, 5, };
......@@ -2,9 +2,6 @@
for test in *.c; do
echo "Testing $test"
../glcpp < $test > $test.glcpp
grep -v '^ *$' < $test.glcpp > $test.out || true
gcc -E $test -o $test.gcc
grep -v '^#' < $test.gcc | grep -v '^$' | sed -r -e 's/^ +/ /' > $test.expected || true
../glcpp < $test > $test.out
diff -u $test.expected $test.out
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment