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



commit d846cc491444ddc5b5cb8dabdb181515046d8fbd
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 44e2e886d..a16a092e6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -473,6 +473,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]