@@ -16,26 +16,42 @@ Describe "UseCorrectCasing" {
1616 Invoke-Formatter ' ?' | Should - Be ' ?'
1717 }
1818
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'
2522 }
2623
2724 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'
3227 }
3328
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"
3835 }
36+ Invoke-Formatter " . $applicationPath " | Should - Be " . $applicationPath "
37+ }
38+
39+ It " Corrects case of script function" {
40+ function Invoke-DummyFunction { }
3941 Invoke-Formatter ' invoke-dummyFunction' | Should - Be ' Invoke-DummyFunction'
4042 }
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+ }
4157}
0 commit comments