summaryrefslogtreecommitdiffstats
path: root/tests/preprocessor
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2023-07-31 15:40:29 -0400
committerGitHub <noreply@github.com>2023-07-31 15:40:29 -0400
commit5349241098076bead63f638daf2e4b9a9cb3e496 (patch)
treec3b1ea606d5ce41866e36b3df6ebb3c49265b406 /tests/preprocessor
parent8bfdc39259d0a401a33d3be69b22c8dd9b576683 (diff)
Fix for #elif evaluation issue (#3038)
* A more way robust way to handle resource consumption might use multiple `kind`s on GLSL emit. * Improve method naming and some comments. * Small consistency fix. * Fix issue with #elif evaluation. * Add a test.
Diffstat (limited to 'tests/preprocessor')
-rw-r--r--tests/preprocessor/elif-eval.slang9
-rw-r--r--tests/preprocessor/elif-eval.slang.expected8
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/preprocessor/elif-eval.slang b/tests/preprocessor/elif-eval.slang
new file mode 100644
index 000000000..912f70fd2
--- /dev/null
+++ b/tests/preprocessor/elif-eval.slang
@@ -0,0 +1,9 @@
+//TEST:SIMPLE:
+
+#ifndef SOME_MACRO
+# error Not this one!
+// The expression after #elif shouldn't be evaluated, because #ifndef evaluated as true
+#elif SOME_OTHER_MACRO
+#else
+#error This isn't valid!
+#endif
diff --git a/tests/preprocessor/elif-eval.slang.expected b/tests/preprocessor/elif-eval.slang.expected
new file mode 100644
index 000000000..04387be1c
--- /dev/null
+++ b/tests/preprocessor/elif-eval.slang.expected
@@ -0,0 +1,8 @@
+result code = -1
+standard error = {
+tests/preprocessor/elif-eval.slang(4): error 15900: #error: Not this one!
+# error Not this one!
+ ^~~~~
+}
+standard output = {
+}