File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,23 @@ Describe "Test Path" {
124
124
}
125
125
}
126
126
127
+ Context " DiagnosticRecord " {
128
+ It " has valid ScriptPath and ScriptName properties when an input file is given" {
129
+ $scriptName = " TestScript.ps1"
130
+ $scriptPath = Join-Path $directory $scriptName
131
+ $expectedScriptPath = Resolve-Path $directory \TestScript.ps1
132
+ $diagnosticRecords = Invoke-ScriptAnalyzer $scriptPath - IncludeRule " PSAvoidUsingEmptyCatchBlock"
133
+ $diagnosticRecords [0 ].ScriptPath | Should Be $expectedScriptPath.Path
134
+ $diagnosticRecords [0 ].ScriptName | Should Be $scriptName
135
+ }
136
+
137
+ It " has empty ScriptPath and ScriptName properties when a script definition is given" {
138
+ $diagnosticRecords = Invoke-ScriptAnalyzer - ScriptDefinition gci - IncludeRule " PSAvoidUsingCmdletAliases"
139
+ $diagnosticRecords [0 ].ScriptPath | Should Be ([System.String ]::Empty)
140
+ $diagnosticRecords [0 ].ScriptName | Should Be ([System.String ]::Empty)
141
+ }
142
+ }
143
+
127
144
if (! $testingLibraryUsage )
128
145
{
129
146
# There is probably a more concise way to do this but for now we will settle for this!
@@ -177,7 +194,6 @@ Describe "Test Path" {
177
194
Write-Output $writeHostViolation.Count
178
195
$globalVarsViolation.Count -eq 1 -and $writeHostViolation.Count -eq 1 | Should Be $true
179
196
}
180
-
181
197
}
182
198
}
183
199
You can’t perform that action at this time.
0 commit comments