1
- New-Item - Path ' foo[1].txt' - Force
1
+ # These Pester tests are for the for parameter-* and ex-path* snippets.
2
+ # Take a look at the .vscode\tasks.json file to see how you can create
3
+ # and configure a test task runner that will run all the Pester tests
4
+ # in your workspace folder.
2
5
3
- . $PSScriptRoot \PathProcessingNonExistingPaths.ps1
4
- Describe ' Verify Path Processing for Non-existing Paths Allowed Impl' {
6
+ # To run these Pester tests, press Ctrl+Shift+T or press Ctrl+Shift+P,
7
+ # type "test" and select "Tasks: Run Test Task". This will invoke the
8
+ # test task runner defined in .vscode\tasks.json.
9
+
10
+ # This (empty) file is required by some of the tests.
11
+ $null = New-Item - Path ' foo[1].txt' - Force
12
+
13
+ . $PSScriptRoot \PathProcessingNonExistingPaths.ps1
14
+ Describe ' Verify Path Processing for Non-existing Paths Allowed Impl' {
5
15
It ' Processes non-wildcard absolute path to non-existing file via -Path param' {
6
16
New-File - Path $PSScriptRoot \ReadmeNew.md | Should Be " $PSScriptRoot \READMENew.md"
7
17
}
8
18
It ' Processes multiple absolute paths via -Path param' {
9
- New-File - Path $PSScriptRoot \Readme.md, $PSScriptRoot \XYZZY.ps1 |
19
+ New-File - Path $PSScriptRoot \Readme.md, $PSScriptRoot \XYZZY.ps1 |
10
20
Should Be @ (" $PSScriptRoot \README.md" , " $PSScriptRoot \XYZZY.ps1" )
11
- }
21
+ }
12
22
It ' Processes relative path via -Path param' {
13
23
New-File - Path ..\examples\READMENew.md | Should Be " $PSScriptRoot \READMENew.md"
14
24
}
15
25
It ' Processes multiple relative path via -Path param' {
16
- New-File - Path ..\examples\README.md, XYZZY.ps1 |
26
+ New-File - Path ..\examples\README.md, XYZZY.ps1 |
17
27
Should Be @ (" $PSScriptRoot \README.md" , " $PSScriptRoot \XYZZY.ps1" )
18
28
}
19
-
29
+
20
30
It ' Should accept pipeline input to Path' {
21
31
Get-ChildItem - LiteralPath " $pwd \foo[1].txt" | New-File | Should Be " $PSScriptRoot \foo[1].txt"
22
- }
32
+ }
23
33
}
24
34
25
- . $PSScriptRoot \PathProcessingNoWildcards.ps1
26
- Describe ' Verify Path Processing for NO Wildcards Allowed Impl' {
35
+ . $PSScriptRoot \PathProcessingNoWildcards.ps1
36
+ Describe ' Verify Path Processing for NO Wildcards Allowed Impl' {
27
37
It ' Processes non-wildcard absolute path via -Path param' {
28
38
Import-FileNoWildcard - Path $PSScriptRoot \Readme.md | Should Be " $PSScriptRoot \README.md"
29
39
}
30
40
It ' Processes multiple absolute paths via -Path param' {
31
- Import-FileNoWildcard - Path $PSScriptRoot \Readme.md, $PSScriptRoot \PathProcessingWildcards.ps1 |
41
+ Import-FileNoWildcard - Path $PSScriptRoot \Readme.md, $PSScriptRoot \PathProcessingWildcards.ps1 |
32
42
Should Be @ (" $PSScriptRoot \README.md" , " $PSScriptRoot \PathProcessingWildcards.ps1" )
33
- }
43
+ }
34
44
It ' Processes relative path via -Path param' {
35
45
Import-FileNoWildcard - Path ..\examples\README.md | Should Be " $PSScriptRoot \README.md"
36
46
}
37
47
It ' Processes multiple relative path via -Path param' {
38
- Import-FileNoWildcard - Path ..\examples\README.md, .vscode\launch.json |
48
+ Import-FileNoWildcard - Path ..\examples\README.md, .vscode\launch.json |
39
49
Should Be @ (" $PSScriptRoot \README.md" , " $PSScriptRoot \.vscode\launch.json" )
40
50
}
41
-
51
+
42
52
It ' Should accept pipeline input to Path' {
43
53
Get-ChildItem - LiteralPath " $pwd \foo[1].txt" | Import-FileNoWildcard | Should Be " $PSScriptRoot \foo[1].txt"
44
- }
54
+ }
45
55
}
46
56
47
- . $PSScriptRoot \PathProcessingWildcards.ps1
48
- Describe ' Verify Path Processing for Wildcards Allowed Impl' {
57
+ . $PSScriptRoot \PathProcessingWildcards.ps1
58
+ Describe ' Verify Path Processing for Wildcards Allowed Impl' {
49
59
It ' Processes non-wildcard absolute path via -Path param' {
50
60
Import-FileWildcard - Path $PSScriptRoot \Readme.md | Should Be " $PSScriptRoot \README.md"
51
61
}
52
62
It ' Processes multiple absolute paths via -Path param' {
53
- Import-FileWildcard - Path $PSScriptRoot \Readme.md, $PSScriptRoot \PathProcessingWildcards.ps1 |
63
+ Import-FileWildcard - Path $PSScriptRoot \Readme.md, $PSScriptRoot \PathProcessingWildcards.ps1 |
54
64
Should Be @ (" $PSScriptRoot \README.md" , " $PSScriptRoot \PathProcessingWildcards.ps1" )
55
- }
65
+ }
56
66
It ' Processes wildcard absolute path via -Path param' {
57
67
Import-FileWildcard - Path $PSScriptRoot \* .md | Should Be " $PSScriptRoot \README.md"
58
68
}
@@ -63,26 +73,26 @@ Describe 'Verify Path Processing for Wildcards Allowed Impl' {
63
73
Import-FileWildcard - Path ..\examples\README.md | Should Be " $PSScriptRoot \README.md"
64
74
}
65
75
It ' Processes multiple relative path via -Path param' {
66
- Import-FileWildcard - Path ..\examples\README.md, .vscode\launch.json |
76
+ Import-FileWildcard - Path ..\examples\README.md, .vscode\launch.json |
67
77
Should Be @ (" $PSScriptRoot \README.md" , " $PSScriptRoot \.vscode\launch.json" )
68
78
}
69
-
79
+
70
80
It ' DefaultParameterSet should be Path' {
71
81
Import-FileWildcard * .md | Should Be " $PSScriptRoot \README.md"
72
82
}
73
-
83
+
74
84
It ' Should process absolute literal paths via -LiteralPath param' {
75
85
Import-FileWildcard - LiteralPath " $PSScriptRoot \foo[1].txt" | Should Be " $PSScriptRoot \foo[1].txt"
76
86
}
77
87
It ' Should process relative literal paths via -LiteralPath param' {
78
88
Import-FileWildcard - LiteralPath " ..\examples\foo[1].txt" | Should Be " $PSScriptRoot \foo[1].txt"
79
89
}
80
90
It ' Should process multiple literal paths via -LiteralPath param' {
81
- Import-FileWildcard - LiteralPath " ..\examples\foo[1].txt" , " $PSScriptRoot \README.md" |
91
+ Import-FileWildcard - LiteralPath " ..\examples\foo[1].txt" , " $PSScriptRoot \README.md" |
82
92
Should Be @ (" $PSScriptRoot \foo[1].txt" , " $PSScriptRoot \README.md" )
83
93
}
84
-
94
+
85
95
It ' Should accept pipeline input to LiteralPath' {
86
96
Get-ChildItem - LiteralPath " $pwd \foo[1].txt" | Import-FileWildcard | Should Be " $PSScriptRoot \foo[1].txt"
87
- }
97
+ }
88
98
}
0 commit comments