Skip to content

Commit

Permalink
Update tests to account for new behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Mar 26, 2021
1 parent 3475981 commit 6fbc693
Showing 1 changed file with 68 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1854,8 +1854,8 @@ public class C
<Document><![CDATA[
public class C
{
public C(int Alice, int Bob) { }
public C(string ignored) { }
public C(object Alice, object Bob) { }
public C(object ignored) { }

public void M()
{
Expand All @@ -1878,6 +1878,71 @@ public class C
End Using
End Function

<WpfTheory, CombinatorialData>
<Trait(Traits.Feature, Traits.Features.Completion)>
<WorkItem(28603, "https://github.com/dotnet/roslyn/issues/28603")>
Public Async Function TestImplicitObjectCreationExpression_WithSpace_EnumTypes(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
using System;
public class C
{
public C(DayOfWeek Alice, DayOfWeek Bob) { }
public C(DateTimeKind ignored) { }

public void M()
{
C c = new$$
}
}]]></Document>, languageVersion:=LanguageVersion.CSharp9, showCompletionInArgumentLists:=showCompletionInArgumentLists)

state.SendTypeChars(" ")
Await state.AssertSelectedCompletionItem(displayText:="C", isHardSelected:=True)
state.SendTypeChars("(")

' The use of enum types causes completion to trigger automatically, even when
' showCompletionInArgumentLists is disabled.
Await state.AssertSignatureHelpSession()

state.SendTypeChars("A")
Await state.AssertSelectedCompletionItem(displayText:="Alice:", isHardSelected:=True)
state.SendTypeChars(":")
Assert.Contains("new C(Alice:", state.GetLineTextFromCaretPosition(), StringComparison.Ordinal)
End Using
End Function

<WpfTheory, CombinatorialData>
<Trait(Traits.Feature, Traits.Features.Completion)>
<WorkItem(28603, "https://github.com/dotnet/roslyn/issues/28603")>
Public Async Function TestImplicitObjectCreationExpression_WithSpace_EnumLikeTypes(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
<Document><![CDATA[
public class C
{
public C(int Alice, int Bob) { }
public C(string ignored) { }

public void M()
{
C c = new$$
}
}]]></Document>, languageVersion:=LanguageVersion.CSharp9, showCompletionInArgumentLists:=showCompletionInArgumentLists)

state.SendTypeChars(" ")
Await state.AssertSelectedCompletionItem(displayText:="C", isHardSelected:=True)
state.SendTypeChars("(")

' The use of enum-like types (int.MaxValue and string.Empty) causes completion to trigger automatically,
' even when showCompletionInArgumentLists is disabled.
Await state.AssertSignatureHelpSession()

state.SendTypeChars("A")
Await state.AssertSelectedCompletionItem(displayText:="Alice:", isHardSelected:=True)
state.SendTypeChars(":")
Assert.Contains("new C(Alice:", state.GetLineTextFromCaretPosition(), StringComparison.Ordinal)
End Using
End Function

<WpfTheory, CombinatorialData>
<Trait(Traits.Feature, Traits.Features.Completion)>
<WorkItem(13527, "https://github.com/dotnet/roslyn/issues/13527")>
Expand Down Expand Up @@ -3272,7 +3337,7 @@ class C
}
]]></Document>,
showCompletionInArgumentLists:=showCompletionInArgumentLists)
state.SendTypeChars("var @this = ""goo""")
state.SendTypeChars("var @this = ""goo"";")
state.SendReturn()
state.SendTypeChars("string str = this.ToString();")
state.SendReturn()
Expand Down

0 comments on commit 6fbc693

Please sign in to comment.