summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/preprocessor/import.hlsl18
-rw-r--r--tests/preprocessor/import.slang.h12
-rw-r--r--tests/render/pound-import.hlsl (renamed from tests/render/auto-import.hlsl)4
-rw-r--r--tests/render/pound-import.slang.h (renamed from tests/render/auto-import.slang.h)0
4 files changed, 32 insertions, 2 deletions
diff --git a/tests/preprocessor/import.hlsl b/tests/preprocessor/import.hlsl
new file mode 100644
index 000000000..486023678
--- /dev/null
+++ b/tests/preprocessor/import.hlsl
@@ -0,0 +1,18 @@
+//TEST:SIMPLE:-profile vs_5_0
+
+// Confirm that `#import` interacts with preprocessor as expected
+
+// Here is a macro that flows from parent to child file
+#define FOO float
+
+// Here we import the child file
+#import "import.slang.h"
+
+// Here we use a macro that flows the other way (child->parent)
+BAR g( FOO x ) { return f(x); }
+
+// Here we confirm that importing the file again is a no-op
+#import "import.slang.h"
+
+void main()
+{}
diff --git a/tests/preprocessor/import.slang.h b/tests/preprocessor/import.slang.h
new file mode 100644
index 000000000..a97a199f0
--- /dev/null
+++ b/tests/preprocessor/import.slang.h
@@ -0,0 +1,12 @@
+// Confirm that `#import` interacts with preprocessor as expected
+
+// We add a guard to ensure that this file isn't imported more than once
+#ifdef BAR
+#error File imported more than one!
+#endif
+
+// Here we use a macro from the parent file
+FOO f( FOO y ) { return y; }
+
+// Here is a macro that flows from child to parent
+#define BAR float
diff --git a/tests/render/auto-import.hlsl b/tests/render/pound-import.hlsl
index 588ebc612..a9b625fb6 100644
--- a/tests/render/auto-import.hlsl
+++ b/tests/render/pound-import.hlsl
@@ -1,4 +1,4 @@
-//TEST(smoke,render):COMPARE_HLSL_GLSL_RENDER: -xslang -auto-import-dir -xslang tests/render/
+//TEST(smoke,render):COMPARE_HLSL_GLSL_RENDER:
// This is a basic test case for cross-compilation behavior.
//
@@ -8,7 +8,7 @@
// Pull in Spire code depdendency using extended syntax:
-#include "auto-import.slang.h"
+#import "pound-import.slang.h"
#if defined(__HLSL__)
diff --git a/tests/render/auto-import.slang.h b/tests/render/pound-import.slang.h
index d53005688..d53005688 100644
--- a/tests/render/auto-import.slang.h
+++ b/tests/render/pound-import.slang.h