forked from ScoopInstaller/Scoop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(config): Move configuration handling to core.ps1
- Migrate ~\.scoop to ~\.config\scoop\config.json - Remove hashtable and hashtable_val functions because ConvertFrom-Json is enough - Add PowerShell 6 time conversion to tests
- Loading branch information
Showing
3 changed files
with
89 additions
and
107 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
. "$psscriptroot\..\lib\core.ps1" | ||
. "$psscriptroot\..\lib\config.ps1" | ||
|
||
describe "hashtable" -Tag 'Scoop' { | ||
$json = '{ "one": 1, "two": [ { "a": "a" }, "b", 2 ], "three": { "four": 4 }, "five": true, "six": false, "seven": "\/Date(1529917395805)\/" }' | ||
$json = '{ "one": 1, "two": [ { "a": "a" }, "b", 2 ], "three": { "four": 4 }, "five": true, "six": false, "seven": "\/Date(1529917395805)\/", "eight": "2019-03-18T15:22:09.3930000+01:00" }' | ||
|
||
it "converts pscustomobject to hashtable" { | ||
$obj = convertfrom-json $json | ||
$ht = hashtable $obj | ||
$obj = ConvertFrom-Json $json | ||
|
||
$ht.one | should -beexactly 1 | ||
$ht.two[0].a | should -be "a" | ||
$ht.two[1] | should -be "b" | ||
$ht.two[2] | should -beexactly 2 | ||
$ht.three.four | should -beexactly 4 | ||
$ht.five | should -beexactly $true | ||
$ht.six | should -beexactly $false | ||
[System.DateTime]::Equals($ht.seven, $(New-Object System.DateTime (2018, 06, 25, 09, 03, 15, 805))) | should -betrue | ||
$obj.one | should -beexactly 1 | ||
$obj.two[0].a | should -be "a" | ||
$obj.two[1] | should -be "b" | ||
$obj.two[2] | should -beexactly 2 | ||
$obj.three.four | should -beexactly 4 | ||
$obj.five | should -beexactly $true | ||
$obj.six | should -beexactly $false | ||
[System.DateTime]::Equals($obj.seven, $(New-Object System.DateTime (2018, 06, 25, 09, 03, 15, 805))) | should -betrue | ||
[System.DateTime]::Equals([System.DateTime]::parse($obj.eight), $(New-Object System.DateTime (2019, 03, 18, 15, 22, 09, 393))) | should -betrue | ||
} | ||
} |