提交 8b369b41 编写于 作者: C CyrusNajmabadi

Add additional location tests.

上级 2512c966
......@@ -4830,6 +4830,8 @@ public void CreateTupleTypeSymbol_WithValueTuple()
Assert.True(tupleWithoutNames.TupleElementNames.IsDefault);
Assert.Equal(new[] { "System.Int32", "System.String" }, tupleWithoutNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind);
Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
......@@ -4873,6 +4875,8 @@ public void CreateTupleTypeSymbol_NoNames()
Assert.True(tupleWithoutNames.TupleElementNames.IsDefault);
Assert.Equal(new[] { "System.Int32", "System.String" }, tupleWithoutNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind);
Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
......@@ -4890,6 +4894,8 @@ public void CreateTupleTypeSymbol_WithNames()
Assert.Equal(new[] { "Alice", "Bob" }, tupleWithNames.TupleElementNames);
Assert.Equal(new[] { "System.Int32", "System.String" }, tupleWithNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.Equal(SymbolKind.NamedType, tupleWithNames.Kind);
Assert.All(tupleWithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
......@@ -4907,6 +4913,8 @@ public void CreateTupleTypeSymbol_WithSomeNames()
Assert.Equal(new[] { null, "Item2", "Charlie" }, tupleWithSomeNames.TupleElementNames);
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32" }, tupleWithSomeNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.Equal(SymbolKind.NamedType, tupleWithSomeNames.Kind);
Assert.All(tupleWithSomeNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
......@@ -4923,6 +4931,8 @@ public void CreateTupleTypeSymbol_WithBadNames()
Assert.Equal(new[] { "Item2", "Item1" }, tupleWithNames.TupleElementNames);
Assert.Equal(new[] { "System.Int32", "System.Int32" }, tupleWithNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.Equal(SymbolKind.NamedType, tupleWithNames.Kind);
Assert.All(tupleWithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
......@@ -4945,6 +4955,8 @@ public void CreateTupleTypeSymbol_Tuple8NoNames()
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String" },
tuple8WithoutNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.All(tuple8WithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
......@@ -4968,6 +4980,8 @@ public void CreateTupleTypeSymbol_Tuple8WithNames()
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String" },
tuple8WithNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.All(tuple8WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
......@@ -4991,6 +5005,8 @@ public void CreateTupleTypeSymbol_Tuple9NoNames()
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32" },
tuple9WithoutNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.All(tuple9WithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
......@@ -5014,6 +5030,9 @@ public void CreateTupleTypeSymbol_Tuple9WithNames()
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32" },
tuple9WithNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.All(tuple9WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
......@@ -5040,6 +5059,9 @@ public void CreateTupleTypeSymbol_Tuple9WithDefaultNames()
Assert.Equal(new[] { "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.Int32", "System.Int32" },
tuple9WithNames.TupleElementTypes.Select(t => t.ToTestDisplayString()));
Assert.All(tuple9WithNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact]
......@@ -5060,6 +5082,8 @@ public void CreateTupleTypeSymbol_ElementTypeIsError()
Assert.Equal(2, types.Length);
Assert.Equal(SymbolKind.NamedType, types[0].Kind);
Assert.Equal(SymbolKind.ErrorType, types[1].Kind);
Assert.All(tupleWithoutNames.GetMembers().OfType<IFieldSymbol>().Select(f => f.Locations.FirstOrDefault()),
loc => Assert.Equal(loc, null));
}
[Fact, WorkItem(13277, "https://github.com/dotnet/roslyn/issues/13277")]
......
......@@ -885,7 +885,8 @@ protected static ImmutableArray<string> CheckTupleElementNames(int cardinality,
return elementNames;
}
protected static void CheckTupleElementLocations(int cardinality,
protected static void CheckTupleElementLocations(
int cardinality,
ImmutableArray<Location> elementLocations)
{
if (!elementLocations.IsDefault)
......
......@@ -5059,7 +5059,8 @@ End Class
Assert.True(tupleWithoutNames.TupleElementNames.IsDefault)
Assert.Equal(New String() {"System.Int32", "System.String"}, tupleWithoutNames.TupleElementTypes.Select(Function(t) t.ToTestDisplayString()))
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind)
Assert.All(tupleWithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
End Sub
<Fact>
......@@ -5107,7 +5108,8 @@ End Class
Assert.True(tupleWithoutNames.TupleElementNames.IsDefault)
Assert.Equal(New String() {"System.Int32", "System.String"}, tupleWithoutNames.TupleElementTypes.Select(Function(t) t.ToTestDisplayString()))
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind)
Assert.All(tupleWithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
End Sub
<Fact>
......@@ -5126,7 +5128,8 @@ End Class
Assert.Equal(New String() {"Alice", "Bob"}, tupleWithoutNames.TupleElementNames)
Assert.Equal(New String() {"System.Int32", "System.String"}, tupleWithoutNames.TupleElementTypes.Select(Function(t) t.ToTestDisplayString()))
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind)
Assert.All(tupleWithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
End Sub
<Fact>
......@@ -5148,7 +5151,8 @@ End Class
tupleWithSomeNames.TupleElementTypes.Select(Function(t) t.ToTestDisplayString()))
Assert.Equal(SymbolKind.NamedType, tupleWithSomeNames.Kind)
Assert.All(tupleWithSomeNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
End Sub
<Fact>
......@@ -5165,7 +5169,8 @@ End Class
Assert.Equal(New String() {"Item2", "Item1"}, tupleWithoutNames.TupleElementNames)
Assert.Equal(New String() {"System.Int32", "System.Int32"}, tupleWithoutNames.TupleElementTypes.Select(Function(t) t.ToTestDisplayString()))
Assert.Equal(SymbolKind.NamedType, tupleWithoutNames.Kind)
Assert.All(tupleWithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
End Sub
<Fact>
......@@ -5189,7 +5194,8 @@ End Class
Assert.Equal(New String() {"System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String"},
tuple8WithoutNames.TupleElementTypes.Select(Function(t) t.ToTestDisplayString()))
Assert.All(tuple8WithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
End Sub
<Fact>
......@@ -5213,7 +5219,8 @@ End Class
Assert.Equal(New String() {"System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String"},
tuple8WithNames.TupleElementTypes.Select(Function(t) t.ToTestDisplayString()))
Assert.All(tuple8WithNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
End Sub
<Fact>
......@@ -5237,7 +5244,8 @@ End Class
Assert.Equal(New String() {"System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32"},
tuple9WithoutNames.TupleElementTypes.Select(Function(t) t.ToTestDisplayString()))
Assert.All(tuple9WithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
End Sub
<Fact>
......@@ -5261,7 +5269,8 @@ End Class
Assert.Equal(New String() {"System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32"},
tuple9WithNames.TupleElementTypes.Select(Function(t) t.ToTestDisplayString()))
Assert.All(tuple9WithNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
End Sub
<Fact>
......@@ -5285,7 +5294,8 @@ End Class
Assert.Equal(New String() {"System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32", "System.String", "System.Int32"},
tuple9WithNames.TupleElementTypes.Select(Function(t) t.ToTestDisplayString()))
Assert.All(tuple9WithNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
End Sub
<Fact>
......@@ -5308,7 +5318,8 @@ End Class
Assert.Equal(2, types.Length)
Assert.Equal(SymbolKind.NamedType, types(0).Kind)
Assert.Equal(SymbolKind.ErrorType, types(1).Kind)
Assert.All(tupleWithoutNames.GetMembers().OfType(Of IFieldSymbol)().Select(Function(f) f.Locations.FirstOrDefault()),
Sub(Loc) Assert.Equal(Loc, Nothing))
End Sub
<Fact>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册