aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/fail_compilation/unary_minus_on_record.elna9
-rw-r--r--testsuite/fail_compilation/unary_negation_on_record.elna9
-rw-r--r--testsuite/fail_compilation/unary_plus_on_record.elna9
-rw-r--r--testsuite/runnable/unary_plus.elna8
4 files changed, 35 insertions, 0 deletions
diff --git a/testsuite/fail_compilation/unary_minus_on_record.elna b/testsuite/fail_compilation/unary_minus_on_record.elna
new file mode 100644
index 0000000..cfd76a2
--- /dev/null
+++ b/testsuite/fail_compilation/unary_minus_on_record.elna
@@ -0,0 +1,9 @@
+type
+ R = record
+ x: Int
+ end
+
+proc f(r: R): Int
+return -r (* @Error Type 'R' cannot be used with unary '-' *)
+
+end.
diff --git a/testsuite/fail_compilation/unary_negation_on_record.elna b/testsuite/fail_compilation/unary_negation_on_record.elna
new file mode 100644
index 0000000..370f04d
--- /dev/null
+++ b/testsuite/fail_compilation/unary_negation_on_record.elna
@@ -0,0 +1,9 @@
+type
+ R = record
+ x: Int
+ end
+
+proc f(r: R): Int
+return ~r (* @Error Type 'R' cannot be used with unary '~' *)
+
+end.
diff --git a/testsuite/fail_compilation/unary_plus_on_record.elna b/testsuite/fail_compilation/unary_plus_on_record.elna
new file mode 100644
index 0000000..7289873
--- /dev/null
+++ b/testsuite/fail_compilation/unary_plus_on_record.elna
@@ -0,0 +1,9 @@
+type
+ R = record
+ x: Int
+ end
+
+proc f(r: R): Int
+return +r (* @Error Type 'R' cannot be used with unary '\+' *)
+
+end.
diff --git a/testsuite/runnable/unary_plus.elna b/testsuite/runnable/unary_plus.elna
new file mode 100644
index 0000000..2bc69f3
--- /dev/null
+++ b/testsuite/runnable/unary_plus.elna
@@ -0,0 +1,8 @@
+proc f(x: Int): Int
+return +x
+
+begin
+ assert(+3 = 3);
+ assert(f(5) = 5);
+ assert(f(-7) = -7)
+end.