public void Generics()
{
Interpret(@"load 'Bike.Test';
System.Collections.Generic.List<System.String>;
System.Collections.Generic.Dictionary<System.Collections.Generic.List<System.Int32>, System.Int32>;");
Interpret(@"var isType = Test.Generic<System.Int32>.Value is Bike.Number;")
.Equal("isType", true);
Interpret(@"var val = Test.Generic<System.String>.StaticMethod<System.Int32>(1);")
.Equal("val", 1);
Interpret(@"val = Test.Generic<System.Int32>().InstanceMethod<System.String>('hello');")
.Equal("val", "hello");
Interpret(@"var type = System.Collections.Generic.List<System.String>;
var obj = System.Collections.Generic.List<System.String>();
isType = obj is type && obj is System.Collections.Generic.List<System.String>;")
.Equal("isType", true);
Interpret(@"obj = type();
isType = obj is System.Collections.Generic.List<System.String>;")
.Equal("isType", true);
Interpret(@"var arr = System.Collections.Generic.List<System.String>();
var a;
arr.Add('str');
try {
arr.Add(1);
} rescue {
a = true;
}
var b = arr is System.Collections.Generic.List<System.String>;")
.Equal("a", true)
.Equal("b", true);
Interpret(@"arr = System.Collections.Generic.Dictionary<
System.String, System.Int32>();
a = false;
arr.Add('str', 1);
try {
arr.Add(1, 1);
} rescue {
a = true;
};")
.Equal("a", true);
Interpret(@"arr = System.Collections.Generic.Dictionary
<System.Collections.Generic.List<System.Int32>,
System.Int32>();
a = false;
arr.Add(System.Collections.Generic.List<System.Int32>(), 1);
try {
arr.Add(1, 1);
} rescue {
a = true;
};")
.Equal("a", true);
}