# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. # # Tests of the Json wrapper library.. # use Test::More; use strict; BEGIN { use_ok( 'Yahoo::Vespa::Json' ); *Json:: = *Yahoo::Vespa::Json:: # Alias namespace } require_ok( 'Yahoo::Vespa::Json' ); &testSimpleJson(); done_testing(); exit(0); sub testSimpleJson { my $json = <{'foo'}, 'bar', 'json test 1' ); is( $parsed->{'map'}->{'abc'}, 'def', 'json test 2' ); is( $parsed->{'map'}->{'num'}, 13.0, 'json test 3' ); my $prettyPrint = <{'map'}}; is( scalar @keys, 2, 'simple json test - map keys' ); is( $keys[0], 'abc', 'simple json test - map key 1' ); is( $keys[1], 'num', 'simple json test - map key 2' ); @keys = @{ $parsed->{'array'} }; is( scalar @keys, 2, 'simple json test - list keys' ); is( $keys[0]->{'val1'}, 3, 'simple json test - list key 1' ); is( $keys[1]->{'val2'}, 6, 'simple json test - list key 2' ); }