X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=testcases%2Ft%2F116-nestedcons.t;h=3a495e2788d5ee6842c745197fc96977511cb27e;hb=5a29e61a4605cb3a1a9333d8e85d9afdc6b51ab1;hp=4b3958a1eb4ec09bc94f15802f325a363649b893;hpb=ae1ab9eb273cd2e75f834500d7386d81a925f753;p=i3%2Fi3 diff --git a/testcases/t/116-nestedcons.t b/testcases/t/116-nestedcons.t index 4b3958a1..3a495e27 100644 --- a/testcases/t/116-nestedcons.t +++ b/testcases/t/116-nestedcons.t @@ -29,28 +29,46 @@ my $i3 = i3(get_socket_path()); my $tree = $i3->get_tree->recv; +# a unique value +my $ignore = \""; + my $expected = { fullscreen_mode => 0, - nodes => ignore(), + nodes => $ignore, window => undef, name => 'root', - orientation => ignore(), + orientation => $ignore, type => 0, - id => ignore(), - rect => ignore(), - window_rect => ignore(), - geometry => ignore(), - swallows => ignore(), + id => $ignore, + rect => $ignore, + window_rect => $ignore, + geometry => $ignore, + swallows => $ignore, percent => undef, layout => 'default', - focus => ignore(), + floating => 'auto_off', + scratchpad_state => 'none', + focus => $ignore, focused => JSON::XS::false, urgent => JSON::XS::false, border => 'normal', - 'floating_nodes' => ignore(), + 'floating_nodes' => $ignore, }; -cmp_deeply($tree, $expected, 'root node OK'); +# a shallow copy is sufficient, since we only ignore values at the root +my $tree_copy = { %$tree }; + +for (keys %$expected) { + my $val = $expected->{$_}; + + # delete unwanted keys, so we can use is_deeply() + if (ref($val) eq 'SCALAR' and $val == $ignore) { + delete $tree_copy->{$_}; + delete $expected->{$_}; + } +} + +is_deeply($tree_copy, $expected, 'root node OK'); my @nodes = @{$tree->{nodes}};