Skip to content

Commit 5f0282c

Browse files
committed
🧪 Add true and false variable tests
1 parent ae4fb69 commit 5f0282c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

test/PowerShellEditorServices.Test.Shared/Debugging/VariableTest.ps1

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ function Test-Variables {
1111
$classVar = [MyClass]::new();
1212
$classVar.Name = "Test"
1313
$classVar.Number = 42;
14+
$trueVar = $true
15+
$falseVar = $false
1416
$enumVar = $ErrorActionPreference
1517
$nullString = [NullString]::Value
1618
$psObjVar = New-Object -TypeName PSObject -Property @{Name = 'John'; Age = 75}

test/PowerShellEditorServices.Test/Debugging/DebugServiceTests.cs

+11-1
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ public async Task DebuggerGetsVariables()
534534
{
535535
await debugService.SetLineBreakpointsAsync(
536536
variableScriptFile,
537-
new[] { BreakpointDetails.Create(variableScriptFile.FilePath, 14) }).ConfigureAwait(true);
537+
new[] { BreakpointDetails.Create(variableScriptFile.FilePath, 16) }).ConfigureAwait(true);
538538

539539
Task _ = ExecuteVariableScriptFile();
540540
AssertDebuggerStopped(variableScriptFile.FilePath);
@@ -567,6 +567,16 @@ await debugService.SetLineBreakpointsAsync(
567567

568568
var classChildren = debugService.GetVariables(classVar.Id);
569569
Assert.Equal(2, classChildren.Length);
570+
571+
var trueVar = Array.Find(variables, v => v.Name == "$trueVar");
572+
Assert.NotNull(trueVar);
573+
Assert.Equal("boolean", trueVar.Type);
574+
Assert.Equal("$true", trueVar.ValueString);
575+
576+
var falseVar = Array.Find(variables, v => v.Name == "$falseVar");
577+
Assert.NotNull(falseVar);
578+
Assert.Equal("boolean", falseVar.Type);
579+
Assert.Equal("$false", falseVar.ValueString);
570580
}
571581

572582
[Trait("Category", "DebugService")]

0 commit comments

Comments
 (0)