Skip to content

Commit

Permalink
fixup! Use CPS for BasicEditAndContinue tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Dec 7, 2023
1 parent 063ae60 commit 2c71d4f
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@ public abstract class BasicEditAndContinue(string projectTemplate)
public class LegacyProject()
: BasicEditAndContinue(WellKnownProjectTemplates.ConsoleApplication)
{
protected override string FileName => "Module1.vb";
}
#endif

public class CommonProjectSystem()
: BasicEditAndContinue(WellKnownProjectTemplates.VisualBasicNetCoreConsoleApplication)
{
protected override string FileName => "Program.vb";
}

private const string module1FileName = "Module1.vb";
protected abstract string FileName { get; }

private readonly string _projectTemplate = projectTemplate;

Expand Down Expand Up @@ -65,7 +67,7 @@ End Module
", HangMitigatingCancellationToken);

await TestServices.Workspace.WaitForAsyncOperationsAsync(FeatureAttribute.Workspace, HangMitigatingCancellationToken);
await TestServices.Debugger.SetBreakpointAsync(ProjectName, module1FileName, "names(0)", HangMitigatingCancellationToken);
await TestServices.Debugger.SetBreakpointAsync(ProjectName, FileName, "names(0)", HangMitigatingCancellationToken);
await TestServices.Debugger.GoAsync(waitForBreakMode: true, HangMitigatingCancellationToken);
await TestServices.Editor.ActivateAsync(HangMitigatingCancellationToken);
await TestServices.Editor.ReplaceTextAsync("names(0)", "names(1)", HangMitigatingCancellationToken);
Expand All @@ -91,7 +93,7 @@ End Sub
End Module", HangMitigatingCancellationToken);

