go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/providers/os/resources/parse_test.go (about) 1 // Copyright (c) Mondoo, Inc. 2 // SPDX-License-Identifier: BUSL-1.1 3 4 package resources_test 5 6 import ( 7 "testing" 8 9 "go.mondoo.com/cnquery/providers-sdk/v1/testutils" 10 ) 11 12 func TestParsePlist(t *testing.T) { 13 x.TestSimple(t, []testutils.SimpleTest{ 14 { 15 Code: "parse.plist('/dummy.plist').params['allowdownloadsignedenabled']", 16 ResultIndex: 0, 17 // validates that the output is not uint64 18 Expectation: float64(1), 19 }, 20 }) 21 } 22 23 func TestParseJson(t *testing.T) { 24 x.TestSimple(t, []testutils.SimpleTest{ 25 { 26 Code: "parse.json(content: '{\"a\": 1}').params", 27 ResultIndex: 0, 28 Expectation: map[string]interface{}{"a": float64(1)}, 29 }, 30 { 31 Code: "parse.json(content: '[{\"a\": 1}]').params[0]", 32 ResultIndex: 0, 33 Expectation: map[string]interface{}{"a": float64(1)}, 34 }, 35 }) 36 }