Skip to content

Commit 1464ded

Browse files
Fix conformance lint failures
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 9385ea0 commit 1464ded

4 files changed

Lines changed: 36 additions & 19 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ commit `45db50ae`). The pinned archive contains 402 inputs:
177177
documented projection policy.
178178

179179
The two construction-policy differences are `565N`, where this module
180-
constructs `!!binary` as `byte[]` instead of a Base64 string, and `J7PZ`, where
180+
constructs `!!binary` as `byte[]` instead of a base64 string, and `J7PZ`, where
181181
the explicitly supported `!!omap` tag becomes an ordered dictionary instead of
182182
remaining a sequence of one-entry mappings. The deterministic runner reports
183183
398 passing cases, four policy exclusions, and no unexplained failures.

tests/Conformance.Tests.ps1

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ Describe 'Released yaml-test-suite corpus accounting' {
3939
@($suiteResults | Where-Object SyntaxResult -EQ 'Fail').Count | Should -Be 0
4040
@($suiteResults | Where-Object SyntaxResult -EQ 'NotApplicable').Count |
4141
Should -Be 0
42-
@(
42+
$syntaxPolicyCases = @(
4343
$suiteResults |
4444
Where-Object SyntaxResult -EQ 'PolicyDifference' |
4545
Select-Object -ExpandProperty Case |
4646
Sort-Object
47-
) | Should -Be @('2JQS', 'X38W')
47+
)
48+
$syntaxPolicyCases | Should -Be @('2JQS', 'X38W')
4849
}
4950

5051
It 'accounts for parser representation/event comparisons' {
@@ -63,12 +64,13 @@ Describe 'Released yaml-test-suite corpus accounting' {
6364
@($suiteResults | Where-Object JsonResult -EQ 'Fail').Count | Should -Be 0
6465
@($suiteResults | Where-Object JsonResult -EQ 'NotApplicable').Count |
6566
Should -Be 123
66-
@(
67+
$jsonPolicyCases = @(
6768
$suiteResults |
6869
Where-Object JsonResult -EQ 'PolicyDifference' |
6970
Select-Object -ExpandProperty Case |
7071
Sort-Object
71-
) | Should -Be @('565N', 'J7PZ')
72+
)
73+
$jsonPolicyCases | Should -Be @('565N', 'J7PZ')
7274
}
7375

7476
It 'accounts for out.yaml representation comparisons' {
@@ -90,14 +92,15 @@ Describe 'Released yaml-test-suite corpus accounting' {
9092
}
9193

9294
It 'keeps the previously failing multi-document JSON cases green' {
93-
@(
95+
$jsonRegressions = @(
9496
$suiteResults |
9597
Where-Object Case -In @(
9698
'35KP', '6XDY', '6ZKB', '7Z25', '9DXL',
9799
'9KAX', 'JHB9', 'KSS4', 'L383', 'M7A3',
98100
'PUW8', 'RZT7', 'U9NS', 'UT92', 'W4TN'
99101
) |
100102
Where-Object JsonResult -NE 'Pass'
101-
).Count | Should -Be 0
103+
)
104+
$jsonRegressions.Count | Should -Be 0
102105
}
103106
}

tests/Packaging.Tests.ps1

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,28 @@ $script:repositoryRoot = $null
1515
$script:resolvedArtifactManifestPath = $null
1616
$script:artifactManifestPath = $null
1717

18+
function Test-YamlArtifactManifestAvailable {
19+
[CmdletBinding()]
20+
[OutputType([bool])]
21+
param()
22+
23+
if (-not [string]::IsNullOrWhiteSpace($env:PSMODULE_YAML_TEST_ARTIFACT)) {
24+
return $true
25+
}
26+
$repositoryRoot = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot '..')).Path
27+
Test-Path -LiteralPath (Join-Path $repositoryRoot 'outputs\module\Yaml\Yaml.psd1') -PathType Leaf
28+
}
29+
30+
$artifactManifestAvailable = Test-YamlArtifactManifestAvailable
31+
1832
BeforeAll {
1933
. (Join-Path $PSScriptRoot 'TestBootstrap.ps1')
2034
$script:repositoryRoot = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot '..')).Path
2135
$defaultArtifactManifestPath = Join-Path $script:repositoryRoot 'outputs\module\Yaml\Yaml.psd1'
22-
$script:resolvedArtifactManifestPath = if (
23-
-not [string]::IsNullOrWhiteSpace($env:PSMODULE_YAML_TEST_ARTIFACT)
24-
) {
25-
$env:PSMODULE_YAML_TEST_ARTIFACT
26-
} elseif (Test-Path -LiteralPath $defaultArtifactManifestPath -PathType Leaf) {
36+
$script:resolvedArtifactManifestPath = if (Test-Path -LiteralPath $defaultArtifactManifestPath -PathType Leaf) {
2737
$defaultArtifactManifestPath
38+
} elseif (-not [string]::IsNullOrWhiteSpace($env:PSMODULE_YAML_TEST_ARTIFACT)) {
39+
$env:PSMODULE_YAML_TEST_ARTIFACT
2840
} else {
2941
$null
3042
}
@@ -85,8 +97,8 @@ Describe 'Dependency-free package source' {
8597
'ConvertTo-YamlNode.ps1',
8698
'Write-YamlNodeText.ps1'
8799
) | ForEach-Object {
88-
Test-Path -LiteralPath (Join-Path $privatePath $_) |
89-
Should -BeTrue -Because "$_ defines a required processor layer"
100+
$isPresent = Test-Path -LiteralPath (Join-Path $privatePath $_)
101+
$isPresent | Should -BeTrue -Because "$_ defines a required processor layer"
90102
}
91103
}
92104

