summaryrefslogtreecommitdiff
path: root/tests/features/test_opaque.zc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/features/test_opaque.zc')
-rw-r--r--tests/features/test_opaque.zc18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/features/test_opaque.zc b/tests/features/test_opaque.zc
new file mode 100644
index 0000000..5c84b2a
--- /dev/null
+++ b/tests/features/test_opaque.zc
@@ -0,0 +1,18 @@
+import "_opaque_lib.zc";
+
+fn main() {
+ let b = new_box(42);
+
+ // Stack allocation should work (size known)
+ let b2: SecretBox;
+ b2 = b;
+
+ // Public methods should work
+ let v = get_value(&b2);
+ assert(v == 42, "Value should be 42");
+
+ set_value(&b2, 100);
+ assert(get_value(&b2) == 100, "Value should be 100");
+
+ println "Opaque struct test passed";
+}