]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add invalid "field" tests to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 4 Feb 2018 21:09:22 +0000 (22:09 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 5 Feb 2018 06:33:15 +0000 (07:33 +0100)
tests/Makefile.am
tests/semantic/field-accessibility.test [new file with mode: 0644]
tests/semantic/field-compact-static.test [new file with mode: 0644]
tests/semantic/field-external.test [new file with mode: 0644]
tests/semantic/field-incompatible.test [new file with mode: 0644]
tests/semantic/field-interface.test [new file with mode: 0644]
tests/semantic/field-invalid-assignment.test [new file with mode: 0644]
tests/semantic/field-namespace-owned.test [new file with mode: 0644]
tests/semantic/field-non-constant.test [new file with mode: 0644]
tests/semantic/field-void.test [new file with mode: 0644]

index e89b338eb7363ab0d5d41b556fbc4f4079750150..afdb412e44113f1f6b01b5307080387fa403efc8 100644 (file)
@@ -340,6 +340,15 @@ TESTS = \
        parser/switch-statement.vala \
        parser/template.vala \
        parser/tuple.vala \
+       semantic/field-accessibility.test \
+       semantic/field-compact-static.test \
+       semantic/field-external.test \
+       semantic/field-incompatible.test \
+       semantic/field-interface.test \
+       semantic/field-invalid-assignment.test \
+       semantic/field-namespace-owned.test \
+       semantic/field-non-constant.test \
+       semantic/field-void.test \
        $(NULL)
 
 NON_NULL_TESTS = \
diff --git a/tests/semantic/field-accessibility.test b/tests/semantic/field-accessibility.test
new file mode 100644 (file)
index 0000000..35a28dd
--- /dev/null
@@ -0,0 +1,9 @@
+Invalid Code
+
+class Foo {
+}
+
+public Foo field;
+
+void main () {
+}
diff --git a/tests/semantic/field-compact-static.test b/tests/semantic/field-compact-static.test
new file mode 100644 (file)
index 0000000..353221b
--- /dev/null
@@ -0,0 +1,13 @@
+Invalid Code
+
+[Compact]
+class Foo {
+       public static string field = get_foo ();
+}
+
+string get_foo () {
+       return "foo";
+}
+
+void main () {
+}
diff --git a/tests/semantic/field-external.test b/tests/semantic/field-external.test
new file mode 100644 (file)
index 0000000..7be17bf
--- /dev/null
@@ -0,0 +1,6 @@
+Invalid Code
+
+extern unowned string field = "foo";
+
+void main () {
+}
diff --git a/tests/semantic/field-incompatible.test b/tests/semantic/field-incompatible.test
new file mode 100644 (file)
index 0000000..29f0721
--- /dev/null
@@ -0,0 +1,6 @@
+Invalid Code
+
+string field = 42;
+
+void main () {
+}
diff --git a/tests/semantic/field-interface.test b/tests/semantic/field-interface.test
new file mode 100644 (file)
index 0000000..89f96fb
--- /dev/null
@@ -0,0 +1,8 @@
+Invalid Code
+
+interface Foo {
+       public int field;
+}
+
+void main () {
+}
diff --git a/tests/semantic/field-invalid-assignment.test b/tests/semantic/field-invalid-assignment.test
new file mode 100644 (file)
index 0000000..d9f41f4
--- /dev/null
@@ -0,0 +1,11 @@
+Invalid Code
+
+string get_foo () {
+       return "foo";
+}
+
+unowned string field;
+
+void main () {
+       field = get_foo ();
+}
diff --git a/tests/semantic/field-namespace-owned.test b/tests/semantic/field-namespace-owned.test
new file mode 100644 (file)
index 0000000..e668445
--- /dev/null
@@ -0,0 +1,6 @@
+Invalid Code
+
+string field = "foo";
+
+void main () {
+}
diff --git a/tests/semantic/field-non-constant.test b/tests/semantic/field-non-constant.test
new file mode 100644 (file)
index 0000000..7a37a17
--- /dev/null
@@ -0,0 +1,9 @@
+Invalid Code
+
+class Foo {
+}
+
+Foo field = new Foo ();
+
+void main () {
+}
diff --git a/tests/semantic/field-void.test b/tests/semantic/field-void.test
new file mode 100644 (file)
index 0000000..a9fac3e
--- /dev/null
@@ -0,0 +1,6 @@
+Invalid Code
+
+void field;
+
+void main () {
+}