Encoding for New-ModuleManifest on all platforms should be UTF-8 NoBOM (#5923)

* encoding for new-modulemanifest on all platforms should be utf8nobom
* fix test
This commit is contained in:
Steve Lee
2018-01-17 16:37:53 -08:00
committed by Aditya Patwardhan
parent d3a775da9a
commit 7437f3dd3a
2 changed files with 18 additions and 26 deletions
@@ -1,6 +1,6 @@
Describe "New-ModuleManifest tests" -tags "CI" {
BeforeEach {
New-Item -ItemType Directory -Path testdrive:/module
$null = New-Item -ItemType Directory -Path testdrive:/module
$testModulePath = "testdrive:/module/test.psd1"
}
@@ -9,13 +9,10 @@ Describe "New-ModuleManifest tests" -tags "CI" {
}
BeforeAll {
if ($IsWindows)
{
$ExpectedManifestBytes = @(255,254,35,0,13,0,10,0)
}
else
{
$ExpectedManifestBytes = @(35,10)
if ($IsWindows) {
$ExpectedManifestBytes = @(35,13) # CR
} else {
$ExpectedManifestBytes = @(35,10) # LF
}
}
@@ -38,10 +35,9 @@ Describe "New-ModuleManifest tests" -tags "CI" {
}
It "Verify module manifest encoding" {
# verify first line of the manifest:
# on Windows platforms - 3 characters - '#' '\r' '\n' - in UTF-16 with BOM - this should be @(255,254,35,0,13,0,10,0)
# on non-Windows platforms - 2 characters - '#' '\n' - in UTF-8 no BOM - this should be @(35,10)
# 2 characters - '#' '\n' - in UTF-8 no BOM - this should be @(35,10)
TestNewModuleManifestEncoding -expected $ExpectedManifestBytes
}