@@ -16,26 +16,42 @@ Describe "UseCorrectCasing" {
16
16
Invoke-Formatter ' ?' | Should - Be ' ?'
17
17
}
18
18
19
- It " Corrects applications on Windows to not end in .exe" - Skip:($IsLinux -or $IsMacOS ) {
20
- Invoke-Formatter ' Cmd' | Should - Be ' cmd'
21
- Invoke-Formatter ' Cmd' | Should - Be ' cmd'
22
- Invoke-Formatter ' MORE' | Should - Be ' more'
23
- Invoke-Formatter ' WinRM' | Should - Be ' winrm'
24
- Invoke-Formatter ' CertMgr' | Should - Be ' certmgr'
19
+ It " Does not corrects applications on the PATH" - Skip:($IsLinux -or $IsMacOS ) {
20
+ Invoke-Formatter ' Cmd' | Should - Be ' Cmd'
21
+ Invoke-Formatter ' MORE' | Should - Be ' MORE'
25
22
}
26
23
27
24
It " Preserves extension of applications on Windows" - Skip:($IsLinux -or $IsMacOS ) {
28
- Invoke-Formatter ' Cmd.exe' | Should - Be ' cmd.exe'
29
- Invoke-Formatter ' MORE.com' | Should - Be ' more.com'
30
- Invoke-Formatter ' WinRM.cmd' | Should - Be ' winrm.cmd'
31
- Invoke-Formatter ' CertMgr.MSC' | Should - Be ' certmgr.msc'
25
+ Invoke-Formatter ' cmd.exe' | Should - Be ' cmd.exe'
26
+ Invoke-Formatter ' more.com' | Should - Be ' more.com'
32
27
}
33
28
34
- It " corrects case of script function" {
35
- function Invoke-DummyFunction
36
- {
37
-
29
+ It " Preserves full application path" {
30
+ if ($IsLinux -or $IsMacOS ) {
31
+ $applicationPath = ' . /bin/ls'
32
+ }
33
+ else {
34
+ $applicationPath = " ${env: WINDIR} \System32\cmd.exe"
38
35
}
36
+ Invoke-Formatter " . $applicationPath " | Should - Be " . $applicationPath "
37
+ }
38
+
39
+ It " Corrects case of script function" {
40
+ function Invoke-DummyFunction { }
39
41
Invoke-Formatter ' invoke-dummyFunction' | Should - Be ' Invoke-DummyFunction'
40
42
}
43
+
44
+ It " Preserves script path" {
45
+ $path = Join-Path $TestDrive " $ ( [guid ]::NewGuid()) .ps1"
46
+ New-Item - ItemType File - Path $path
47
+ $scriptDefinition = " . $path "
48
+ Invoke-Formatter $scriptDefinition | Should - Be $scriptDefinition
49
+ }
50
+
51
+ It " Preserves UNC script path" - Skip:($IsLinux -or $IsMacOS ) {
52
+ $uncPath = [System.IO.Path ]::Combine(" \\$ ( HOSTNAME.EXE ) \C$\" , $TestDrive , " $ ( [guid ]::NewGuid()) .ps1" )
53
+ New-Item - ItemType File - Path $uncPath
54
+ $scriptDefinition = " . $uncPath "
55
+ Invoke-Formatter $scriptDefinition | Should - Be $scriptDefinition
56
+ }
41
57
}
0 commit comments