diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2018-02-05 13:37:04 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2018-02-05 14:00:57 +0100 |
commit | 117040095ee28b1374e54f0212a2886ef38aa104 (patch) | |
tree | 7a2aa33ce144d291187fec7333e7fc077273db46 /tests/control-semantic | |
parent | 04abfbc6788e1bffab2b27dd0fff652154936dda (diff) | |
download | vala-117040095ee28b1374e54f0212a2886ef38aa104.tar.gz |
tests: Add invalid "control-semantic" tests to increase coverage
Diffstat (limited to 'tests/control-semantic')
19 files changed, 173 insertions, 0 deletions
diff --git a/tests/control-semantic/argument-extra.test b/tests/control-semantic/argument-extra.test new file mode 100644 index 000000000..cb041d6c9 --- /dev/null +++ b/tests/control-semantic/argument-extra.test @@ -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 index 000000000..698476428 --- /dev/null +++ b/tests/control-semantic/argument-incompatible-type-out.test @@ -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 index 000000000..a7ea6f275 --- /dev/null +++ b/tests/control-semantic/argument-incompatible-type-ref.test @@ -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 index 000000000..9298a5035 --- /dev/null +++ b/tests/control-semantic/argument-missing.test @@ -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 index 000000000..5186a8130 --- /dev/null +++ b/tests/control-semantic/argument-named.test @@ -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 index 000000000..b4a53c65d --- /dev/null +++ b/tests/control-semantic/argument-no-out.test @@ -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 index 000000000..bad88161c --- /dev/null +++ b/tests/control-semantic/argument-no-ref.test @@ -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 index 000000000..d54b3a629 --- /dev/null +++ b/tests/control-semantic/argument-null-ref.test @@ -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 index 000000000..edcde7820 --- /dev/null +++ b/tests/control-semantic/argument-owned-out.test @@ -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 index 000000000..2588e7d98 --- /dev/null +++ b/tests/control-semantic/argument-owned-ref.test @@ -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 index 000000000..128029ab0 --- /dev/null +++ b/tests/control-semantic/argument-value-out.test @@ -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 index 000000000..72dd67c3a --- /dev/null +++ b/tests/control-semantic/argument-value-ref.test @@ -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 index 000000000..5a03af56e --- /dev/null +++ b/tests/control-semantic/member-incompatible-type.test @@ -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 index 000000000..0e67c9ad3 --- /dev/null +++ b/tests/control-semantic/member-invalid.test @@ -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 index 000000000..afbaaaf44 --- /dev/null +++ b/tests/control-semantic/member-private.test @@ -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 index 000000000..13fbcab2c --- /dev/null +++ b/tests/control-semantic/member-readonly.test @@ -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 index 000000000..dd56deb84 --- /dev/null +++ b/tests/control-semantic/printf-too-few.test @@ -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 index 000000000..f30e680d9 --- /dev/null +++ b/tests/control-semantic/printf-too-many.test @@ -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 index 000000000..12997928e --- /dev/null +++ b/tests/control-semantic/variadic-argument-invalid.test @@ -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); +} |