Skip to content

Commit 271b67f

Browse files
committed
Added a test to get a function definition ast
1 parent bc1ba49 commit 271b67f

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/PowerShellEditorServices.Test/Refactoring/RefactorUtilitiesTests.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
using Microsoft.PowerShell.EditorServices.Test.Shared;
1212
using Microsoft.PowerShell.EditorServices.Handlers;
1313
using Xunit;
14-
using Microsoft.PowerShell.EditorServices.Refactoring;
1514
using System.Management.Automation.Language;
15+
using Microsoft.PowerShell.EditorServices.Refactoring;
1616

1717
namespace PowerShellEditorServices.Test.Refactoring
1818
{
@@ -133,5 +133,21 @@ public void GetCommandParameterAst()
133133
Assert.Equal(10,symbol.Extent.StartColumnNumber);
134134

135135
}
136+
[Fact]
137+
public void GetFunctionDefinitionAst()
138+
{
139+
RenameSymbolParams request = new(){
140+
Column=12,
141+
Line=1,
142+
RenameTo="Renamed",
143+
FileName="TestDetection.ps1"
144+
};
145+
ScriptFile scriptFile = GetTestScript(request.FileName);
146+
147+
Ast symbol = Utilities.GetAst(request.Line,request.Column,scriptFile.ScriptAst);
148+
Assert.Equal(1,symbol.Extent.StartLineNumber);
149+
Assert.Equal(1,symbol.Extent.StartColumnNumber);
150+
151+
}
136152
}
137153
}

0 commit comments

Comments
 (0)