From 8c581a841daee4276af59d44fb37bab983af7c31 Mon Sep 17 00:00:00 2001 From: Gabriel Adrian Samfira Date: Sun, 15 Dec 2024 00:56:27 +0200 Subject: [PATCH] Revert "Fix losing case sensitive keys" This reverts commit 7980c7c9d579a534894fae9790a11b4d3765cc26. Signed-off-by: Gabriel Adrian Samfira --- Tests/powershell-yaml.Tests.ps1 | 9 --------- powershell-yaml.psm1 | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/Tests/powershell-yaml.Tests.ps1 b/Tests/powershell-yaml.Tests.ps1 index db55a59..c37c66f 100644 --- a/Tests/powershell-yaml.Tests.ps1 +++ b/Tests/powershell-yaml.Tests.ps1 @@ -693,13 +693,4 @@ int64: 9223372036854775807 } | Should -Not -Throw } } - - Describe 'Case insensitive keys in mappings' { - It 'should deserialize both keys' { - $yaml = '{"a": 1, "A": 2}' - $result = ConvertFrom-Yaml -Yaml $yaml - $result.a | Should -Be 1 - $result.A | Should -Be 2 - } - } } diff --git a/powershell-yaml.psm1 b/powershell-yaml.psm1 index 87398b4..0dabc31 100644 --- a/powershell-yaml.psm1 +++ b/powershell-yaml.psm1 @@ -244,7 +244,7 @@ function Convert-YamlMappingToHashtable { [switch] $Ordered ) PROCESS { - if ($Ordered) { $ret = [System.Collections.Specialized.OrderedDictionary]::new() } else { $ret = [hashtable]::new() } + if ($Ordered) { $ret = [ordered]@{} } else { $ret = @{} } foreach($i in $Node.Children.Keys) { $ret[$i.Value] = Convert-YamlDocumentToPSObject $Node.Children[$i] -Ordered:$Ordered }