Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -581,38 +581,46 @@ protected override void ProcessRecord()
break;

case StackParameterSet:
if (_stackNames != null)
if (Stack)
{
foreach (string stackName in _stackNames)
if (_stackNames != null)
{
foreach (string stackName in _stackNames)
{
try
{
// Get the directory stack. This is similar to the "dirs" command
WriteObject(SessionState.Path.LocationStack(stackName), false);
}
catch (PSArgumentException argException)
{
WriteError(
new ErrorRecord(
argException.ErrorRecord,
argException));
continue;
}
}
}
else
{
try
{
// Get the directory stack. This is similar to the "dirs" command
WriteObject(SessionState.Path.LocationStack(stackName), false);
WriteObject(SessionState.Path.LocationStack(null), false);
}
catch (PSArgumentException argException)
{
WriteError(
new ErrorRecord(
argException.ErrorRecord,
argException));
continue;
}
}
}
else
{
try
{
WriteObject(SessionState.Path.LocationStack(null), false);
}
catch (PSArgumentException argException)
{
WriteError(
new ErrorRecord(
argException.ErrorRecord,
argException));
}
// Fall back to current location behavior when -Stack:$false
WriteObject(SessionState.Path.CurrentLocation);
}

break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,19 @@ protected override void ProcessRecord()

break;
case ListAvailableParameterSet:
foreach (var cultureInfo in CultureInfo.GetCultures(CultureTypes.AllCultures))
if (ListAvailable)
{
WriteObject(cultureInfo);
foreach (var cultureInfo in CultureInfo.GetCultures(CultureTypes.AllCultures))
{
WriteObject(cultureInfo);
}
}
else
{
ci = NoUserOverrides
? CultureInfo.GetCultureInfo(Host.CurrentCulture.Name)
: Host.CurrentCulture;
WriteObject(ci);
}

break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,10 @@ Describe "Get-Location" -Tags "CI" {
It "Should do exactly the same thing as its alias" {
(pwd).Path | Should -BeExactly (Get-Location).Path
}

It "Should return current location when -Stack:`$false is specified" {
$result = Get-Location -Stack:$false
$result | Should -BeOfType System.Management.Automation.PathInfo
$result.Path | Should -BeExactly (Get-Location).Path
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ Describe "Get-Culture" -Tags "CI" {
$ciArray[0] | Should -BeOfType CultureInfo
}

It "Should return current culture when -ListAvailable:`$false is specified" {
$result = Get-Culture -ListAvailable:$false
$result | Should -BeOfType CultureInfo
$result.Name | Should -BeExactly (Get-Culture).Name
}

It "Should write an error on unsupported culture name" {

{ Get-Culture -Name "abcdefghijkl" -ErrorAction Stop } | Should -PassThru -Throw -ErrorId "ParameterArgumentValidationError,Microsoft.PowerShell.Commands.GetCultureCommand"
Expand Down