Browse Source

Updated mx2cc tests.

Mark Sibly 8 years ago
parent
commit
df35464701
2 changed files with 37 additions and 1 deletions
  1. 9 1
      src/mx2cc/tests/genfuncs.monkey2
  2. 28 0
      src/mx2cc/tests/linqtest.monkey2

+ 9 - 1
src/mx2cc/tests/genfuncs.monkey2

@@ -29,6 +29,10 @@ Function F1( p:Int(Int) )
 	Print "F1(Int(Int))"
 End
 
+Function F1<R,A>( f:R(A) )
+	Print "F1<R,A>(R(A))"
+End
+
 Function P()
 End
 
@@ -40,6 +44,10 @@ Function P3:Int( i:Int )
 	Return Null
 End
 
+Function P4:Int( x:Float )
+	Return Null
+End
+
 Function Main()
 
 	F1<Int>()		'F1<T>() INumeric
@@ -49,6 +57,6 @@ Function Main()
 	F1( P )			'F1(Void())
 	F1( P2 )		'F1<T>(T())
 	F1( P3 )		'F1(Int(Int))
+	F1( P4 )		'F1<R,A>(R(A))
 	
 End
- 

+ 28 - 0
src/mx2cc/tests/linqtest.monkey2

@@ -0,0 +1,28 @@
+
+Namespace linqtest
+ 
+#Import "<std>"
+#Import "<linq>"
+ 
+Using std..
+Using linq
+ 
+Function Main:Void()
+ 
+	Local list := New List<String>()
+ 
+	If not list.Any()
+		
+		list.Add("ABC")
+		list.Add("DEF")
+		list.Add("GHI")
+		
+		Local x := list.First2(Lambda:Bool(item:String)
+			return item = "DEF"
+		End)
+		
+		Print(x)
+		
+	End
+	
+End