Skip to content

Commit e3fbe37

Browse files
committed
All rename function tests fixed
1 parent fcedf8f commit e3fbe37

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/PowerShellEditorServices/Language/AstExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static class AstExtensions
7272

7373
public static FunctionDefinitionAst? FindFunctionDefinition(this Ast ast, CommandAst command)
7474
{
75-
string? name = command.GetCommandName().ToLower();
75+
string? name = command.GetCommandName()?.ToLower();
7676
if (name is null) { return null; }
7777

7878
FunctionDefinitionAst[] candidateFuncDefs = ast.FindAll(ast =>

test/PowerShellEditorServices.Test.Shared/Refactoring/Functions/FunctionInnerIsNested.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
function outer {
22
function foo {
3-
Write-Host "Inside nested foo"
3+
Write-Host 'Inside nested foo'
44
}
55
foo
66
}
77

88
function foo {
9-
Write-Host "Inside top-level foo"
9+
Write-Host 'Inside top-level foo'
1010
}
1111

1212
outer

test/PowerShellEditorServices.Test.Shared/Refactoring/Functions/FunctionInnerIsNestedRenamed.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function outer {
66
}
77

88
function foo {
9-
Write-Host "Inside top-level foo"
9+
Write-Host 'Inside top-level foo'
1010
}
1111

1212
outer

test/PowerShellEditorServices.Test.Shared/Refactoring/Functions/RefactorFunctionTestCases.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ public class RefactorFunctionTestCases
1212
[
1313
new("FunctionCallWIthinStringExpression.ps1", Line: 1, Column: 10 ),
1414
new("FunctionCmdlet.ps1", Line: 1, Column: 10 ),
15-
new("FunctionForeach.ps1", Line: 5, Column: 11 ),
16-
new("FunctionForeachObject.ps1", Line: 5, Column: 11 ),
15+
new("FunctionForeach.ps1", Line: 11, Column: 5 ),
16+
new("FunctionForeachObject.ps1", Line: 11, Column: 5 ),
1717
new("FunctionInnerIsNested.ps1", Line: 5, Column: 5 ),
1818
new("FunctionLoop.ps1", Line: 5, Column: 5 ),
1919
new("FunctionMultipleOccurrences.ps1", Line: 5, Column: 3 ),
2020
new("FunctionNestedRedefinition.ps1", Line: 13, Column: 15 ),
21-
new("FunctionOuterHasNestedFunction.ps1", Line: 2, Column: 15 ),
21+
new("FunctionOuterHasNestedFunction.ps1", Line: 1, Column: 10 ),
2222
new("FunctionSameName.ps1", Line: 3, Column: 14 , "RenamedSameNameFunction"),
2323
new("FunctionScriptblock.ps1", Line: 5, Column: 5 ),
2424
new("FunctionsSingle.ps1", Line: 1, Column: 11 ),

0 commit comments

Comments
 (0)