]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add invalid "control-semantic" tests to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 5 Feb 2018 12:37:04 +0000 (13:37 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 5 Feb 2018 13:00:57 +0000 (14:00 +0100)
20 files changed:
tests/Makefile.am
tests/control-semantic/argument-extra.test [new file with mode: 0644]
tests/control-semantic/argument-incompatible-type-out.test [new file with mode: 0644]
tests/control-semantic/argument-incompatible-type-ref.test [new file with mode: 0644]
tests/control-semantic/argument-missing.test [new file with mode: 0644]
tests/control-semantic/argument-named.test [new file with mode: 0644]
tests/control-semantic/argument-no-out.test [new file with mode: 0644]
tests/control-semantic/argument-no-ref.test [new file with mode: 0644]
tests/control-semantic/argument-null-ref.test [new file with mode: 0644]
tests/control-semantic/argument-owned-out.test [new file with mode: 0644]
tests/control-semantic/argument-owned-ref.test [new file with mode: 0644]
tests/control-semantic/argument-value-out.test [new file with mode: 0644]
tests/control-semantic/argument-value-ref.test [new file with mode: 0644]
tests/control-semantic/member-incompatible-type.test [new file with mode: 0644]
tests/control-semantic/member-invalid.test [new file with mode: 0644]
tests/control-semantic/member-private.test [new file with mode: 0644]
tests/control-semantic/member-readonly.test [new file with mode: 0644]
tests/control-semantic/printf-too-few.test [new file with mode: 0644]
tests/control-semantic/printf-too-many.test [new file with mode: 0644]
tests/control-semantic/variadic-argument-invalid.test [new file with mode: 0644]

index 72871304f5aaf358d260a5c8d8cfc858c8a2b87b..8a1e859c79cd648542b16ee228c01df8f4cd83e2 100644 (file)
@@ -137,6 +137,25 @@ TESTS = \
        control-flow/bug736774-1.vala \
        control-flow/bug736774-2.vala \
        control-flow/bug790903.test \
+       control-semantic/argument-extra.test \
+       control-semantic/argument-incompatible-type-out.test \
+       control-semantic/argument-incompatible-type-ref.test \
+       control-semantic/argument-missing.test \
+       control-semantic/argument-named.test \
+       control-semantic/argument-no-out.test \
+       control-semantic/argument-no-ref.test \
+       control-semantic/argument-null-ref.test \
+       control-semantic/argument-owned-out.test \
+       control-semantic/argument-owned-ref.test \
+       control-semantic/argument-value-out.test \
+       control-semantic/argument-value-ref.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/variadic-argument-invalid.test \
        enums/enum_only.vala \
        enums/enums.vala \
        enums/flags.vala \
diff --git a/tests/control-semantic/argument-extra.test b/tests/control-semantic/argument-extra.test
new file mode 100644 (file)
index 0000000..cb041d6
--- /dev/null
@@ -0,0 +1,8 @@
+Invalid Code
+
+void foo (int arg) {
+}
+
+void main () {
+       foo (23, 42);
+}
diff --git a/tests/control-semantic/argument-incompatible-type-out.test b/tests/control-semantic/argument-incompatible-type-out.test
new file mode 100644 (file)
index 0000000..6984764
--- /dev/null
@@ -0,0 +1,9 @@
+Invalid Code
+
+void foo (out string arg) {
+}
+
+void main () {
+       int i;
+       foo (out i);
+}
diff --git a/tests/control-semantic/argument-incompatible-type-ref.test b/tests/control-semantic/argument-incompatible-type-ref.test
new file mode 100644 (file)
index 0000000..a7ea6f2
--- /dev/null
@@ -0,0 +1,9 @@
+Invalid Code
+
+void foo (ref string arg) {
+}
+
+void main () {
+       int i = 42;
+       foo (ref i);
+}
diff --git a/tests/control-semantic/argument-missing.test b/tests/control-semantic/argument-missing.test
new file mode 100644 (file)
index 0000000..9298a50
--- /dev/null
@@ -0,0 +1,8 @@
+Invalid Code
+
+void foo (int arg) {
+}
+
+void main () {
+       foo ();
+}
diff --git a/tests/control-semantic/argument-named.test b/tests/control-semantic/argument-named.test
new file mode 100644 (file)
index 0000000..5186a81
--- /dev/null
@@ -0,0 +1,8 @@
+Invalid Code
+
+void foo (int arg) {
+}
+
+void main () {
+       foo (arg: 23);
+}
diff --git a/tests/control-semantic/argument-no-out.test b/tests/control-semantic/argument-no-out.test
new file mode 100644 (file)
index 0000000..b4a53c6
--- /dev/null
@@ -0,0 +1,9 @@
+Invalid Code
+
+void foo (string arg) {
+}
+
+void main () {
+       string s;
+       foo (out s);
+}
diff --git a/tests/control-semantic/argument-no-ref.test b/tests/control-semantic/argument-no-ref.test
new file mode 100644 (file)
index 0000000..bad8816
--- /dev/null
@@ -0,0 +1,9 @@
+Invalid Code
+
+void foo (string arg) {
+}
+
+void main () {
+       string s = "foo";
+       foo (ref s);
+}
diff --git a/tests/control-semantic/argument-null-ref.test b/tests/control-semantic/argument-null-ref.test
new file mode 100644 (file)
index 0000000..d54b3a6
--- /dev/null
@@ -0,0 +1,8 @@
+Invalid Code
+
+void foo (ref string arg) {
+}
+
+void main () {
+       foo (null);
+}
diff --git a/tests/control-semantic/argument-owned-out.test b/tests/control-semantic/argument-owned-out.test
new file mode 100644 (file)
index 0000000..edcde78
--- /dev/null
@@ -0,0 +1,9 @@
+Invalid Code
+
+void foo (out string arg) {
+}
+
+void main () {
+       unowned string s;
+       foo (out s);
+}
diff --git a/tests/control-semantic/argument-owned-ref.test b/tests/control-semantic/argument-owned-ref.test
new file mode 100644 (file)
index 0000000..2588e7d
--- /dev/null
@@ -0,0 +1,9 @@
+Invalid Code
+
+void foo (ref owned string arg) {
+}
+
+void main () {
+       unowned string s = "foo";
+       foo (ref s);
+}
diff --git a/tests/control-semantic/argument-value-out.test b/tests/control-semantic/argument-value-out.test
new file mode 100644 (file)
index 0000000..128029a
--- /dev/null
@@ -0,0 +1,8 @@
+Invalid Code
+
+void foo (out string arg) {
+}
+
+void main () {
+       foo ("foo");
+}
diff --git a/tests/control-semantic/argument-value-ref.test b/tests/control-semantic/argument-value-ref.test
new file mode 100644 (file)
index 0000000..72dd67c
--- /dev/null
@@ -0,0 +1,8 @@
+Invalid Code
+
+void foo (ref string arg) {
+}
+
+void main () {
+       foo ("foo");
+}
diff --git a/tests/control-semantic/member-incompatible-type.test b/tests/control-semantic/member-incompatible-type.test
new file mode 100644 (file)
index 0000000..5a03af5
--- /dev/null
@@ -0,0 +1,11 @@
+Invalid Code
+
+class Foo {
+       public string foo { get; set; }
+}
+
+void main () {
+       var foo = new Foo () {
+               foo = 42
+       };
+}
diff --git a/tests/control-semantic/member-invalid.test b/tests/control-semantic/member-invalid.test
new file mode 100644 (file)
index 0000000..0e67c9a
--- /dev/null
@@ -0,0 +1,11 @@
+Invalid Code
+
+class Foo {
+       public string foo { get; set; }
+}
+
+void main () {
+       var foo = new Foo () {
+               bar = "foo"
+       };
+}
diff --git a/tests/control-semantic/member-private.test b/tests/control-semantic/member-private.test
new file mode 100644 (file)
index 0000000..afbaaaf
--- /dev/null
@@ -0,0 +1,11 @@
+Invalid Code
+
+class Foo {
+       string foo { get; set; }
+}
+
+void main () {
+       var foo = new Foo () {
+               foo = "foo"
+       };
+}
diff --git a/tests/control-semantic/member-readonly.test b/tests/control-semantic/member-readonly.test
new file mode 100644 (file)
index 0000000..13fbcab
--- /dev/null
@@ -0,0 +1,15 @@
+Invalid Code
+
+class Foo {
+       public string foo {
+               get {
+                       return "bar";
+               }
+       }
+}
+
+void main () {
+       var foo = new Foo () {
+               foo = "foo"
+       };
+}
diff --git a/tests/control-semantic/printf-too-few.test b/tests/control-semantic/printf-too-few.test
new file mode 100644 (file)
index 0000000..dd56deb
--- /dev/null
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+       print ("%d %d", 23);
+}
diff --git a/tests/control-semantic/printf-too-many.test b/tests/control-semantic/printf-too-many.test
new file mode 100644 (file)
index 0000000..f30e680
--- /dev/null
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+       print ("%d", 23, 42);
+}
diff --git a/tests/control-semantic/variadic-argument-invalid.test b/tests/control-semantic/variadic-argument-invalid.test
new file mode 100644 (file)
index 0000000..1299792
--- /dev/null
@@ -0,0 +1,13 @@
+Invalid Code
+
+class Foo {
+       public signal void foo ();
+
+       public void bar (...) {
+       }
+}
+
+void main () {
+       var foo = new Foo ();
+       foo.bar (foo.foo);
+}