#!perl
# vim:ts=4:sw=4:expandtab
#
+# Please read the following documents before working on tests:
+# • http://build.i3wm.org/docs/testsuite.html
+# (or docs/testsuite)
+#
+# • http://build.i3wm.org/docs/lib-i3test.html
+# (alternatively: perldoc ./testcases/lib/i3test.pm)
+#
+# • http://build.i3wm.org/docs/ipc.html
+# (or docs/ipc)
+#
+# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
+# (unless you are already familiar with Perl)
+#
# Tests the standalone parser binary to see if it calls the right code when
# confronted with various commands, if it prints proper error messages for
# wrong commands and if it terminates in every case.
# TODO: use a timeout, so that we can error out if it doesn’t terminate
# TODO: better way of passing arguments
- my $stdout = qx(../test.commands_parser '$command' 2>&-);
+ my $stdout = qx(../test.commands_parser '$command' 2>&1 >&-);
# Filter out all debugging output.
my @lines = split("\n", $stdout);
'move window to workspace 3; ' .
'move container to workspace 3; ' .
'move workspace foobar; ' .
+ 'move workspace torrent; ' .
+ 'move workspace to output LVDS1; ' .
'move workspace 3: foobar; ' .
'move workspace "3: foobar"; ' .
'move workspace "3: foobar, baz"; '),
"cmd_move_con_to_workspace_name(3)\n" .
"cmd_move_con_to_workspace_name(3)\n" .
"cmd_move_con_to_workspace_name(foobar)\n" .
+ "cmd_move_con_to_workspace_name(torrent)\n" .
+ "cmd_move_workspace_to_output(LVDS1)\n" .
"cmd_move_con_to_workspace_name(3: foobar)\n" .
"cmd_move_con_to_workspace_name(3: foobar)\n" .
"cmd_move_con_to_workspace_name(3: foobar, baz)",
################################################################################
is(parser_calls('unknown_literal'),
- "Expected one of these tokens: <end>, '[', 'move', 'exec', 'exit', 'restart', 'reload', 'border', 'layout', 'append_layout', 'workspace', 'focus', 'kill', 'open', 'fullscreen', 'split', 'floating', 'mark', 'resize', 'rename', 'nop', 'scratchpad', 'mode'\n" .
- "Your command: unknown_literal\n" .
- " ^^^^^^^^^^^^^^^",
+ "ERROR: Expected one of these tokens: <end>, '[', 'move', 'exec', 'exit', 'restart', 'reload', 'border', 'layout', 'append_layout', 'workspace', 'focus', 'kill', 'open', 'fullscreen', 'split', 'floating', 'mark', 'resize', 'rename', 'nop', 'scratchpad', 'mode'\n" .
+ "ERROR: Your command: unknown_literal\n" .
+ "ERROR: ^^^^^^^^^^^^^^^",
'error for unknown literal ok');
is(parser_calls('move something to somewhere'),
- "Expected one of these tokens: 'window', 'container', 'to', 'workspace', 'output', 'scratchpad', 'left', 'right', 'up', 'down', 'position', 'absolute'\n" .
- "Your command: move something to somewhere\n" .
- " ^^^^^^^^^^^^^^^^^^^^^^",
+ "ERROR: Expected one of these tokens: 'window', 'container', 'to', 'workspace', 'output', 'scratchpad', 'left', 'right', 'up', 'down', 'position', 'absolute'\n" .
+ "ERROR: Your command: move something to somewhere\n" .
+ "ERROR: ^^^^^^^^^^^^^^^^^^^^^^",
'error for unknown literal ok');
################################################################################