summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2018-12-16 20:01:19 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2018-12-16 20:23:32 +0100
commit0554ed7ad9cefe0f56e53dc00be88488dfa788bf (patch)
tree848ca63acff558f931924b5926bf27f5135e2540 /tests
parentc5c30e1f9fcd79299df739dda807f6e8b8f513c4 (diff)
downloadvala-0554ed7ad9cefe0f56e53dc00be88488dfa788bf.tar.gz
vala: Array with fixed length don't require explicit instantiation
Fixes https://gitlab.gnome.org/GNOME/vala/issues/720
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/basic-types/arrays-fixed-assignment.vala27
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 380703da2..1a18f2c13 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -25,6 +25,7 @@ TESTS = \
basic-types/floats.vala \
basic-types/strings.vala \
basic-types/arrays.vala \
+ basic-types/arrays-fixed-assignment.vala \
basic-types/array-uint8-uchar-compat.vala \
basic-types/pointers.vala \
basic-types/sizeof.vala \
diff --git a/tests/basic-types/arrays-fixed-assignment.vala b/tests/basic-types/arrays-fixed-assignment.vala
new file mode 100644
index 000000000..0ec0df437
--- /dev/null
+++ b/tests/basic-types/arrays-fixed-assignment.vala
@@ -0,0 +1,27 @@
+string foo[3];
+
+void main () {
+ {
+ foo = new string[3];
+ }
+ {
+ foo = new string[3] { "foo", "bar", "baz" };
+ assert (foo[1] == "bar");
+ }
+ {
+ foo = { "foo", "bar", "baz" };
+ assert (foo[1] == "bar");
+ }
+
+ {
+ string bar[3] = new string[3];
+ }
+ {
+ string bar[3] = new string[3] { "foo", "bar", "baz" };
+ assert (bar[1] == "bar");
+ }
+ {
+ string bar[3] = { "foo", "bar", "baz" };
+ assert (bar[1] == "bar");
+ }
+}