summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCarl Worth <[email protected]>2010-08-11 13:48:13 -0700
committerCarl Worth <[email protected]>2010-08-11 14:38:03 -0700
commitcb5ea0c79bd74ea6263d54302ed19c243ceb05de (patch)
tree89b3831c97a0460bda76dfc962cf931a4fe1ec40 /src
parent5a6285cc862df35ef5275c3858f833e0807dee14 (diff)
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).
Diffstat (limited to 'src')
-rw-r--r--src/glsl/glcpp/tests/070-undefined-macro-in-expression.c2
-rw-r--r--src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected2
-rw-r--r--src/glsl/glcpp/tests/077-else-without-if.c1
-rw-r--r--src/glsl/glcpp/tests/077-else-without-if.c.expected4
-rw-r--r--src/glsl/glcpp/tests/078-elif-without-if.c1
-rw-r--r--src/glsl/glcpp/tests/078-elif-without-if.c.expected4
-rw-r--r--src/glsl/glcpp/tests/079-endif-without-if.c1
-rw-r--r--src/glsl/glcpp/tests/079-endif-without-if.c.expected4
-rw-r--r--src/glsl/glcpp/tests/080-if-without-expression.c4
-rw-r--r--src/glsl/glcpp/tests/080-if-without-expression.c.expected3
-rw-r--r--src/glsl/glcpp/tests/081-elif-without-expression.c3
-rw-r--r--src/glsl/glcpp/tests/081-elif-without-expression.c.expected6
-rw-r--r--src/glsl/glcpp/tests/082-invalid-paste.c2
-rw-r--r--src/glsl/glcpp/tests/082-invalid-paste.c.expected5
-rw-r--r--src/glsl/glcpp/tests/083-unterminated-if.c2
-rw-r--r--src/glsl/glcpp/tests/084-unbalanced-parentheses.c2
-rw-r--r--src/glsl/glcpp/tests/085-incorrect-argument-count.c5
-rw-r--r--src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected12
-rw-r--r--src/glsl/glcpp/tests/086-reserved-macro-names.c2
-rw-r--r--src/glsl/glcpp/tests/086-reserved-macro-names.c.expected7
20 files changed, 72 insertions, 0 deletions
diff --git a/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c
new file mode 100644
index 00000000000..b6dc2ba075f
--- /dev/null
+++ b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c
@@ -0,0 +1,2 @@
+#if UNDEFINED_MACRO
+#endif
diff --git a/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected
new file mode 100644
index 00000000000..2bb38a1411e
--- /dev/null
+++ b/src/glsl/glcpp/tests/070-undefined-macro-in-expression.c.expected
@@ -0,0 +1,2 @@
+0:1(21): preprocessor error: syntax error, unexpected IDENTIFIER
+
diff --git a/src/glsl/glcpp/tests/077-else-without-if.c b/src/glsl/glcpp/tests/077-else-without-if.c
new file mode 100644
index 00000000000..81f00bfe278
--- /dev/null
+++ b/src/glsl/glcpp/tests/077-else-without-if.c
@@ -0,0 +1 @@
+#else
diff --git a/src/glsl/glcpp/tests/077-else-without-if.c.expected b/src/glsl/glcpp/tests/077-else-without-if.c.expected
new file mode 100644
index 00000000000..d289b363562
--- /dev/null
+++ b/src/glsl/glcpp/tests/077-else-without-if.c.expected
@@ -0,0 +1,4 @@
+0:1(2): preprocessor error: else without #if
+
+
+
diff --git a/src/glsl/glcpp/tests/078-elif-without-if.c b/src/glsl/glcpp/tests/078-elif-without-if.c
new file mode 100644
index 00000000000..60466b3890a
--- /dev/null
+++ b/src/glsl/glcpp/tests/078-elif-without-if.c
@@ -0,0 +1 @@
+#elif defined FOO
diff --git a/src/glsl/glcpp/tests/078-elif-without-if.c.expected b/src/glsl/glcpp/tests/078-elif-without-if.c.expected
new file mode 100644
index 00000000000..7d41f0ac794
--- /dev/null
+++ b/src/glsl/glcpp/tests/078-elif-without-if.c.expected
@@ -0,0 +1,4 @@
+0:1(2): preprocessor error: elif without #if
+
+
+
diff --git a/src/glsl/glcpp/tests/079-endif-without-if.c b/src/glsl/glcpp/tests/079-endif-without-if.c
new file mode 100644
index 00000000000..69331c3ca9d
--- /dev/null
+++ b/src/glsl/glcpp/tests/079-endif-without-if.c
@@ -0,0 +1 @@
+#endif
diff --git a/src/glsl/glcpp/tests/079-endif-without-if.c.expected b/src/glsl/glcpp/tests/079-endif-without-if.c.expected
new file mode 100644
index 00000000000..08dd33546f2
--- /dev/null
+++ b/src/glsl/glcpp/tests/079-endif-without-if.c.expected
@@ -0,0 +1,4 @@
+0:1(2): preprocessor error: #endif without #if
+
+
+
diff --git a/src/glsl/glcpp/tests/080-if-without-expression.c b/src/glsl/glcpp/tests/080-if-without-expression.c
new file mode 100644
index 00000000000..a27ba36a366
--- /dev/null
+++ b/src/glsl/glcpp/tests/080-if-without-expression.c
@@ -0,0 +1,4 @@
+/* Error message for unskipped #if with no expression. */
+#if
+#endif
+
diff --git a/src/glsl/glcpp/tests/080-if-without-expression.c.expected b/src/glsl/glcpp/tests/080-if-without-expression.c.expected
new file mode 100644
index 00000000000..1a3e383e9ad
--- /dev/null
+++ b/src/glsl/glcpp/tests/080-if-without-expression.c.expected
@@ -0,0 +1,3 @@
+0:2(1): preprocessor error: #if with no expression
+
+
diff --git a/src/glsl/glcpp/tests/081-elif-without-expression.c b/src/glsl/glcpp/tests/081-elif-without-expression.c
new file mode 100644
index 00000000000..79c78663dd3
--- /dev/null
+++ b/src/glsl/glcpp/tests/081-elif-without-expression.c
@@ -0,0 +1,3 @@
+#if 0
+#elif
+#endif
diff --git a/src/glsl/glcpp/tests/081-elif-without-expression.c.expected b/src/glsl/glcpp/tests/081-elif-without-expression.c.expected
new file mode 100644
index 00000000000..37dcdc3238a
--- /dev/null
+++ b/src/glsl/glcpp/tests/081-elif-without-expression.c.expected
@@ -0,0 +1,6 @@
+0:2(1): preprocessor error: #elif with no expression
+
+
+
+
+
diff --git a/src/glsl/glcpp/tests/082-invalid-paste.c b/src/glsl/glcpp/tests/082-invalid-paste.c
new file mode 100644
index 00000000000..40bf64411c5
--- /dev/null
+++ b/src/glsl/glcpp/tests/082-invalid-paste.c
@@ -0,0 +1,2 @@
+#define PASTE(x,y) x ## y
+PASTE(<,>)
diff --git a/src/glsl/glcpp/tests/082-invalid-paste.c.expected b/src/glsl/glcpp/tests/082-invalid-paste.c.expected
new file mode 100644
index 00000000000..2c924406b59
--- /dev/null
+++ b/src/glsl/glcpp/tests/082-invalid-paste.c.expected
@@ -0,0 +1,5 @@
+0:2(7): preprocessor error:
+Pasting "<" and ">" does not give a valid preprocessing token.
+
+<
+
diff --git a/src/glsl/glcpp/tests/083-unterminated-if.c b/src/glsl/glcpp/tests/083-unterminated-if.c
new file mode 100644
index 00000000000..91806350927
--- /dev/null
+++ b/src/glsl/glcpp/tests/083-unterminated-if.c
@@ -0,0 +1,2 @@
+#if 1
+
diff --git a/src/glsl/glcpp/tests/084-unbalanced-parentheses.c b/src/glsl/glcpp/tests/084-unbalanced-parentheses.c
new file mode 100644
index 00000000000..0789ba5e525
--- /dev/null
+++ b/src/glsl/glcpp/tests/084-unbalanced-parentheses.c
@@ -0,0 +1,2 @@
+#define FUNC(x) (2*(x))
+FUNC(23
diff --git a/src/glsl/glcpp/tests/085-incorrect-argument-count.c b/src/glsl/glcpp/tests/085-incorrect-argument-count.c
new file mode 100644
index 00000000000..91bea600612
--- /dev/null
+++ b/src/glsl/glcpp/tests/085-incorrect-argument-count.c
@@ -0,0 +1,5 @@
+#define MULT(x,y) ((x)*(y))
+MULT()
+MULT(1)
+MULT(1,2,3)
+
diff --git a/src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected b/src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected
new file mode 100644
index 00000000000..1df30cbb56f
--- /dev/null
+++ b/src/glsl/glcpp/tests/085-incorrect-argument-count.c.expected
@@ -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)
+
+
diff --git a/src/glsl/glcpp/tests/086-reserved-macro-names.c b/src/glsl/glcpp/tests/086-reserved-macro-names.c
new file mode 100644
index 00000000000..fd0c29f0c47
--- /dev/null
+++ b/src/glsl/glcpp/tests/086-reserved-macro-names.c
@@ -0,0 +1,2 @@
+#define __BAD reserved
+#define GL_ALSO_BAD() also reserved
diff --git a/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected b/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected
new file mode 100644
index 00000000000..6a9df682685
--- /dev/null
+++ b/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected
@@ -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.
+
+
+
+