]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add "tuple" parser test to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 6 Jan 2018 22:52:37 +0000 (23:52 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 10 Jan 2018 19:44:54 +0000 (20:44 +0100)
tests/Makefile.am
tests/parser/tuple.vala [new file with mode: 0644]

index fab97764be453024cfa081d409f06b9163359e42..22ce5d1d3ae33bfe6dd09f9b11791d341beb04ee 100644 (file)
@@ -314,6 +314,7 @@ TESTS = \
        annotations/description.vala \
        annotations/noaccessormethod.test \
        parser/template.vala \
+       parser/tuple.vala \
        $(NULL)
 
 NON_NULL_TESTS = \
diff --git a/tests/parser/tuple.vala b/tests/parser/tuple.vala
new file mode 100644 (file)
index 0000000..1c16942
--- /dev/null
@@ -0,0 +1,14 @@
+void main () {
+       string[] FOO = { "foo", null };
+       int[] BAR = { 42, 4711 };
+
+       unowned string? s, n;
+       (s, n) = FOO;
+       assert (s == "foo");
+       assert (n == null);
+
+       int i, j;
+       (i, j) = BAR;
+       assert (i == 42);
+       assert (j == 4711);
+}