summaryrefslogtreecommitdiffstats
path: root/tests/preprocessor
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2018-10-16 18:49:11 -0400
committerGitHub <noreply@github.com>2018-10-16 18:49:11 -0400
commit3e74d39f24fdfaa547ce900be177863e2bfe2dea (patch)
tree9a5143e6de4caa27b23fc870003011e96129905f /tests/preprocessor
parent204fb3c75b520a2cbb1c25f995a8c424ec2753f3 (diff)
Feature/include refactor (#675)
* Refactor of path handling. * Added PathInfo * Changed ISlangFileSystem - such that has separate concepts of reading a file, getting a relative path and getting a canonical path * Added support for getting a canonical path for windows/linux * Made maps/testing around canonicalPaths * User output remains around 'foundPath' - which is the same as before * Small improvements around PathInfo * Added a type and make constructors to make clear the different 'path' uses * Fixed bug in findViewRecursively * Checking and reporting for ignored #pragma once. * Removed SLANG_PATH_TYPE_NONE as doesn't serve any useful purpose. * Improve comments in slang.h aroung ISlangFileSystem * Remove the need for <windows.h> in slang-io.cpp * Ran premake5. * Improvements and fixes around PathInfo. * Fix typo on linix GetCanonical * Make the ISlangFileSystem the same as before, and ISlangFileSystem contain the new methods. Internally it always uses the ISlangFileSystemExt, and will wrap a ISlangFileSystem with WrapFileSystem, if it is determined (via queryInterface) that it doesn't implement the full interface.
Diffstat (limited to 'tests/preprocessor')
-rw-r--r--tests/preprocessor/inappropriate-once.slang6
-rw-r--r--tests/preprocessor/inappropriate-once.slang.expected6
-rw-r--r--tests/preprocessor/include-multiple.slang10
-rw-r--r--tests/preprocessor/include-multiple.slang.expected9
4 files changed, 31 insertions, 0 deletions
diff --git a/tests/preprocessor/inappropriate-once.slang b/tests/preprocessor/inappropriate-once.slang
new file mode 100644
index 000000000..6b750ec77
--- /dev/null
+++ b/tests/preprocessor/inappropriate-once.slang
@@ -0,0 +1,6 @@
+//TEST:SIMPLE:
+// #include support
+
+#pragma once
+
+int foo() { return 0; } \ No newline at end of file
diff --git a/tests/preprocessor/inappropriate-once.slang.expected b/tests/preprocessor/inappropriate-once.slang.expected
new file mode 100644
index 000000000..04d7f7834
--- /dev/null
+++ b/tests/preprocessor/inappropriate-once.slang.expected
@@ -0,0 +1,6 @@
+result code = 0
+standard error = {
+tests/preprocessor/inappropriate-once.slang(4): warning 15602: pragma once was ignored - this is typically because is not placed in an include
+}
+standard output = {
+}
diff --git a/tests/preprocessor/include-multiple.slang b/tests/preprocessor/include-multiple.slang
new file mode 100644
index 000000000..6dd1624bc
--- /dev/null
+++ b/tests/preprocessor/include-multiple.slang
@@ -0,0 +1,10 @@
+//TEST:SIMPLE:
+// #include support
+
+int foo() { return 0; }
+
+#include "include-a.slang.h"
+#include "../preprocessor/include-a.slang.h"
+#include "./include-a.slang.h"
+
+int baz() { return bar(); } \ No newline at end of file
diff --git a/tests/preprocessor/include-multiple.slang.expected b/tests/preprocessor/include-multiple.slang.expected
new file mode 100644
index 000000000..d52a5a2ab
--- /dev/null
+++ b/tests/preprocessor/include-multiple.slang.expected
@@ -0,0 +1,9 @@
+result code = -1
+standard error = {
+tests/preprocessor/include-a.slang.h(3): error 30201: function 'bar' already has a body
+tests/preprocessor/include-a.slang.h(3): note: see previous definition of 'bar'
+tests/preprocessor/include-a.slang.h(3): error 30201: function 'bar' already has a body
+tests/preprocessor/include-a.slang.h(3): note: see previous definition of 'bar'
+}
+standard output = {
+}