Skip to content

Commit 6a789b0

Browse files
test: cover Assert-VisualCRedistributableInstalled to maintain coverage after lazy probe
Adds InModuleScope tests for the private VC++ runtime probe so the deferred-init refactor (#54) does not regress code coverage.
1 parent ca2877a commit 6a789b0

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

tests/Sodium.Tests.ps1

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,27 @@
166166
Should -Throw 'Invalid private key. Expected 32 bytes but got 16.'
167167
}
168168
}
169+
170+
Context 'Runtime diagnostics' {
171+
It 'Assert-VisualCRedistributableInstalled returns a boolean for the current architecture' {
172+
InModuleScope Sodium {
173+
$arch = if ([System.Environment]::Is64BitProcess) { 'X64' } else { 'X86' }
174+
$result = Assert-VisualCRedistributableInstalled -Version '14.0' -Architecture $arch
175+
$result | Should -BeOfType [bool]
176+
}
177+
}
178+
179+
It 'Assert-VisualCRedistributableInstalled treats non-Windows platforms as unsupported' {
180+
InModuleScope Sodium {
181+
$original = $IsWindows
182+
try {
183+
Set-Variable -Name IsWindows -Scope Script -Value $false
184+
$result = Assert-VisualCRedistributableInstalled -Version '14.0' -Architecture 'X64' 3>$null
185+
$result | Should -BeFalse
186+
} finally {
187+
Set-Variable -Name IsWindows -Scope Script -Value $original
188+
}
189+
}
190+
}
191+
}
169192
}

0 commit comments

Comments
 (0)