await TestServices.Workspace.WaitForAsyncOperationsAsync(FeatureAttribute.Workspace, HangMitigatingCancellationToken);
await TestServices.Debugger.SetBreakpointAsync(ProjectName, module1FileName, "Console.WriteLine(1)", HangMitigatingCancellationToken);
await TestServices.Debugger.SetBreakpointAsync(ProjectName, FileName, "Console.WriteLine(1)", HangMitigatingCancellationToken);
await TestServices.Debugger.GoAsync(waitForBreakMode: true, HangMitigatingCancellationToken);
await TestServices.Editor.ActivateAsync(HangMitigatingCancellationToken);
await TestServices.Editor.ReplaceTextAsync("Console.WriteLine(1)",
Expand Down Expand Up @@ -119,7 +121,7 @@ End Sub
End Module", HangMitigatingCancellationToken);

await TestServices.Workspace.WaitForAsyncOperationsAsync(FeatureAttribute.Workspace, HangMitigatingCancellationToken);
await TestServices.Debugger.SetBreakpointAsync(ProjectName, module1FileName, "x * x", charsOffset: -1, HangMitigatingCancellationToken);
await TestServices.Debugger.SetBreakpointAsync(ProjectName, FileName, "x * x", charsOffset: -1, HangMitigatingCancellationToken);

await TestServices.Debugger.GoAsync(waitForBreakMode: true, HangMitigatingCancellationToken);
await TestServices.Editor.ActivateAsync(HangMitigatingCancellationToken);
Expand Down Expand Up @@ -176,7 +178,7 @@ End Sub

await TestServices.Workspace.WaitForAsyncOperationsAsync(FeatureAttribute.Workspace, HangMitigatingCancellationToken);
await TestServices.Debugger.GoAsync(waitForBreakMode: true, HangMitigatingCancellationToken);
await TestServices.Debugger.SetBreakpointAsync(ProjectName, module1FileName, "Dim x", charsOffset: 1, HangMitigatingCancellationToken);
await TestServices.Debugger.SetBreakpointAsync(ProjectName, FileName, "Dim x", charsOffset: 1, HangMitigatingCancellationToken);
await TestServices.Debugger.ExecuteStatementAsync("Module1.Main()", HangMitigatingCancellationToken);
await TestServices.Editor.ReplaceTextAsync("x = 4", "x = 42", HangMitigatingCancellationToken);
await TestServices.Debugger.StepOverAsync(waitForBreakOrEnd: true, HangMitigatingCancellationToken);
Expand Down Expand Up @@ -207,7 +209,7 @@ End Class
", cancellationToken);

await TestServices.SolutionExplorer.AddProjectReferenceAsync(ProjectName, basicLibrary, cancellationToken);
await TestServices.SolutionExplorer.OpenFileAsync(ProjectName, module1FileName, cancellationToken);
await TestServices.SolutionExplorer.OpenFileAsync(ProjectName, FileName, cancellationToken);

await TestServices.Editor.SetTextAsync(@"
Imports System
Expand All @@ -228,7 +230,7 @@ End Module
public async Task MultiProjectDebuggingWhereNotAllModulesAreLoaded()
{
await SetupMultiProjectSolutionAsync(HangMitigatingCancellationToken);
await TestServices.Debugger.SetBreakpointAsync(ProjectName, module1FileName, "PrintX", charsOffset: 1, HangMitigatingCancellationToken);
await TestServices.Debugger.SetBreakpointAsync(ProjectName, FileName, "PrintX", charsOffset: 1, HangMitigatingCancellationToken);
await TestServices.Debugger.GoAsync(waitForBreakMode: true, HangMitigatingCancellationToken);
await TestServices.Editor.ActivateAsync(HangMitigatingCancellationToken);
await TestServices.Editor.ReplaceTextAsync("5", "42", HangMitigatingCancellationToken);
Expand Down Expand Up @@ -261,7 +263,7 @@ End Sub
End Module
", HangMitigatingCancellationToken);
await TestServices.Workspace.WaitForAsyncOperationsAsync(FeatureAttribute.Workspace, HangMitigatingCancellationToken);
await TestServices.Debugger.SetBreakpointAsync(ProjectName, module1FileName, "End Sub", HangMitigatingCancellationToken);
await TestServices.Debugger.SetBreakpointAsync(ProjectName, FileName, "End Sub", HangMitigatingCancellationToken);
await TestServices.Debugger.GoAsync(waitForBreakMode: true, HangMitigatingCancellationToken);
await TestServices.Editor.ActivateAsync(HangMitigatingCancellationToken);
await TestServices.Editor.ReplaceTextAsync("Dim goo As String = \"abc\"", "Dim goo As Single = 10", HangMitigatingCancellationToken);
Expand Down Expand Up @@ -293,11 +295,11 @@ End Function
End Module
", HangMitigatingCancellationToken);
await TestServices.Workspace.WaitForAsyncOperationsAsync(FeatureAttribute.Workspace, HangMitigatingCancellationToken);
await TestServices.Debugger.SetBreakpointAsync(ProjectName, module1FileName, "Function bar(ByVal moo As Long) As Decimal", HangMitigatingCancellationToken);
await TestServices.Debugger.SetBreakpointAsync(ProjectName, FileName, "Function bar(ByVal moo As Long) As Decimal", HangMitigatingCancellationToken);
await TestServices.Debugger.GoAsync(waitForBreakMode: true, HangMitigatingCancellationToken);
await TestServices.Editor.ActivateAsync(HangMitigatingCancellationToken);
await TestServices.Editor.ReplaceTextAsync("Dim lLng As Long = 5", "Dim lLng As Long = 444", HangMitigatingCancellationToken);
await TestServices.Debugger.SetBreakpointAsync(ProjectName, module1FileName, "Return 4", HangMitigatingCancellationToken);
await TestServices.Debugger.SetBreakpointAsync(ProjectName, FileName, "Return 4", HangMitigatingCancellationToken);
await TestServices.Debugger.GoAsync(waitForBreakMode: true, HangMitigatingCancellationToken);

Assert.Equal(("Decimal", "0"), await TestServices.LocalsWindow.GetEntryAsync(["bar"], HangMitigatingCancellationToken));
Expand Down

0 comments on commit 2c71d4f

Please sign in to comment.