glcpp: Add several tests for diagnostics.
Which are proving to be useful since some of these tests are not yet acting as desired, (in particular, the unterminated if test is not generating any diagnostic).
This commit is contained in:
2
src/glsl/glcpp/tests/070-undefined-macro-in-expression.c
Normal file
2
src/glsl/glcpp/tests/070-undefined-macro-in-expression.c
Normal file
@@ -0,0 +1,2 @@
|
||||
#if UNDEFINED_MACRO
|
||||
#endif
|
@@ -0,0 +1,2 @@
|
||||
0:1(21): preprocessor error: syntax error, unexpected IDENTIFIER
|
||||
|
1
src/glsl/glcpp/tests/077-else-without-if.c
Normal file
1
src/glsl/glcpp/tests/077-else-without-if.c
Normal file
@@ -0,0 +1 @@
|
||||
#else
|
4
src/glsl/glcpp/tests/077-else-without-if.c.expected
Normal file
4
src/glsl/glcpp/tests/077-else-without-if.c.expected
Normal file
@@ -0,0 +1,4 @@
|
||||
0:1(2): preprocessor error: else without #if
|
||||
|
||||
|
||||
|
1
src/glsl/glcpp/tests/078-elif-without-if.c
Normal file
1
src/glsl/glcpp/tests/078-elif-without-if.c
Normal file
@@ -0,0 +1 @@
|
||||
#elif defined FOO
|
4
src/glsl/glcpp/tests/078-elif-without-if.c.expected
Normal file
4
src/glsl/glcpp/tests/078-elif-without-if.c.expected
Normal file
@@ -0,0 +1,4 @@
|
||||
0:1(2): preprocessor error: elif without #if
|
||||
|
||||
|
||||
|
1
src/glsl/glcpp/tests/079-endif-without-if.c
Normal file
1
src/glsl/glcpp/tests/079-endif-without-if.c
Normal file
@@ -0,0 +1 @@
|
||||
#endif
|
4
src/glsl/glcpp/tests/079-endif-without-if.c.expected
Normal file
4
src/glsl/glcpp/tests/079-endif-without-if.c.expected
Normal file
@@ -0,0 +1,4 @@
|
||||
0:1(2): preprocessor error: #endif without #if
|
||||
|
||||
|
||||
|
4
src/glsl/glcpp/tests/080-if-without-expression.c
Normal file
4
src/glsl/glcpp/tests/080-if-without-expression.c
Normal file
@@ -0,0 +1,4 @@
|
||||
/* Error message for unskipped #if with no expression. */
|
||||
#if
|
||||
#endif
|
||||
|
@@ -0,0 +1,3 @@
|
||||
0:2(1): preprocessor error: #if with no expression
|
||||
|
||||
|
3
src/glsl/glcpp/tests/081-elif-without-expression.c
Normal file
3
src/glsl/glcpp/tests/081-elif-without-expression.c
Normal file
@@ -0,0 +1,3 @@
|
||||
#if 0
|
||||
#elif
|
||||
#endif
|
@@ -0,0 +1,6 @@
|
||||
0:2(1): preprocessor error: #elif with no expression
|
||||
|
||||
|
||||
|
||||
|
||||
|
2
src/glsl/glcpp/tests/082-invalid-paste.c
Normal file
2
src/glsl/glcpp/tests/082-invalid-paste.c
Normal file
@@ -0,0 +1,2 @@
|
||||
#define PASTE(x,y) x ## y
|
||||
PASTE(<,>)
|
5
src/glsl/glcpp/tests/082-invalid-paste.c.expected
Normal file
5
src/glsl/glcpp/tests/082-invalid-paste.c.expected
Normal file
@@ -0,0 +1,5 @@
|
||||
0:2(7): preprocessor error:
|
||||
Pasting "<" and ">" does not give a valid preprocessing token.
|
||||
|
||||
<
|
||||
|
2
src/glsl/glcpp/tests/083-unterminated-if.c
Normal file
2
src/glsl/glcpp/tests/083-unterminated-if.c
Normal file
@@ -0,0 +1,2 @@
|
||||
#if 1
|
||||
|
2
src/glsl/glcpp/tests/084-unbalanced-parentheses.c
Normal file
2
src/glsl/glcpp/tests/084-unbalanced-parentheses.c
Normal file
@@ -0,0 +1,2 @@
|
||||
#define FUNC(x) (2*(x))
|
||||
FUNC(23
|
5
src/glsl/glcpp/tests/085-incorrect-argument-count.c
Normal file
5
src/glsl/glcpp/tests/085-incorrect-argument-count.c
Normal file
@@ -0,0 +1,5 @@
|
||||
#define MULT(x,y) ((x)*(y))
|
||||
MULT()
|
||||
MULT(1)
|
||||
MULT(1,2,3)
|
||||
|
12
src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected
Normal file
12
src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected
Normal file
@@ -0,0 +1,12 @@
|
||||
0:2(1): preprocessor error: Error: macro MULT invoked with 1 arguments (expected 2)
|
||||
|
||||
0:3(1): preprocessor error: Error: macro MULT invoked with 1 arguments (expected 2)
|
||||
|
||||
0:4(1): preprocessor error: Error: macro MULT invoked with 3 arguments (expected 2)
|
||||
|
||||
|
||||
MULT()
|
||||
MULT(1)
|
||||
MULT(1,2,3)
|
||||
|
||||
|
2
src/glsl/glcpp/tests/086-reserved-macro-names.c
Normal file
2
src/glsl/glcpp/tests/086-reserved-macro-names.c
Normal file
@@ -0,0 +1,2 @@
|
||||
#define __BAD reserved
|
||||
#define GL_ALSO_BAD() also reserved
|
7
src/glsl/glcpp/tests/086-reserved-macro-names.c.expected
Normal file
7
src/glsl/glcpp/tests/086-reserved-macro-names.c.expected
Normal file
@@ -0,0 +1,7 @@
|
||||
0:1(10): preprocessor error: Macro names starting with "__" are reserved.
|
||||
|
||||
0:2(9): preprocessor error: Macro names starting with "GL_" are reserved.
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user