aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/compilable/const_element_array.elna9
-rw-r--r--testsuite/compilable/const_extern.elna5
-rw-r--r--testsuite/fail_compilation/assign_const_element.elna11
3 files changed, 25 insertions, 0 deletions
diff --git a/testsuite/compilable/const_element_array.elna b/testsuite/compilable/const_element_array.elna
new file mode 100644
index 0000000..a812d23
--- /dev/null
+++ b/testsuite/compilable/const_element_array.elna
@@ -0,0 +1,9 @@
+type
+ CI = const Int
+
+var
+ a: [3]CI := [1, 2, 3]
+ b: [3]CI
+
+begin
+end.
diff --git a/testsuite/compilable/const_extern.elna b/testsuite/compilable/const_extern.elna
new file mode 100644
index 0000000..8df801e
--- /dev/null
+++ b/testsuite/compilable/const_extern.elna
@@ -0,0 +1,5 @@
+var
+ errno_like: const Int := extern
+
+begin
+end.
diff --git a/testsuite/fail_compilation/assign_const_element.elna b/testsuite/fail_compilation/assign_const_element.elna
new file mode 100644
index 0000000..9b9c341
--- /dev/null
+++ b/testsuite/fail_compilation/assign_const_element.elna
@@ -0,0 +1,11 @@
+type
+ CI = const Int
+
+proc f()
+var
+ a: [3]CI := [1, 2, 3]
+begin
+ a[1] := 6 (* @Error Cannot assign to a value of type 'CI', because it is constant or contains constant members *)
+return
+
+end.