summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2025-04-08 19:30:38 +0800
committerGitHub <noreply@github.com>2025-04-08 19:30:38 +0800
commit87c96bcfa89905d237dc0452f255ebf61307c441 (patch)
tree7a981f99059fab03ba59dd60222ea077f1851445 /tests
parent9972a5269f87618e237cd927b859636322596a76 (diff)
warn when the user puts a file extension in an implementing directive (#6757)
Closes https://github.com/shader-slang/slang/issues/5995
Diffstat (limited to 'tests')
-rw-r--r--tests/modules/extension-warning.slang10
-rw-r--r--tests/modules/implementing-with-ext.slang9
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/modules/extension-warning.slang b/tests/modules/extension-warning.slang
new file mode 100644
index 000000000..874211539
--- /dev/null
+++ b/tests/modules/extension-warning.slang
@@ -0,0 +1,10 @@
+//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):
+module mymodule;
+
+// This tests the issue described here: https://github.com/shader-slang/slang/issues/5995
+
+//CHECK: result code = 0
+//CHECK: tests/modules/implementing-with-ext.slang(1): warning 30506: implementing directive contains file extension in module name 'mymodule.slang'. Module names should not include extensions. The compiler will use 'mymodule' as the module name.
+__include "implementing-with-ext";
+
+int moduleFunction() { return 0; }
diff --git a/tests/modules/implementing-with-ext.slang b/tests/modules/implementing-with-ext.slang
new file mode 100644
index 000000000..4e399df7d
--- /dev/null
+++ b/tests/modules/implementing-with-ext.slang
@@ -0,0 +1,9 @@
+implementing "mymodule.slang";
+
+int helperFunction() { return 0; }
+
+void main()
+{
+ int x = moduleFunction();
+ int y = helperFunction();
+}