aboutsummaryrefslogtreecommitdiff
path: root/tests/actor/regression
diff options
context:
space:
mode:
Diffstat (limited to 'tests/actor/regression')
-rw-r--r--tests/actor/regression/generic_extensions.zc8
-rw-r--r--tests/actor/regression/generic_typed_method.zc5
-rw-r--r--tests/actor/regression/module_helpers.zc7
-rw-r--r--tests/actor/regression/plain.zc4
4 files changed, 24 insertions, 0 deletions
diff --git a/tests/actor/regression/generic_extensions.zc b/tests/actor/regression/generic_extensions.zc
new file mode 100644
index 0000000..4a4476d
--- /dev/null
+++ b/tests/actor/regression/generic_extensions.zc
@@ -0,0 +1,8 @@
+namespace;
+include rt, run;
+run.syntax("record", run.kw_struct);
+record Value { int amount; }
+int calls;
+fn tick() { calls++; return 0; }
+run.statement_hook(tick);
+fn main() { int value = 1; value++; rt.put_n(calls); rt.put_c(10); return 0; }
diff --git a/tests/actor/regression/generic_typed_method.zc b/tests/actor/regression/generic_typed_method.zc
new file mode 100644
index 0000000..2038ad3
--- /dev/null
+++ b/tests/actor/regression/generic_typed_method.zc
@@ -0,0 +1,5 @@
+namespace;
+include rt;
+typecheck on;
+struct Box<T> { T value; T echo(T input) { this.value = input; return this.value; } }
+fn main() { Box<int> a; Box<float> b; rt.put_n(a.echo(7)); rt.put_c(' '); int result = b.echo(2.5); rt.put_n(result); rt.put_c(10); return 0; }
diff --git a/tests/actor/regression/module_helpers.zc b/tests/actor/regression/module_helpers.zc
new file mode 100644
index 0000000..90f481f
--- /dev/null
+++ b/tests/actor/regression/module_helpers.zc
@@ -0,0 +1,7 @@
+namespace helpers;
+include rt;
+int offset = 6;
+T add<T>(T value) { return value + offset; }
+namespace;
+include rt, helpers;
+fn main() { rt.put_n(helpers.add(4)); rt.put_c(10); return 0; }
diff --git a/tests/actor/regression/plain.zc b/tests/actor/regression/plain.zc
new file mode 100644
index 0000000..307d80c
--- /dev/null
+++ b/tests/actor/regression/plain.zc
@@ -0,0 +1,4 @@
+namespace;
+include rt;
+struct Counter { int value; fn add(int n) { this.value += n; return this.value; } }
+fn main() { Counter c; rt.put_n(c.add(3)); rt.put_c(10); return 0; }