From d02cda4241dc822096bada51ae5fc4c1d28485a3 Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Sat, 7 Mar 2020 00:04:05 +0000 Subject: [PATCH] ipc: always include marks property in TREE reply --- src/ipc.c | 16 ++++++---------- testcases/t/116-nestedcons.t | 1 + testcases/t/210-mark-unmark.t | 10 +++++----- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/ipc.c b/src/ipc.c index 08bdde33..100e1f70 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -410,17 +410,13 @@ void dump_node(yajl_gen gen, struct Con *con, bool inplace_restart) { ystr("urgent"); y(bool, con->urgent); - if (!TAILQ_EMPTY(&(con->marks_head))) { - ystr("marks"); - y(array_open); - - mark_t *mark; - TAILQ_FOREACH (mark, &(con->marks_head), marks) { - ystr(mark->name); - } - - y(array_close); + ystr("marks"); + y(array_open); + mark_t *mark; + TAILQ_FOREACH (mark, &(con->marks_head), marks) { + ystr(mark->name); } + y(array_close); ystr("focused"); y(bool, (con == focused)); diff --git a/testcases/t/116-nestedcons.t b/testcases/t/116-nestedcons.t index 4f13b1e5..6a2274d4 100644 --- a/testcases/t/116-nestedcons.t +++ b/testcases/t/116-nestedcons.t @@ -72,6 +72,7 @@ my $expected = { 'floating_nodes' => $ignore, workspace_layout => 'default', current_border_width => -1, + marks => $ignore, }; # a shallow copy is sufficient, since we only ignore values at the root diff --git a/testcases/t/210-mark-unmark.t b/testcases/t/210-mark-unmark.t index 32f898e6..0d9a073b 100644 --- a/testcases/t/210-mark-unmark.t +++ b/testcases/t/210-mark-unmark.t @@ -98,7 +98,7 @@ cmd 'focus left'; cmd 'mark important'; is_deeply(get_mark_for_window_on_workspace($tmp, $first), [ 'important' ], 'first container now has the mark'); -ok(!get_mark_for_window_on_workspace($tmp, $second), 'second container lost the mark'); +is_deeply(get_mark_for_window_on_workspace($tmp, $second), [], 'second container lost the mark'); ############################################################## # 5: mark a con, toggle the mark, check that the mark is gone @@ -107,7 +107,7 @@ ok(!get_mark_for_window_on_workspace($tmp, $second), 'second container lost the $con = open_window; cmd 'mark important'; cmd 'mark --toggle important'; -ok(!get_mark_for_window_on_workspace($tmp, $con), 'container no longer has the mark'); +is_deeply(get_mark_for_window_on_workspace($tmp, $con), [], 'container no longer has the mark'); ############################################################## # 6: toggle a mark on an unmarked con, check it is marked @@ -140,7 +140,7 @@ cmd 'focus left'; cmd 'mark --toggle important'; is_deeply(get_mark_for_window_on_workspace($tmp, $first), [ 'important' ], 'left container has the mark now'); -ok(!get_mark_for_window_on_workspace($tmp, $second), 'second containr no longer has the mark'); +is_deeply(get_mark_for_window_on_workspace($tmp, $second), [], 'second containr no longer has the mark'); ############################################################## # 9: try to mark two cons with the same mark and check that @@ -154,8 +154,8 @@ my $result = cmd "[instance=iamnotunique] mark important"; is($result->[0]->{success}, 0, 'command was unsuccessful'); is($result->[0]->{error}, 'A mark must not be put onto more than one window', 'correct error is returned'); -ok(!get_mark_for_window_on_workspace($tmp, $first), 'first container is not marked'); -ok(!get_mark_for_window_on_workspace($tmp, $second), 'second containr is not marked'); +is_deeply(get_mark_for_window_on_workspace($tmp, $first), [], 'first container is not marked'); +is_deeply(get_mark_for_window_on_workspace($tmp, $second), [], 'second containr is not marked'); ##############################################################