+ $window->map;
+ return $window;
+}
+
+sub test_workspace_assignment {
+ my $target_ws = "@_";
+
+ # initialize the target workspace, then go to a fresh one
+ ok(!($target_ws ~~ @{get_workspace_names()}), "$target_ws does not exist yet");
+ cmd "workspace $target_ws";
+ cmp_ok(@{get_ws_content($target_ws)}, '==', 0, "no containers on $target_ws yet");
+ cmd 'open';
+ cmp_ok(@{get_ws_content($target_ws)}, '==', 1, "one container on $target_ws");
+ my $tmp = fresh_workspace;
+
+ ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
+ ok($target_ws ~~ @{get_workspace_names()}, "$target_ws does not exist yet");
+
+ # We use sync_with_i3 instead of wait_for_map here because i3 will not actually
+ # map the window -- it will be assigned to a different workspace and will only
+ # be mapped once you switch to that workspace
+ my $window = open_special(dont_map => 1);
+ $window->map;
+ sync_with_i3;
+
+ ok(@{get_ws_content($tmp)} == 0, 'still no containers');
+ ok(@{get_ws_content($target_ws)} == 2, "two containers on $target_ws");
+
+ return $window