Skip to content

Commit 223b974

Browse files
committed
Updated meta tests
1 parent f0d8881 commit 223b974

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

plugins/plaster/template/scaffold/tests/Meta/Meta.tests.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ if(-not $projectRoot) {
1111
}
1212

1313
Describe 'Text files formatting' -Tags @('MetaTest') {
14-
15-
$allTextFiles = Get-TextFilesList $projectRoot
16-
14+
$allTextFiles = Get-TextFilesList -root $projectRoot -Extension @('.gitignore', '.gitattributes', '.ps1', '.psm1', '.psd1', '.cmd', '.mof')
15+
$allTextFiles = $allTextFiles | Where-Object {$_.FullName -notlike '*\release\*'} | where-Object {$_.FullName -notlike '*\plugins\*'} | where-Object {$_.FullName -notlike '*\build\*'}
1716
Context 'Files encoding' {
1817
It "Doesn't use Unicode encoding" {
1918
$unicodeFilesCount = 0

plugins/plaster/template/scaffold/tests/Meta/MetaFixers.psm1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ function Get-TextFilesList {
4040
[OutputType([System.IO.FileInfo])]
4141
param(
4242
[Parameter(Mandatory = $true)]
43-
[string]$root
43+
[string]$root,
44+
[Parameter(Mandatory = $False)]
45+
[Array]$Extension = @('.gitignore', '.gitattributes', '.ps1', '.psm1', '.psd1', '.json', '.xml', '.cmd', '.mof')
4446
)
45-
Get-ChildItem -File -Recurse $root | Where-Object { @('.gitignore', '.gitattributes', '.ps1', '.psm1', '.psd1', '.json', '.xml', '.cmd', '.mof') -contains $_.Extension }
47+
Get-ChildItem -File -Recurse $root | Where-Object { $Extension -contains $_.Extension }
4648
}
4749

4850
function Test-FileUnicode {

tests/Meta/Meta.tests.ps1

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ if(-not $projectRoot) {
1111
}
1212

1313
Describe 'Text files formatting' -Tags @('MetaTest') {
14-
15-
$allTextFiles = Get-TextFilesList $projectRoot
16-
14+
$allTextFiles = Get-TextFilesList -root $projectRoot -Extension @('.gitignore', '.gitattributes', '.ps1', '.psm1', '.psd1', '.xml', '.json', '.cmd', '.mof')
15+
$allTextFiles = $allTextFiles | Where-Object {$_.FullName -notlike '*\release\*'} | where-Object {$_.FullName -notlike '*\plugins\*'} | where-Object {$_.FullName -notlike '*\build\*'}
1716
Context 'Files encoding' {
1817
It "Doesn't use Unicode encoding" {
1918
$unicodeFilesCount = 0
@@ -33,7 +32,7 @@ Describe 'Text files formatting' -Tags @('MetaTest') {
3332
$allTextFiles | Foreach-Object {
3433
$fileName = $_.FullName
3534
(Get-Content $_.FullName -Raw) | Select-String "`t" | Foreach-Object {
36-
Write-Warning "There are tab in $fileName."
35+
Write-Warning "There are tabs in $fileName."
3736
$totalTabsCount++
3837
}
3938
}

tests/Meta/MetaFixers.psm1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ function Get-TextFilesList {
4040
[OutputType([System.IO.FileInfo])]
4141
param(
4242
[Parameter(Mandatory = $true)]
43-
[string]$root
43+
[string]$root,
44+
[Parameter(Mandatory = $False)]
45+
[Array]$Extension = @('.gitignore', '.gitattributes', '.ps1', '.psm1', '.psd1', '.json', '.xml', '.cmd', '.mof')
4446
)
45-
Get-ChildItem -File -Recurse $root | Where-Object { @('.gitignore', '.gitattributes', '.ps1', '.psm1', '.psd1', '.json', '.xml', '.cmd', '.mof') -contains $_.Extension }
47+
Get-ChildItem -File -Recurse $root | Where-Object { $Extension -contains $_.Extension }
4648
}
4749

4850
function Test-FileUnicode {

0 commit comments

Comments
 (0)