mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Remove pre-parse for array-based JSON (#15684)
This commit is contained in:
@@ -58,7 +58,15 @@ Describe 'ConvertFrom-Json Unit Tests' -tags "CI" {
|
||||
$json | Should -BeOfType Hashtable
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
It 'Throws an ArgumentException with an incomplete array with AsHashtable switch set to <AsHashtable>' -TestCase $testCasesWithAndWithoutAsHashtableSwitch {
|
||||
Param($AsHashtable)
|
||||
{ ConvertFrom-Json '["1",' -AsHashtable:$AsHashtable } |
|
||||
Should -Throw -ErrorId "System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand"
|
||||
{ ConvertFrom-Json '[' -AsHashtable:$AsHashtable } |
|
||||
Should -Throw -ErrorId "System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand"
|
||||
}
|
||||
|
||||
It 'Can convert multi-line object with AsHashtable switch set to <AsHashtable>' -TestCases $testCasesWithAndWithoutAsHashtableSwitch {
|
||||
Param($AsHashtable)
|
||||
$json = @('{"a" :', '"x"}') | ConvertFrom-Json -AsHashtable:$AsHashtable
|
||||
|
||||
Reference in New Issue
Block a user