aboutsummaryrefslogtreecommitdiff
path: root/tests/i
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-17 06:50:29 +0000
committer_ov4 <ov4@ov4.org>2026-10-17 06:50:29 +0000
commitc89477d615fb0ce4d89786ef848ffe6aca1da088 (patch)
treeb2c5692cfa4946fcd1df034630fc1a678d922b9c /tests/i
parent43451328a5ae74ffa34356259ee02e3786f070c3 (diff)
feat(classes): support explicit NEW constructor method calls
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/i')
-rw-r--r--tests/i/class-new-methods/case.json1
-rw-r--r--tests/i/class-new-methods/expected.txt3
-rw-r--r--tests/i/class-new-methods/notes.md5
-rw-r--r--tests/i/class-new-methods/program.cps16
4 files changed, 25 insertions, 0 deletions
diff --git a/tests/i/class-new-methods/case.json b/tests/i/class-new-methods/case.json
new file mode 100644
index 0000000..0967ef4
--- /dev/null
+++ b/tests/i/class-new-methods/case.json
@@ -0,0 +1 @@
+{}
diff --git a/tests/i/class-new-methods/expected.txt b/tests/i/class-new-methods/expected.txt
new file mode 100644
index 0000000..426f8ca
--- /dev/null
+++ b/tests/i/class-new-methods/expected.txt
@@ -0,0 +1,3 @@
+x
+call
+again
diff --git a/tests/i/class-new-methods/notes.md b/tests/i/class-new-methods/notes.md
new file mode 100644
index 0000000..53192fb
--- /dev/null
+++ b/tests/i/class-new-methods/notes.md
@@ -0,0 +1,5 @@
+# Explicit NEW calls
+
+Human review: pending. Expected output was independently traced by AI.
+
+NEW is an ordinary procedure: the bare member call stores x, CALL with mixed case stores call, and Reset calls this.NEW to store again. DECLARE is extended with arguments in the next implementation step.
diff --git a/tests/i/class-new-methods/program.cps b/tests/i/class-new-methods/program.cps
new file mode 100644
index 0000000..573fe0f
--- /dev/null
+++ b/tests/i/class-new-methods/program.cps
@@ -0,0 +1,16 @@
+CLASS Box
+ Value : STRING
+ PROCEDURE NEW(Text : STRING)
+ Value <- Text
+ ENDPROCEDURE
+ PROCEDURE Reset()
+ this.NEW("again")
+ ENDPROCEDURE
+ENDCLASS
+DECLARE Obj : Box
+Obj.NEW("x")
+OUTPUT Obj.Value
+CALL Obj.new("call")
+OUTPUT Obj.Value
+Obj.Reset()
+OUTPUT Obj.Value