[vala/0.42] tests: Add some "using directive" tests to increase coverage



commit 16287c100cb5e1ff2b8c0156d0459433c294f30e
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sat Oct 27 12:43:19 2018 +0200

    tests: Add some "using directive" tests to increase coverage

 tests/Makefile.am                           |  3 +++
 tests/parser/using-ambiguous-reference.test | 18 ++++++++++++++++++
 tests/parser/using-directive.vala           | 16 ++++++++++++++++
 tests/parser/using-invalid-namespace.test   |  6 ++++++
 4 files changed, 43 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4e707572e..c2f538961 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -485,6 +485,9 @@ TESTS = \
        parser/tuple.vala \
        parser/unsupported-property-async.test \
        parser/unsupported-property-throws.test \
+       parser/using-ambiguous-reference.test \
+       parser/using-directive.vala \
+       parser/using-invalid-namespace.test \
        parser/yield-method.test \
        parser/yield-return.vala \
        parser/bug728574.vala \
diff --git a/tests/parser/using-ambiguous-reference.test b/tests/parser/using-ambiguous-reference.test
new file mode 100644
index 000000000..57feb98ca
--- /dev/null
+++ b/tests/parser/using-ambiguous-reference.test
@@ -0,0 +1,18 @@
+Invalid Code
+
+using Foo;
+using Bar;
+
+namespace Foo {
+       public void manam () {
+       }
+}
+
+namespace Bar {
+       public void manam () {
+       }
+}
+
+void main () {
+       manam ();
+}
diff --git a/tests/parser/using-directive.vala b/tests/parser/using-directive.vala
new file mode 100644
index 000000000..6959f734b
--- /dev/null
+++ b/tests/parser/using-directive.vala
@@ -0,0 +1,16 @@
+namespace Foo {
+       using Bar;
+
+       public void foo () {
+               bar ();
+       }
+}
+
+namespace Bar {
+       public void bar () {
+       }
+}
+
+void main () {
+       Foo.foo ();
+}
diff --git a/tests/parser/using-invalid-namespace.test b/tests/parser/using-invalid-namespace.test
new file mode 100644
index 000000000..9f1a35071
--- /dev/null
+++ b/tests/parser/using-invalid-namespace.test
@@ -0,0 +1,6 @@
+Invalid Code
+
+using UnknownNamespace;
+
+void main () {
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]