You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Tests/poshspec.Tests.ps1
+16-3Lines changed: 16 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -189,10 +189,10 @@ Describe 'Test Functions' {
189
189
}
190
190
191
191
It 'Should return a correct text expression' {
192
-
$results.Expression| Should Be "Get-Package -Name 'Microsoft Visual Studio Code' -ErrorAction SilentlyContinue | Should Not BeNullOrEmpty"
192
+
$results.Expression| Should Be 'Get-Package -Name "Microsoft Visual Studio Code" -ErrorAction SilentlyContinue | Select-Object -First 1 | Should Not BeNullOrEmpty'
193
193
}
194
194
}
195
-
195
+
196
196
Context 'Package w/ properties' {
197
197
198
198
$results= Package 'Microsoft Visual Studio Code' version { Should be '1.1.0' }
@@ -202,7 +202,20 @@ Describe 'Test Functions' {
202
202
}
203
203
204
204
It 'Should return a correct text expression' {
205
-
$results.Expression| Should Be "Get-Package -Name 'Microsoft Visual Studio Code' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty 'version' | Should be '1.1.0'"
205
+
$results.Expression| Should Be "Get-Package -Name ""Microsoft Visual Studio Code"" -ErrorAction SilentlyContinue | Select-Object -First 1 | Select-Object -ExpandProperty 'version' | Should be '1.1.0'"
206
+
}
207
+
}
208
+
209
+
Context 'Package w/Single Quotes' {
210
+
211
+
$results= Package "Name 'subname'" { Should Not BeNullOrEmpty }
212
+
213
+
It 'Should return a correct test name' {
214
+
$results.Name| Should Be "Package 'Name 'subname'' Should Not BeNullOrEmpty"
215
+
}
216
+
217
+
It 'Should return a correct text expression' {
218
+
$results.Expression| Should Be "Get-Package -Name ""Name 'subname'"" -ErrorAction SilentlyContinue | Select-Object -First 1 | Should Not BeNullOrEmpty"
0 commit comments