Skip to content

Commit 17601fd

Browse files
Updating tests
1 parent 6458ff2 commit 17601fd

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

templates/PSFModule/PSMDTemplate.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@{
22
TemplateName = 'PSFModule'
3-
Version = "1.1.0.0"
3+
Version = "1.1.1.0"
44
AutoIncrementVersion = $true
55
Tags = 'module','psframework'
66
Author = 'Friedrich Weinmann'

templates/PSFTests/general/FileIntegrity.Tests.ps1

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,16 @@ function Get-FileEncoding
2222
$Path
2323
)
2424

25-
[byte[]]$byte = get-content -Encoding byte -ReadCount 4 -TotalCount 4 -Path $Path
25+
if ($PSVersionTable.PSVersion.Major -lt 6)
26+
{
27+
[byte[]]$byte = get-content -Encoding byte -ReadCount 4 -TotalCount 4 -Path $Path
28+
}
29+
else
30+
{
31+
[byte[]]$byte = Get-Content -AsByteStream -ReadCount 4 -TotalCount 4 -Path $Path
32+
}
2633

27-
if ($byte[0] -eq 0xef -and $byte[1] -eq 0xbb -and $byte[2] -eq 0xbf) { 'UTF8' }
34+
if ($byte[0] -eq 0xef -and $byte[1] -eq 0xbb -and $byte[2] -eq 0xbf) { 'UTF8 BOM' }
2835
elseif ($byte[0] -eq 0xfe -and $byte[1] -eq 0xff) { 'Unicode' }
2936
elseif ($byte[0] -eq 0 -and $byte[1] -eq 0 -and $byte[2] -eq 0xfe -and $byte[3] -eq 0xff) { 'UTF32' }
3037
elseif ($byte[0] -eq 0x2b -and $byte[1] -eq 0x2f -and $byte[2] -eq 0x76) { 'UTF7' }
@@ -39,8 +46,8 @@ Describe "Verifying integrity of module files" {
3946
{
4047
$name = $file.FullName.Replace("$moduleRoot\", '')
4148

42-
It "[$name] Should have UTF8 encoding" {
43-
Get-FileEncoding -Path $file.FullName | Should -Be 'UTF8'
49+
It "[$name] Should have UTF8 encoding with Byte Order Mark" {
50+
Get-FileEncoding -Path $file.FullName | Should -Be 'UTF8 BOM'
4451
}
4552

4653
It "[$name] Should have no trailing space" {
@@ -64,10 +71,6 @@ Describe "Verifying integrity of module files" {
6471
}
6572
}
6673
}
67-
68-
It "[$name] Should not contain aliases" {
69-
$tokens | Where-Object TokenFlags -eq CommandName | Where-Object { Test-Path "alias:\$($_.Text)" } | Measure-Object | Select-Object -ExpandProperty Count | Should -Be 0
70-
}
7174
}
7275
}
7376

@@ -79,7 +82,7 @@ Describe "Verifying integrity of module files" {
7982
$name = $file.FullName.Replace("$moduleRoot\", '')
8083

8184
It "[$name] Should have UTF8 encoding" {
82-
Get-FileEncoding -Path $file.FullName | Should -Be 'UTF8'
85+
Get-FileEncoding -Path $file.FullName | Should -Be 'UTF8 BOM'
8386
}
8487

8588
It "[$name] Should have no trailing space" {

templates/PSFTests/general/Manifest.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
foreach ($assembly in $manifest.RequiredAssemblies)
4242
{
43-
if ($assembly -contains ".dll") {
43+
if ($assembly -like "*.dll") {
4444
It "The file $assembly should exist" {
4545
Test-Path "$moduleRoot\$assembly" | Should -Be $true
4646
}

0 commit comments

Comments
 (0)