83 references to TestCondition
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (83)
Semantics\ConditionalExpressionsTests.vb (83)
27TestCondition("if(True, 1, 2)", expectedType:="System.Int32") 28TestCondition("if(True, ""a""c, GetChar)", expectedType:="System.Char") 29TestCondition("if(False, GetString, ""abc"")", expectedType:="System.String") 30TestCondition("if(False, GetUserNonGeneric, New C())", expectedType:="C") 32TestCondition("if(True, ""a""c, GetString)", expectedType:="System.String") 33TestCondition("if(GetDouble > 1, GetInt, GetSingle)", expectedType:="System.Single") 34TestCondition("if(nothing, GetInt, GetObject)", expectedType:="System.Object") 35TestCondition("if(nothing, GetObject, ""1""c)", expectedType:="System.Object") 37TestCondition("if(True, GetByte, GetShort)", expectedType:="System.Int16") 38TestCondition("if(True, 1, GetShort)", expectedType:="System.Int32") 39TestCondition("if(True, 1.1, GetSingle)", expectedType:="System.Double") 41TestCondition("if(nothing, GetString, 1.234)", strict:=OptionStrict.On, errors:= 47TestCondition("if(nothing, GetString, 1.234)", expectedType:="System.Object", strict:=OptionStrict.Custom, errors:= 53TestCondition("if(nothing, GetString, 1.234)", expectedType:="System.Object", strict:=OptionStrict.Off) 58TestCondition("if(Nothing, 2)", expectedType:="System.Int32") 59TestCondition("if(Nothing, GetIntOpt)", expectedType:="System.Nullable(Of System.Int32)") 60TestCondition("if(""string"", #1/1/1#)", expectedType:="System.String", strict:=OptionStrict.Off) 61TestCondition("if(CType(Nothing, String), ""str-123"")", expectedType:="System.String") 62TestCondition("if(CType(Nothing, String), Nothing)", expectedType:="System.String") 63TestCondition("if(Nothing, Nothing)", expectedType:="System.Object") 64TestCondition("if(CType(CType(Nothing, String), Object), GetIntOpt)", expectedType:="System.Object") 65TestCondition("if(CType(CType(Nothing, String), Object), GetInt)", expectedType:="System.Object") 67TestCondition("if(GetIntOpt, 2)", expectedType:="System.Int32") 68TestCondition("if(GetCharOpt(), ""a""c)", expectedType:="System.Char") 69TestCondition("if(GetString, ""abc"")", expectedType:="System.String") 70TestCondition("if(GetUserNonGeneric, New C())", expectedType:="C") 72TestCondition("if(GetString, ""a""c)", expectedType:="System.String") 73TestCondition("if(GetIntOpt, GetSingle)", expectedType:="System.Single") 74TestCondition("if(GetIntOpt, GetObject)", expectedType:="System.Object") 75TestCondition("if(GetObject, ""1""c)", expectedType:="System.Object") 77TestCondition("if(GetByteOpt(), GetShort)", expectedType:="System.Int16") 78TestCondition("if(GetShortOpt, 1)", expectedType:="System.Int32") 79TestCondition("if(GetSingleOpt, 1.1)", expectedType:="System.Double") 81TestCondition("if(GetString, 1.234)", strict:=OptionStrict.On, errors:= 87TestCondition("if(GetString, 1.234)", expectedType:="System.Object", strict:=OptionStrict.Custom) 88TestCondition("if(GetString, 1.234)", expectedType:="System.Object", strict:=OptionStrict.Off) 93TestCondition("if(GetBoolean(), GetUserGeneric(Of T), GetUserGeneric(Of T))", expectedType:="D(Of T)") 94TestCondition("if(Nothing, GetTypeParameter(Of T), GetTypeParameter(Of T))", expectedType:="T") 96TestCondition("if(GetBoolean(), GetUserGeneric(Of T), GetUserGeneric(Of T))", expectedType:="D(Of T)") 97TestCondition("if(GetBoolean(), GetUserGeneric(Of T), Nothing)", expectedType:="D(Of T)") 99TestCondition("if(GetBoolean(), GetUserGeneric(Of T), ""abc"")", strict:=OptionStrict.On, errors:= 105TestCondition("if(GetBoolean(), GetUserGeneric(Of T), ""abc"")", expectedType:="System.Object", strict:=OptionStrict.Custom, errors:= 111TestCondition("if(GetBoolean(), GetUserGeneric(Of T), ""abc"")", expectedType:="System.Object", strict:=OptionStrict.Off) 116TestCondition("if(GetUserGeneric(Of T), GetUserGeneric(Of T))", expectedType:="D(Of T)") 117TestCondition("if(GetTypeParameter(Of T), GetTypeParameter(Of T))", expectedType:="T") 119TestCondition("if(GetUserGeneric(Of T), GetUserGeneric(Of T))", expectedType:="D(Of T)") 120TestCondition("if(GetUserGeneric(Of T), Nothing)", expectedType:="D(Of T)") 121TestCondition("if(Nothing, GetUserGeneric(Of T))", expectedType:="D(Of T)") 123TestCondition("if(GetUserGeneric(Of T), ""abc"")", strict:=OptionStrict.On, errors:= 129TestCondition("if(GetUserGeneric(Of T), ""abc"")", expectedType:="System.Object", strict:=OptionStrict.Custom, errors:= 135TestCondition("if(GetUserGeneric(Of T), ""abc"")", expectedType:="System.Object", strict:=OptionStrict.Off) 140TestCondition("if(Nothing, GetVariantInterface(Of String, Integer)(), GetVariantInterface(Of Object, Integer)())", expectedType:="I(Of System.String, System.Int32)") 141TestCondition("if(Nothing, GetVariantInterface(Of Integer, String)(), GetVariantInterface(Of Integer, Object)())", expectedType:="I(Of System.Int32, System.Object)") 146TestCondition("if(GetVariantInterface(Of String, Integer)(), GetVariantInterface(Of Object, Integer)())", expectedType:="I(Of System.String, System.Int32)") 147TestCondition("if(GetVariantInterface(Of Integer, String)(), GetVariantInterface(Of Integer, Object)())", expectedType:="I(Of System.Int32, System.Object)") 153TestCondition("if(True, New Object(), nothing)", expectedType:="System.Object") 155TestCondition("if(1 > 2, nothing, nothing)", expectedType:="System.Object") 157TestCondition("if(nothing, nothing, nothing)", expectedType:="System.Object", strict:=OptionStrict.Off) 158TestCondition("if(nothing, nothing, nothing)", expectedType:="System.Object", strict:=OptionStrict.Custom) 159TestCondition("if(nothing, nothing, nothing)", expectedType:="System.Object", strict:=OptionStrict.On) 161TestCondition("if(""yes"", nothing, nothing)", expectedType:="System.Object", strict:=OptionStrict.Off) 162TestCondition("if(""yes"", nothing, nothing)", expectedType:="System.Object", strict:=OptionStrict.Custom) 163TestCondition("if(""yes"", nothing, nothing)", strict:=OptionStrict.On, errors:= 170TestCondition("if(1 > 2, nothing, 1)", expectedType:="System.Int32") 171TestCondition("if(1 > 2, nothing, 1.5)", expectedType:="System.Double") 173TestCondition("if(1 > 2, AddressOf Func1, 1.5)", errors:= 179TestCondition("if(1 > 2, 1.5, AddressOf Func1)", errors:= 186TestCondition("if(1 > 2, AddressOf Func1, AddressOf Func2)", strict:=OptionStrict.On, errors:= 198TestCondition("if(New Object(), nothing)", expectedType:="System.Object") 199TestCondition("if(nothing, nothing)", expectedType:="System.Object") 200TestCondition("if(GetIntOpt, nothing)", expectedType:="System.Nullable(Of System.Int32)") 202TestCondition("if(nothing, CByte(1))", expectedType:="System.Byte") 203TestCondition("if(nothing, 1.5)", expectedType:="System.Double") 204TestCondition("if(GetShortOpt(), GetByte)", expectedType:="System.Int16") 206TestCondition("if(GetShortOpt(), GetDouble)", expectedType:="System.Double") 207TestCondition("if(GetShortOpt(), GetSingleOpt())", expectedType:="System.Nullable(Of System.Single)") 209TestCondition("if(AddressOf Func1, 1.5)", errors:= 215TestCondition("if(1.5, AddressOf Func1)", errors:= 222TestCondition("if(AddressOf Func1, AddressOf Func2)", strict:=OptionStrict.On, errors:= 233TestCondition("if(1 > 2, Function() 1, Function() 1.2)", expectedType:="Function <generated method>() As System.Double") 234TestCondition("if(1 > 2, AddressOf Func1, Function(x As Integer) x)", expectedType:="Function <generated method>(x As System.Int32) As System.Int32") 239TestCondition("if(Function() 1, Function() 1.2)", expectedType:="Function <generated method>() As System.Double") 240TestCondition("if(AddressOf Func1, Function(x As Integer) x)", expectedType:="Function <generated method>(x As System.Int32) As System.Int32")