From a69b20be3e60f3270255096fbaf8acea671605e8 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Fri, 3 May 2019 11:12:46 -0700 Subject: [PATCH] add test --- test/powershell/Host/ConsoleHost.Tests.ps1 | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/powershell/Host/ConsoleHost.Tests.ps1 b/test/powershell/Host/ConsoleHost.Tests.ps1 index f7d1c39dd..30529c301 100644 --- a/test/powershell/Host/ConsoleHost.Tests.ps1 +++ b/test/powershell/Host/ConsoleHost.Tests.ps1 @@ -245,6 +245,33 @@ Describe "ConsoleHost unit tests" -tags "Feature" { } } + Context "-LoadProfile Commandline switch" { + BeforeAll { + if (Test-Path $profile) { + Remove-Item -Path "$profile.backup" -ErrorAction SilentlyContinue + Rename-Item -Path $profile -NewName "$profile.backup" + Set-Content -Path $profile -Value "'profile-loaded'" -Force + } + } + + AfterAll { + if (Test-Path "$profile.backup") { + Remove-Item -Path $profile -ErrorAction SilentlyContinue + Rename-Item -Path "$profile.backup" -NewName $profile + } + } + + It "Verifies pwsh will accept switch" -TestCases @( + @{ switch = "-l"}, + @{ switch = "-loadprofile"} + ){ + param($switch) + + & pwsh $switch -c exit | Should -BeExactly "profile-loaded" + } + } + + Context "-SettingsFile Commandline switch" { BeforeAll {