summaryrefslogtreecommitdiff
path: root/tests/diagnostics
diff options
context:
space:
mode:
Diffstat (limited to 'tests/diagnostics')
-rw-r--r--tests/diagnostics/transitive-namespace-import.slang/a.slang5
-rw-r--r--tests/diagnostics/transitive-namespace-import.slang/b.slang6
-rw-r--r--tests/diagnostics/transitive-namespace-import.slang/test.slang37
3 files changed, 48 insertions, 0 deletions
diff --git a/tests/diagnostics/transitive-namespace-import.slang/a.slang b/tests/diagnostics/transitive-namespace-import.slang/a.slang
new file mode 100644
index 000000000..257bf3717
--- /dev/null
+++ b/tests/diagnostics/transitive-namespace-import.slang/a.slang
@@ -0,0 +1,5 @@
+module a;
+namespace ns
+{
+ public int fa() { return 1; }
+}
diff --git a/tests/diagnostics/transitive-namespace-import.slang/b.slang b/tests/diagnostics/transitive-namespace-import.slang/b.slang
new file mode 100644
index 000000000..9d33d385d
--- /dev/null
+++ b/tests/diagnostics/transitive-namespace-import.slang/b.slang
@@ -0,0 +1,6 @@
+module b;
+
+namespace ns
+{
+ public int f_b() { return 2; }
+}
diff --git a/tests/diagnostics/transitive-namespace-import.slang/test.slang b/tests/diagnostics/transitive-namespace-import.slang/test.slang
new file mode 100644
index 000000000..a60e30a19
--- /dev/null
+++ b/tests/diagnostics/transitive-namespace-import.slang/test.slang
@@ -0,0 +1,37 @@
+//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):
+
+module test;
+
+import b;
+
+void testFunc()
+{
+ // CHECK-NOT: {{.*}}([[# @LINE + 1]]): error
+ ns.f_b(); // OK.
+ // CHECK: {{.*}}([[# @LINE + 1]]): error 30027:
+ ns.f_a(); // Error.
+}
+
+namespace ns
+{
+ void testFunc2()
+ {
+ // CHECK-NOT: {{.*}}([[# @LINE + 1]]): error
+ f_b(); // OK.
+ // CHECK: {{.*}}([[# @LINE + 1]]): error 30015:
+ f_a(); // Error.
+ }
+}
+
+namespace ns2
+{
+ using namespace ns;
+
+ void testFunc3()
+ {
+ // CHECK-NOT: {{.*}}([[# @LINE + 1]]): error
+ f_b(); // OK.
+ // CHECK: {{.*}}([[# @LINE + 1]]): error 30015:
+ f_a(); // Error.
+ }
+}