-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBootstraPS.Tests.ps1
34 lines (33 loc) · 1.01 KB
/
BootstraPS.Tests.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Describe 'character encoding' {
$files = Get-ChildItem $PSScriptRoot -Recurse -File -Exclude *bom*.*,*Pester*.xml
It 'files do not use a UTF-8 byte order mark' {
foreach ( $file in $files )
{
$bytes = [System.IO.File]::ReadAllBytes($file.FullName)
try
{
$bytes[0..2] | Should -Not -Be 0xEF,0xBB,0xBF
}
catch
{
throw [System.Exception]::new(
$file.FullName,
$_.Exception
)
}
}
}
It '<n> uses LF linefeed endings' -TestCases @(
@{ n = "$PSScriptRoot\BootstraPS.psm1" }
@{ n = "$PSScriptRoot\readme.md" }
@{ n = "$PSScriptRoot\readme.md.source" }
@{ n = "$PSScriptRoot\webLoad.ps1" }
@{ n = "$PSScriptRoot\webLoad.ps1.source" }
) {
param ($n)
if ( (Get-Content $n -Raw -ea Stop) -match "\r\n" )
{
throw "$n has CRLF line endings"
}
}
}