Bläddra i källkod

Added 2 tests concerning language

- passing objects with "var" in param
- "cyclic reference error"
Ronny Otto 11 år sedan
förälder
incheckning
f51bc79c63

+ 10 - 0
tests/framework/language/references_01.bmx

@@ -0,0 +1,10 @@
+Rem
+	This test checks:
+	- if there is a cyclic reference error
+End Rem
+SuperStrict
+Framework BRL.StandardIO
+
+Type TMyClass
+	Global instance:TMyClass
+End Type

+ 24 - 0
tests/framework/language/references_02.bmx

@@ -0,0 +1,24 @@
+'code checks if objects are passed by reference
+SuperStrict
+Framework Brl.Standardio
+
+
+Type TMyObject
+	field prop:int = 10
+End Type
+
+local obj:TMyObject = new TMyObject
+
+Function Modify:int(obj:TMyObject)
+	obj.prop = 20
+End Function
+
+Function ModifyVar:int(obj:TMyObject var)
+	obj.prop = 30
+End Function
+
+print obj.prop
+Modify(obj)
+print obj.prop
+ModifyVar(obj)
+print obj.prop

+ 3 - 0
tests/framework/language/references_02.res

@@ -0,0 +1,3 @@
+10
+20
+30