]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add more invalid "assignment" tests to increase coverage
authorCorentin Noël <corentin@elementary.io>
Fri, 22 Mar 2019 08:09:21 +0000 (09:09 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 10 Apr 2019 14:26:19 +0000 (16:26 +0200)
tests/Makefile.am
tests/arrays/expression-bracket.test [new file with mode: 0644]
tests/arrays/fixed-length-non-const.test [new file with mode: 0644]
tests/control-semantic/literal-immutable.test [new file with mode: 0644]
tests/control-semantic/this-assignment.test [new file with mode: 0644]
tests/objects/property-construct-only-write-foreign.test [new file with mode: 0644]
tests/objects/property-construct-only-write.test [new file with mode: 0644]
tests/objects/property-read-only-write.test [new file with mode: 0644]

index 5434c5c2556bb460caa8bcf6f134fd0e3b5204ae..019779c88e0141feac2031b4b9cd1510d14b2f39 100644 (file)
@@ -66,7 +66,9 @@ TESTS = \
        basic-types/bug787152.vala \
        basic-types/bug788775.vala \
        arrays/class-field-length-cname.vala \
+       arrays/expression-bracket.test \
        arrays/field-global-length-cname.vala \
+       arrays/fixed-length-non-const.test \
        arrays/struct-field-length-cname.vala \
        arrays/slice-invalid-start.test \
        arrays/slice-invalid-stop.test \
@@ -181,12 +183,14 @@ TESTS = \
        control-semantic/argument-owned-ref.test \
        control-semantic/argument-value-out.test \
        control-semantic/argument-value-ref.test \
+       control-semantic/literal-immutable.test \
        control-semantic/member-incompatible-type.test \
        control-semantic/member-invalid.test \
        control-semantic/member-private.test \
        control-semantic/member-readonly.test \
        control-semantic/printf-too-few.test \
        control-semantic/printf-too-many.test \
+       control-semantic/this-assignment.test \
        control-semantic/variadic-argument-invalid.test \
        enums/enum_only.vala \
        enums/enum-no-gtype.vala \
@@ -280,6 +284,9 @@ TESTS = \
        objects/properties.vala \
        objects/property-notify.vala \
        objects/property-read-only-auto.vala \
+       objects/property-read-only-write.test \
+       objects/property-construct-only-write.test \
+       objects/property-construct-only-write-foreign.test \
        objects/property-static.vala \
        objects/regex.vala \
        objects/signals.vala \
diff --git a/tests/arrays/expression-bracket.test b/tests/arrays/expression-bracket.test
new file mode 100644 (file)
index 0000000..c0422a3
--- /dev/null
@@ -0,0 +1,13 @@
+Invalid Code
+
+int bar () {
+       return 1;
+}
+
+string[bar ()]? foo () {
+       return null;
+}
+
+void main () {
+       foo ();
+}
diff --git a/tests/arrays/fixed-length-non-const.test b/tests/arrays/fixed-length-non-const.test
new file mode 100644 (file)
index 0000000..7ae2293
--- /dev/null
@@ -0,0 +1,6 @@
+Invalid Code
+
+void main () {
+       int test_len = 60;
+       string test_array[test_len];
+}
diff --git a/tests/control-semantic/literal-immutable.test b/tests/control-semantic/literal-immutable.test
new file mode 100644 (file)
index 0000000..a335da9
--- /dev/null
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+       true = false;
+}
diff --git a/tests/control-semantic/this-assignment.test b/tests/control-semantic/this-assignment.test
new file mode 100644 (file)
index 0000000..69dc570
--- /dev/null
@@ -0,0 +1,12 @@
+Invalid Code
+
+class Foo {
+       public void do_bar () {
+               this = new Foo ();
+       }
+}
+
+void main () {
+       var foo = new Foo ();
+       foo.do_bar ();
+}
diff --git a/tests/objects/property-construct-only-write-foreign.test b/tests/objects/property-construct-only-write-foreign.test
new file mode 100644 (file)
index 0000000..4ec5be7
--- /dev/null
@@ -0,0 +1,16 @@
+Invalid Code
+
+class Foo : GLib.Object {
+       public string test { construct; }
+       public Foo () {
+               var other = new Foo.ok ();
+               other.test = "";
+       }
+
+       public Foo.ok () {
+       }
+}
+
+void main () {
+       var foo = new Foo ();
+}
diff --git a/tests/objects/property-construct-only-write.test b/tests/objects/property-construct-only-write.test
new file mode 100644 (file)
index 0000000..1b7636c
--- /dev/null
@@ -0,0 +1,12 @@
+Invalid Code
+
+class Foo : GLib.Object {
+       public string test { construct; }
+       public Foo () {
+               test = "";
+       }
+}
+
+void main () {
+       var foo = new Foo ();
+}
diff --git a/tests/objects/property-read-only-write.test b/tests/objects/property-read-only-write.test
new file mode 100644 (file)
index 0000000..7e1e02d
--- /dev/null
@@ -0,0 +1,12 @@
+Invalid Code
+
+class Foo : GLib.Object {
+       public string test { get; }
+       public Foo () {
+       }
+}
+
+void main () {
+       var foo = new Foo ();
+       foo.test= "";
+}