11# Requires -Modules @ { ModuleName = ' Pester' ; RequiredVersion = ' 5.7.1' }
22
33Describe ' Core' {
4- Context " Function: 'Get-ASTScript '" {
5- It ' Get-ASTScript gets the script AST ' {
4+ Context " Function: 'Get-AstScript '" {
5+ It ' Get-AstScript gets the script Ast ' {
66 $path = Join-Path $PSScriptRoot ' src\Test-Function.ps1'
7- $script = Get-ASTScript - Path $path
7+ $script = Get-AstScript - Path $path
88 $script | Should -Not - BeNullOrEmpty
99 $script.Ast | Should - BeOfType [System.Management.Automation.Language.ScriptBlockAst ]
1010 }
1111 }
12- Context " Function: 'Get-ASTFunction '" {
13- It ' Get-ASTFunction gets the function AST ' {
12+ Context " Function: 'Get-AstFunction '" {
13+ It ' Get-AstFunction gets the function Ast ' {
1414 $path = Join-Path $PSScriptRoot ' src\Test-Function.ps1'
15- $function = Get-ASTFunction - Path $path
15+ $function = Get-AstFunction - Path $path
1616 $function | Should -Not - BeNullOrEmpty
1717 $function.Ast | Should - BeOfType [System.Management.Automation.Language.FunctionDefinitionAst ]
1818 }
1919 }
20- Context " Function: 'Get-ASTCommand '" {
21- It ' Get-ASTCommand gets the command AST ' {
20+ Context " Function: 'Get-AstCommand '" {
21+ It ' Get-AstCommand gets the command Ast ' {
2222 $path = Join-Path $PSScriptRoot ' src\Test-Function.ps1'
23- $command = Get-ASTCommand - Path $path
23+ $command = Get-AstCommand - Path $path
2424 $command | Should -Not - BeNullOrEmpty
2525 $command.Ast | Should - BeOfType [System.Management.Automation.Language.CommandAst ]
2626 }
2727 }
2828}
2929
3030Describe ' Functions' {
31- Context " Function: 'Get-ASTFunctionType '" {
32- It ' Get-ASTFunctionType gets the function type' {
31+ Context " Function: 'Get-AstFunctionType '" {
32+ It ' Get-AstFunctionType gets the function type' {
3333 $path = Join-Path $PSScriptRoot ' src\Test-Function.ps1'
34- $functionType = Get-ASTFunctionType - Path $path
34+ $functionType = Get-AstFunctionType - Path $path
3535 $functionType.Type | Should - Be ' Function'
3636 }
3737 }
38- Context " Function: 'Get-ASTFunctionName '" {
39- It ' Get-ASTFunctionName gets the function name' {
38+ Context " Function: 'Get-AstFunctionName '" {
39+ It ' Get-AstFunctionName gets the function name' {
4040 $path = Join-Path $PSScriptRoot ' src\Test-Function.ps1'
41- $functionName = Get-ASTFunctionName - Path $path
41+ $functionName = Get-AstFunctionName - Path $path
4242 $functionName | Should - Be ' Test-Function'
4343 }
4444 }
45- Context " Function: 'Get-ASTFunctionAlias '" {
46- It ' Get-ASTFunctionAlias gets the function alias' {
45+ Context " Function: 'Get-AstFunctionAlias '" {
46+ It ' Get-AstFunctionAlias gets the function alias' {
4747 $path = Join-Path $PSScriptRoot ' src\Test-Function.ps1'
48- $functionAlias = Get-ASTFunctionAlias - Path $path
48+ $functionAlias = Get-AstFunctionAlias - Path $path
4949 $functionAlias.Alias | Should - Contain ' Test'
5050 $functionAlias.Alias | Should - Contain ' TestFunc'
5151 $functionAlias.Alias | Should - Contain ' Test-Func'
@@ -54,34 +54,34 @@ Describe 'Functions' {
5454}
5555
5656Describe ' Lines' {
57- Context ' Function: Get-ASTLineComment ' {
58- It ' Get-ASTLineComment gets the line comment' {
57+ Context ' Function: Get-AstLineComment ' {
58+ It ' Get-AstLineComment gets the line comment' {
5959 $line = ' # This is a comment'
60- $line = Get-ASTLineComment - Line $line
60+ $line = Get-AstLineComment - Line $line
6161 $line | Should - Be ' # This is a comment'
6262 }
63- It ' Get-ASTLineComment gets the line comment without leading whitespace' {
63+ It ' Get-AstLineComment gets the line comment without leading whitespace' {
6464 $line = ' # This is a comment'
65- $line = Get-ASTLineComment - Line $line
65+ $line = Get-AstLineComment - Line $line
6666 $line | Should - Be ' # This is a comment'
6767 }
68- It ' Get-ASTLineComment gets the line comment but not the command' {
68+ It ' Get-AstLineComment gets the line comment but not the command' {
6969 $line = ' Get-Command # This is a comment '
70- $line = Get-ASTLineComment - Line $line
70+ $line = Get-AstLineComment - Line $line
7171 $line | Should - Be ' # This is a comment '
7272 }
73- It ' Get-ASTLineComment returns nothing when no comment is present' {
73+ It ' Get-AstLineComment returns nothing when no comment is present' {
7474 $line = ' Get-Command'
75- $line | Get-ASTLineComment | Should - BeNullOrEmpty
75+ $line | Get-AstLineComment | Should - BeNullOrEmpty
7676 }
7777 }
7878}
7979
8080Describe ' Scripts' {
81- Context " Function: 'Get-ASTScriptCommands '" {
82- It ' Get-ASTScriptCommands gets the script commands' {
81+ Context " Function: 'Get-AstScriptCommands '" {
82+ It ' Get-AstScriptCommands gets the script commands' {
8383 $path = Join-Path $PSScriptRoot ' src\Test-Function.ps1'
84- $commands = Get-ASTScriptCommand - Path $path
84+ $commands = Get-AstScriptCommand - Path $path
8585 $commands | Should -Not - BeNullOrEmpty
8686 $commands | Should - BeOfType [pscustomobject ]
8787 $commands.Name | Should -Not - Contain ' ForEach-Object'
@@ -91,9 +91,9 @@ Describe 'Scripts' {
9191 $commands.Name | Should -Not - Contain ' .'
9292 $commands.Name | Should -Not - Contain ' &'
9393 }
94- It ' Get-ASTScriptCommands gets the script commands (recursive)' {
94+ It ' Get-AstScriptCommands gets the script commands (recursive)' {
9595 $path = Join-Path $PSScriptRoot ' src\Test-Function.ps1'
96- $commands = Get-ASTScriptCommand - Path $path - Recurse
96+ $commands = Get-AstScriptCommand - Path $path - Recurse
9797 $commands | Should -Not - BeNullOrEmpty
9898 $commands | Should - BeOfType [pscustomobject ]
9999 $commands.Name | Should - Contain ' ForEach-Object'
@@ -103,9 +103,9 @@ Describe 'Scripts' {
103103 $commands.Name | Should -Not - Contain ' .'
104104 $commands.Name | Should -Not - Contain ' &'
105105 }
106- It ' Get-ASTScriptCommands gets the script commands with call operators' {
106+ It ' Get-AstScriptCommands gets the script commands with call operators' {
107107 $path = Join-Path $PSScriptRoot ' src\Test-Function.ps1'
108- $commands = Get-ASTScriptCommand - Path $path - IncludeCallOperators
108+ $commands = Get-AstScriptCommand - Path $path - IncludeCallOperators
109109 $commands | Should -Not - BeNullOrEmpty
110110 $commands | Should - BeOfType [pscustomobject ]
111111 $commands.Name | Should -Not - Contain ' ForEach-Object'
@@ -115,9 +115,9 @@ Describe 'Scripts' {
115115 $commands.Name | Should -Not - Contain ' .'
116116 $commands.Name | Should -Not - Contain ' &'
117117 }
118- It ' Get-ASTScriptCommands gets the script commands with call operators (recursive)' {
118+ It ' Get-AstScriptCommands gets the script commands with call operators (recursive)' {
119119 $path = Join-Path $PSScriptRoot ' src\Test-Function.ps1'
120- $commands = Get-ASTScriptCommand - Path $path - Recurse - IncludeCallOperators
120+ $commands = Get-AstScriptCommand - Path $path - Recurse - IncludeCallOperators
121121 $commands | Should -Not - BeNullOrEmpty
122122 $commands | Should - BeOfType [pscustomobject ]
123123 $commands.Name | Should - Contain ' ForEach-Object'
0 commit comments