6 use Test::More tests => 8;
9 use_ok( 'WebPAC::Test' );
10 use_ok( 'WebPAC::Output' );
14 '000' => { foo => [ 42 ], bar => 'bug!' },
16 { a => '900a1', b => '900b1' },
17 { a => '900a2', b => '900b2' },
18 { a => '900a3', b => '900b3' },
21 { a => '900a1', b => '900b1' },
24 'StRaNgE!Field' => { foo => 'value' },
26 'array' => { foo => [ 'a' .. 'c' ] },
30 ok( $hash = WebPAC::Output->ds_to_hash( $ds, 'foo' ), 'ds_to_hash' );
31 diag dump($hash) if $debug;
35 { a => "900a1", b => "900b1" },
36 { a => "900a2", b => "900b2" },
37 { a => "900a3", b => "900b3" },
39 902 => [{ a => "900a1", b => "900b1" }],
40 array => ["a", "b", "c"],
41 strange_field => "value",
44 ok( $hash = WebPAC::Output->ds_to_hash( $ds, 'foo', disable_key_mungle => 1 ), 'ds_to_hash disable_key_mungle' );
45 diag dump($hash) if $debug;
49 { a => "900a1", b => "900b1" },
50 { a => "900a2", b => "900b2" },
51 { a => "900a3", b => "900b3" },
53 902 => [{ a => "900a1", b => "900b1" }],
54 array => ["a", "b", "c"],
55 'StRaNgE!Field' => "value",
58 ok( $hash = WebPAC::Output->ds_to_hash( $ds, 'foo', single_values => 1 ), 'ds_to_hash single_values' );
59 diag dump($hash) if $debug;
62 900 => "{ a => \"900a1\", b => \"900b1\" } { a => \"900a2\", b => \"900b2\" } { a => \"900a3\", b => \"900b3\" }",
63 902 => "{ a => \"900a1\", b => \"900b1\" }",
65 strange_field => "value",