aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/fail_compilation/aligned_attribute.elna8
-rw-r--r--testsuite/fail_compilation/varargs_argument.elna12
-rw-r--r--testsuite/fail_compilation/varargs_attribute.elna8
-rw-r--r--testsuite/runnable/aligned_attribute.elna8
-rw-r--r--testsuite/runnable/varargs.elna16
5 files changed, 44 insertions, 8 deletions
diff --git a/testsuite/fail_compilation/aligned_attribute.elna b/testsuite/fail_compilation/aligned_attribute.elna
index 3b5a56e..aab5513 100644
--- a/testsuite/fail_compilation/aligned_attribute.elna
+++ b/testsuite/fail_compilation/aligned_attribute.elna
@@ -1,15 +1,15 @@
type
Uneven = record
- #aligned(3) x: Word8 (* @Error Alignment must be a power of two *)
+ x #{aligned 3}: Word8 (* @Error Alignment must be a power of two *)
end
Twice = record
- #aligned(4) #aligned(8) y: Word8 (* @Error Attribute '#aligned' specified more than once *)
+ y #{aligned 4} #{aligned 8}: Word8 (* @Error Attribute 'aligned' specified more than once *)
end
Unknown = record
- #packed(1) z: Word8 (* @Error Attribute '#packed' not declared *)
+ z #{packed 1}: Word8 (* @Error Attribute 'packed' not declared *)
end
-proc takes(#aligned(8) p: Int) (* @Error Attribute '#aligned' is not supported in this position *)
+proc takes(p #{aligned 8}: Int) (* @Error Attribute 'aligned' is not supported in this position *)
begin
return
diff --git a/testsuite/fail_compilation/varargs_argument.elna b/testsuite/fail_compilation/varargs_argument.elna
new file mode 100644
index 0000000..1325c29
--- /dev/null
+++ b/testsuite/fail_compilation/varargs_argument.elna
@@ -0,0 +1,12 @@
+var
+ written: Int32
+
+proc printf(format: ^const Word8) #{varargs} -> Int32
+extern
+
+program()
+begin
+ written := printf("%s".ptr, "text") (* @Error Type '\[\]const Word8' cannot be passed as a variadic argument *)
+return 0u8
+
+end.
diff --git a/testsuite/fail_compilation/varargs_attribute.elna b/testsuite/fail_compilation/varargs_attribute.elna
new file mode 100644
index 0000000..1c6d3e0
--- /dev/null
+++ b/testsuite/fail_compilation/varargs_attribute.elna
@@ -0,0 +1,8 @@
+proc with_body(x: Int) #{varargs} (* @Error Attribute 'varargs' is not supported in this position *)
+begin
+return
+
+proc no_parameters() #{varargs} -> Int32 (* @Error Attribute 'varargs' requires at least one parameter *)
+extern
+
+end.
diff --git a/testsuite/runnable/aligned_attribute.elna b/testsuite/runnable/aligned_attribute.elna
index 330847e..45c0c37 100644
--- a/testsuite/runnable/aligned_attribute.elna
+++ b/testsuite/runnable/aligned_attribute.elna
@@ -5,20 +5,20 @@ type
end
Spread = record
- a, #aligned(8) b: Word8
+ a, b #{aligned 8}: Word8
end
Packed = record
a: Word8;
- #aligned(1) wide: Word
+ wide #{aligned 1}: Word
end
- Over = #aligned(16) record
+ Over = record #{aligned 16}
a: Word8
end
var
- #aligned(32) tuned: Word8
+ tuned #{aligned 32}: Word8
spread: Spread
first: ^Word8
second: ^Word8
diff --git a/testsuite/runnable/varargs.elna b/testsuite/runnable/varargs.elna
new file mode 100644
index 0000000..feeb94b
--- /dev/null
+++ b/testsuite/runnable/varargs.elna
@@ -0,0 +1,16 @@
+var
+ buffer: [8]Word8
+ written: Int32
+
+proc snprintf(buffer: ^Word8; size: Word; format: ^const Word8) #{varargs} -> Int32
+extern
+
+program()
+begin
+ written := snprintf(@buffer[1], 8u, "%d %.1f".ptr, 200u8, 1.5f);
+ assert(written = 7i32);
+ assert(buffer[1] = '2');
+ assert(buffer[7] = '5')
+return 0u8
+
+end.