[vala/staging] tests: Add more "parser" tests to increase coverage



commit ebda0136b9525ce5d1b322995ab5d0e70ade79a3
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Jan 30 13:42:43 2020 +0100

    tests: Add more "parser" tests to increase coverage

 tests/Makefile.am                       |  2 ++
 tests/parser/declaration-embedded.test  |  6 ++++++
 tests/parser/member-access-pointer.vala | 12 ++++++++++++
 3 files changed, 20 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ba34f51d2..0c13cf0aa 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -613,6 +613,7 @@ TESTS = \
        parser/creation-no-new.test \
        parser/creation-no-override.test \
        parser/creation-no-virtual.test \
+       parser/declaration-embedded.test \
        parser/delegate-anonymous.test \
        parser/delegate-no-new.test \
        parser/destructor-class-exists.test \
@@ -635,6 +636,7 @@ TESTS = \
        parser/local-variable.vala \
        parser/lock-statement.vala \
        parser/main-block.vala \
+       parser/member-access-pointer.vala \
        parser/method-no-abstract-override.test \
        parser/method-no-abstract-virtual-override.test \
        parser/method-no-abstract-virtual.test \
diff --git a/tests/parser/declaration-embedded.test b/tests/parser/declaration-embedded.test
new file mode 100644
index 000000000..f39cbbd95
--- /dev/null
+++ b/tests/parser/declaration-embedded.test
@@ -0,0 +1,6 @@
+Invalid Code
+
+void main () {
+       if (true)
+               var i = 42;
+}
diff --git a/tests/parser/member-access-pointer.vala b/tests/parser/member-access-pointer.vala
new file mode 100644
index 000000000..b3a0c5e4d
--- /dev/null
+++ b/tests/parser/member-access-pointer.vala
@@ -0,0 +1,12 @@
+struct Foo {
+       public int i;
+
+       public void bar<G,T> (G g, T t) {
+       }
+}
+
+void main () {
+       Foo foo = { 42 };
+
+       (&foo)->bar<int?, string> (23, "foo");
+}


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