aboutsummaryrefslogtreecommitdiff
path: root/tests/i/string-aggregate-assignment/program.cps
diff options
context:
space:
mode:
Diffstat (limited to 'tests/i/string-aggregate-assignment/program.cps')
-rw-r--r--tests/i/string-aggregate-assignment/program.cps28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/i/string-aggregate-assignment/program.cps b/tests/i/string-aggregate-assignment/program.cps
new file mode 100644
index 0000000..9659437
--- /dev/null
+++ b/tests/i/string-aggregate-assignment/program.cps
@@ -0,0 +1,28 @@
+GLOBAL
+ DECLARE Destroyed : INTEGER
+ DECLARE Copies : INTEGER
+ENDGLOBAL
+CLASS Box
+ Text : STRING
+ OVERLOAD PROCEDURE NEW()
+ ENDPROCEDURE
+ OVERLOAD PROCEDURE NEW(BYREF Other : Box)
+ Text <- Other.Text
+ Copies <- Copies + 1
+ ENDPROCEDURE
+ PROCEDURE DELETE()
+ Destroyed <- Destroyed + 1
+ ENDPROCEDURE
+ENDCLASS
+PROCEDURE Check()
+ DECLARE A : Box
+ DECLARE B : Box
+ A.Text <- "left"
+ B.Text <- "right"
+ B <- A
+ B <- B
+ B.Text <- "changed"
+ OUTPUT A.Text, ":", B.Text, ":", Destroyed, ":", Copies
+ENDPROCEDURE
+CALL Check()
+OUTPUT Destroyed, ":", Copies