浏览代码

added test checking var-params and functions in params

Ronny Otto 11 年之前
父节点
当前提交
04c86efbe6
共有 2 个文件被更改,包括 37 次插入0 次删除
  1. 33 0
      tests/framework/language/params_01.bmx
  2. 4 0
      tests/framework/language/params_01.res

+ 33 - 0
tests/framework/language/params_01.bmx

@@ -0,0 +1,33 @@
+Rem
+	This test checks:
+	- is passing variables by reference is possible
+	- is passing functions as parameter is possible
+End Rem
+SuperStrict
+
+Import BRL.StandardIO
+
+
+local originalNumber:int = 10
+
+Function PassByReference:int(number:int var, modifierFunction:int(number:int var))
+	number :+ 5
+	print number
+
+	modifierFunction(number)
+End Function
+
+Function modifierFunction:int(number:int var)
+	number :* 2
+	print number
+End Function
+
+
+'should output:
+'10
+'15
+'30
+'30
+print originalNumber
+PassByReference(originalNumber, modifierFunction)
+print originalNumber

+ 4 - 0
tests/framework/language/params_01.res

@@ -0,0 +1,4 @@
+10
+15
+30
+30