@@ -121,7 +133,7 @@ Describe 'Dependency-free package source' {
121133

122134
Describe 'Generated artifact package' {
123135
It 'has no RequiredAssemblies or packaged DLL and has a complete FileList' `
124-
-Skip:([string]::IsNullOrWhiteSpace($env:PSMODULE_YAML_TEST_ARTIFACT) -and -not (Test-Path -LiteralPath (Join-Path (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot '..')).Path 'outputs\module\Yaml\Yaml.psd1') -PathType Leaf)) {
136+
-Skip:(-not $artifactManifestAvailable) {
125137
$manifest = Import-PowerShellDataFile -Path $script:artifactManifestPath
126138
$moduleBase = Split-Path -Parent $script:artifactManifestPath
127139

@@ -139,7 +151,9 @@ Describe 'Generated artifact package' {
139151
}
140152

141153
It 'imports in a fresh PowerShell 7 process and preserves arrays, aliases, and depth' `
142-
-Skip:(([string]::IsNullOrWhiteSpace($env:PSMODULE_YAML_TEST_ARTIFACT) -and -not (Test-Path -LiteralPath (Join-Path (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot '..')).Path 'outputs\module\Yaml\Yaml.psd1') -PathType Leaf)) -or $null -eq (Get-Command pwsh -ErrorAction SilentlyContinue)) {
154+
-Skip:((
155+
-not $artifactManifestAvailable
156+
) -or ($null -eq (Get-Command pwsh -ErrorAction SilentlyContinue))) {
143157
$script = @'
144158
$ErrorActionPreference = 'Stop'
145159
$ps = $PSVersionTable.PSVersion

tests/tools/Invoke-YamlTestSuite.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ function ConvertFrom-YamlSuiteEventText {
291291
$builder.ToString()
292292
}
293293

294-
function ConvertFrom-YamlSuiteEventEscapes {
294+
function ConvertFrom-YamlSuiteEventEscape {
295295
param ([AllowNull()][string] $Value)
296296
if ($null -eq $Value) {
297297
return ''
@@ -327,7 +327,7 @@ function ConvertFrom-YamlSuiteEventText {
327327
$lines = $Text -split '\r?\n'
328328

329329
foreach ($rawLine in $lines) {
330-
$line = $rawLine
330+
$line = $rawLine
331331
if ([string]::IsNullOrWhiteSpace($line)) {
332332
continue
333333
}
@@ -392,7 +392,7 @@ function ConvertFrom-YamlSuiteEventText {
392392
$value = ''
393393
}
394394
$value = ConvertTo-YamlSuiteEventEscapedText -Value (
395-
ConvertFrom-YamlSuiteEventEscapes -Value $value
395+
ConvertFrom-YamlSuiteEventEscape -Value $value
396396
)
397397
}
398398

0 commit comments

Comments
 (0)