t/187-commands-parser: shave off a bit of time by consolidating calls
This commit is contained in:
parent
b21a675a9c
commit
bee1e90b1e
|
@ -28,67 +28,52 @@ sub parser_calls {
|
||||||
# 1: First that the parser properly recognizes commands which are ok.
|
# 1: First that the parser properly recognizes commands which are ok.
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
# The first call has only a single command, the following ones are consolidated
|
||||||
|
# for performance.
|
||||||
is(parser_calls('move workspace 3'),
|
is(parser_calls('move workspace 3'),
|
||||||
'cmd_move_con_to_workspace_name(3)',
|
'cmd_move_con_to_workspace_name(3)',
|
||||||
'single number (move workspace 3) ok');
|
'single number (move workspace 3) ok');
|
||||||
|
|
||||||
is(parser_calls('move to workspace 3'),
|
is(parser_calls(
|
||||||
'cmd_move_con_to_workspace_name(3)',
|
'move to workspace 3; ' .
|
||||||
'to (move to workspace 3) ok');
|
'move window to workspace 3; ' .
|
||||||
|
'move container to workspace 3; ' .
|
||||||
is(parser_calls('move window to workspace 3'),
|
'move workspace foobar; ' .
|
||||||
'cmd_move_con_to_workspace_name(3)',
|
'move workspace 3: foobar; ' .
|
||||||
'window to (move window to workspace 3) ok');
|
'move workspace "3: foobar"; ' .
|
||||||
|
'move workspace "3: foobar, baz"; '),
|
||||||
is(parser_calls('move container to workspace 3'),
|
"cmd_move_con_to_workspace_name(3)\n" .
|
||||||
'cmd_move_con_to_workspace_name(3)',
|
"cmd_move_con_to_workspace_name(3)\n" .
|
||||||
'container to (move container to workspace 3) ok');
|
"cmd_move_con_to_workspace_name(3)\n" .
|
||||||
|
"cmd_move_con_to_workspace_name(foobar)\n" .
|
||||||
is(parser_calls('move workspace foobar'),
|
"cmd_move_con_to_workspace_name(3: foobar)\n" .
|
||||||
'cmd_move_con_to_workspace_name(foobar)',
|
"cmd_move_con_to_workspace_name(3: foobar)\n" .
|
||||||
'single word (move workspace foobar) ok');
|
"cmd_move_con_to_workspace_name(3: foobar, baz)",
|
||||||
|
'move ok');
|
||||||
is(parser_calls('move workspace 3: foobar'),
|
|
||||||
'cmd_move_con_to_workspace_name(3: foobar)',
|
|
||||||
'multiple words (move workspace 3: foobar) ok');
|
|
||||||
|
|
||||||
is(parser_calls('move workspace "3: foobar"'),
|
|
||||||
'cmd_move_con_to_workspace_name(3: foobar)',
|
|
||||||
'double quotes (move workspace "3: foobar") ok');
|
|
||||||
|
|
||||||
is(parser_calls('move workspace "3: foobar, baz"'),
|
|
||||||
'cmd_move_con_to_workspace_name(3: foobar, baz)',
|
|
||||||
'quotes with comma (move workspace "3: foobar, baz") ok');
|
|
||||||
|
|
||||||
is(parser_calls('move workspace 3: foobar, nop foo'),
|
is(parser_calls('move workspace 3: foobar, nop foo'),
|
||||||
"cmd_move_con_to_workspace_name(3: foobar)\n" .
|
"cmd_move_con_to_workspace_name(3: foobar)\n" .
|
||||||
"cmd_nop(foo)",
|
"cmd_nop(foo)",
|
||||||
'multiple ops (move workspace 3: foobar, nop foo) ok');
|
'multiple ops (move workspace 3: foobar, nop foo) ok');
|
||||||
|
|
||||||
is(parser_calls('exec i3-sensible-terminal'),
|
is(parser_calls(
|
||||||
'cmd_exec((null), i3-sensible-terminal)',
|
'exec i3-sensible-terminal; ' .
|
||||||
|
'exec --no-startup-id i3-sensible-terminal'),
|
||||||
|
"cmd_exec((null), i3-sensible-terminal)\n" .
|
||||||
|
"cmd_exec(--no-startup-id, i3-sensible-terminal)",
|
||||||
'exec ok');
|
'exec ok');
|
||||||
|
|
||||||
is(parser_calls('exec --no-startup-id i3-sensible-terminal'),
|
is(parser_calls(
|
||||||
'cmd_exec(--no-startup-id, i3-sensible-terminal)',
|
'resize shrink left; ' .
|
||||||
'exec --no-startup-id ok');
|
'resize shrink left 25 px; ' .
|
||||||
|
'resize shrink left 25 px or 33 ppt; ' .
|
||||||
is(parser_calls('resize shrink left'),
|
'resize shrink left 25'),
|
||||||
'cmd_resize(shrink, left, 10, 10)',
|
"cmd_resize(shrink, left, 10, 10)\n" .
|
||||||
|
"cmd_resize(shrink, left, 25, 10)\n" .
|
||||||
|
"cmd_resize(shrink, left, 25, 33)\n" .
|
||||||
|
"cmd_resize(shrink, left, 25, 10)",
|
||||||
'simple resize ok');
|
'simple resize ok');
|
||||||
|
|
||||||
is(parser_calls('resize shrink left 25 px'),
|
|
||||||
'cmd_resize(shrink, left, 25, 10)',
|
|
||||||
'px resize ok');
|
|
||||||
|
|
||||||
is(parser_calls('resize shrink left 25 px or 33 ppt'),
|
|
||||||
'cmd_resize(shrink, left, 25, 33)',
|
|
||||||
'px + ppt resize ok');
|
|
||||||
|
|
||||||
is(parser_calls('resize shrink left 25 px or 33 ppt'),
|
|
||||||
'cmd_resize(shrink, left, 25, 33)',
|
|
||||||
'px + ppt resize ok');
|
|
||||||
|
|
||||||
is(parser_calls('resize shrink left 25 px or 33 ppt,'),
|
is(parser_calls('resize shrink left 25 px or 33 ppt,'),
|
||||||
'cmd_resize(shrink, left, 25, 33)',
|
'cmd_resize(shrink, left, 25, 33)',
|
||||||
'trailing comma resize ok');
|
'trailing comma resize ok');
|
||||||
|
@ -97,10 +82,6 @@ is(parser_calls('resize shrink left 25 px or 33 ppt;'),
|
||||||
'cmd_resize(shrink, left, 25, 33)',
|
'cmd_resize(shrink, left, 25, 33)',
|
||||||
'trailing semicolon resize ok');
|
'trailing semicolon resize ok');
|
||||||
|
|
||||||
is(parser_calls('resize shrink left 25'),
|
|
||||||
'cmd_resize(shrink, left, 25, 10)',
|
|
||||||
'resize early end ok');
|
|
||||||
|
|
||||||
is(parser_calls('[con_mark=yay] focus'),
|
is(parser_calls('[con_mark=yay] focus'),
|
||||||
"cmd_criteria_add(con_mark, yay)\n" .
|
"cmd_criteria_add(con_mark, yay)\n" .
|
||||||
"cmd_focus()",
|
"cmd_focus()",
|
||||||
|
|
Loading…
Reference in New Issue