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



commit f38f0e959de3d37054f4038e47cd6f8be5830bb6
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Jan 21 17:40:02 2021 +0100

    tests: Add more "parser" tests to increase coverage

 tests/Makefile.am                             |  4 ++++
 tests/parser/argument-list-incomplete.test    |  8 ++++++++
 tests/parser/attribute-missing-literal.test   |  5 +++++
 tests/parser/block-delimiter-missing.test     |  5 +++++
 tests/parser/initializer-list-incomplete.test | 10 ++++++++++
 5 files changed, 32 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6211ba77c..6ee9ee25a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -743,10 +743,13 @@ TESTS = \
        scanner/string-escape-x-digit-length.test \
        scanner/string-escape-x-empty.test \
        scanner/string-escape-x.vala \
+       parser/argument-list-incomplete.test \
        parser/array-creation-invalid.test \
        parser/assignment.vala \
        parser/attribute-duplicate.test \
+       parser/attribute-missing-literal.test \
        parser/attribute-wrong-number.test \
+       parser/block-delimiter-missing.test \
        parser/constant-owned.test \
        parser/constant-local-owned.test \
        parser/constructor-class-exists.test \
@@ -778,6 +781,7 @@ TESTS = \
        parser/foreach.vala \
        parser/foreach-no-type.test \
        parser/function-syntax-error.test \
+       parser/initializer-list-incomplete.test \
        parser/inner-array-size.test \
        parser/invalid-brace.test \
        parser/invalid-statement-delimiter.test \
diff --git a/tests/parser/argument-list-incomplete.test b/tests/parser/argument-list-incomplete.test
new file mode 100644
index 000000000..0d1f8679a
--- /dev/null
+++ b/tests/parser/argument-list-incomplete.test
@@ -0,0 +1,8 @@
+Invalid Code
+
+void foo (int i, string s) {
+}
+
+void main () {
+       foo (42, );
+}
diff --git a/tests/parser/attribute-missing-literal.test b/tests/parser/attribute-missing-literal.test
new file mode 100644
index 000000000..e0d7acfa8
--- /dev/null
+++ b/tests/parser/attribute-missing-literal.test
@@ -0,0 +1,5 @@
+Invalid Code
+
+[Attribute (prop = )]
+void main () {
+}
diff --git a/tests/parser/block-delimiter-missing.test b/tests/parser/block-delimiter-missing.test
new file mode 100644
index 000000000..c17135d32
--- /dev/null
+++ b/tests/parser/block-delimiter-missing.test
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+       string[] foo = { "foo";
+}
diff --git a/tests/parser/initializer-list-incomplete.test b/tests/parser/initializer-list-incomplete.test
new file mode 100644
index 000000000..9b67d64db
--- /dev/null
+++ b/tests/parser/initializer-list-incomplete.test
@@ -0,0 +1,10 @@
+Invalid Code
+
+struct Foo {
+       unowned string s;
+       int i;
+}
+
+void main () {
+       Foo foo = { i = 42, s = };
+}


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