my $stdout;
run [ '../test.config_parser', $command ],
- '>&-',
+ '>/dev/null',
'2>', \$stdout;
# TODO: use a timeout, so that we can error out if it doesn’t terminate
$expected,
'floating_minimum_size ok');
+################################################################################
+# popup_during_fullscreen
+################################################################################
+
+$config = <<'EOT';
+popup_during_fullscreen ignore
+popup_during_fullscreen leave_fullscreen
+popup_during_fullscreen SMArt
+EOT
+
+$expected = <<'EOT';
+cfg_popup_during_fullscreen(ignore)
+cfg_popup_during_fullscreen(leave_fullscreen)
+cfg_popup_during_fullscreen(smart)
+EOT
+
+is(parser_calls($config),
+ $expected,
+ 'popup_during_fullscreen ok');
+
+
################################################################################
# floating_modifier
################################################################################
client.focused #4c7899 #285577 #ffffff #2e9ef4
EOT
-$expected = <<'EOT';
+my $expected_all_tokens = <<'EOT';
ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'bindsym', 'bindcode', 'bind', 'bar', 'font', 'mode', 'floating_minimum_size', 'floating_maximum_size', 'floating_modifier', 'default_orientation', 'workspace_layout', 'new_window', 'new_float', 'hide_edge_borders', 'for_window', 'assign', 'focus_follows_mouse', 'force_focus_wrapping', 'force_xinerama', 'force-xinerama', 'workspace_auto_back_and_forth', 'fake_outputs', 'fake-outputs', 'force_display_urgency_hint', 'workspace', 'ipc_socket', 'ipc-socket', 'restart_state', 'popup_during_fullscreen', 'exec_always', 'exec', 'client.background', 'client.focused_inactive', 'client.focused', 'client.unfocused', 'client.urgent'
+EOT
+
+my $expected_end = <<'EOT';
ERROR: CONFIG: (in file <stdin>)
ERROR: CONFIG: Line 1: hide_edge_border both
ERROR: CONFIG: ^^^^^^^^^^^^^^^^^^^^^
cfg_color(client.focused, #4c7899, #285577, #ffffff, #2e9ef4)
EOT
+$expected = $expected_all_tokens . $expected_end;
+
is(parser_calls($config),
$expected,
'errors dont harm subsequent statements');
$expected,
'errors dont harm subsequent statements');
+################################################################################
+# Regression: semicolons end comments, but shouldn’t
+################################################################################
+
+$config = <<'EOT';
+# "foo" client.focused #4c7899 #285577 #ffffff #2e9ef4
+EOT
+
+$expected = <<'EOT';
+
+EOT
+
+is(parser_calls($config),
+ $expected,
+ 'semicolon does not end a comment line');
################################################################################
# Error message with 2+2 lines of context
# this should not show up
EOT
-$expected = <<'EOT';
+my $expected_head = <<'EOT';
cfg_font(foobar)
-ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'bindsym', 'bindcode', 'bind', 'bar', 'font', 'mode', 'floating_minimum_size', 'floating_maximum_size', 'floating_modifier', 'default_orientation', 'workspace_layout', 'new_window', 'new_float', 'hide_edge_borders', 'for_window', 'assign', 'focus_follows_mouse', 'force_focus_wrapping', 'force_xinerama', 'force-xinerama', 'workspace_auto_back_and_forth', 'fake_outputs', 'fake-outputs', 'force_display_urgency_hint', 'workspace', 'ipc_socket', 'ipc-socket', 'restart_state', 'popup_during_fullscreen', 'exec_always', 'exec', 'client.background', 'client.focused_inactive', 'client.focused', 'client.unfocused', 'client.urgent'
+EOT
+
+my $expected_tail = <<'EOT';
ERROR: CONFIG: (in file <stdin>)
ERROR: CONFIG: Line 3: font foobar
ERROR: CONFIG: Line 4:
ERROR: CONFIG: Line 7: # yay
EOT
+$expected = $expected_head . $expected_all_tokens . $expected_tail;
+
is(parser_calls($config),
$expected,
'error message (2+2 context) ok');
unknown qux
EOT
-$expected = <<'EOT';
-ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'bindsym', 'bindcode', 'bind', 'bar', 'font', 'mode', 'floating_minimum_size', 'floating_maximum_size', 'floating_modifier', 'default_orientation', 'workspace_layout', 'new_window', 'new_float', 'hide_edge_borders', 'for_window', 'assign', 'focus_follows_mouse', 'force_focus_wrapping', 'force_xinerama', 'force-xinerama', 'workspace_auto_back_and_forth', 'fake_outputs', 'fake-outputs', 'force_display_urgency_hint', 'workspace', 'ipc_socket', 'ipc-socket', 'restart_state', 'popup_during_fullscreen', 'exec_always', 'exec', 'client.background', 'client.focused_inactive', 'client.focused', 'client.unfocused', 'client.urgent'
+$expected_tail = <<'EOT';
ERROR: CONFIG: (in file <stdin>)
ERROR: CONFIG: Line 1: unknown qux
ERROR: CONFIG: ^^^^^^^^^^^
EOT
+$expected = $expected_all_tokens . $expected_tail;
+
is(parser_calls($config),
$expected,
'error message (0+0 context) ok');
unknown qux
EOT
-$expected = <<'EOT';
-ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'bindsym', 'bindcode', 'bind', 'bar', 'font', 'mode', 'floating_minimum_size', 'floating_maximum_size', 'floating_modifier', 'default_orientation', 'workspace_layout', 'new_window', 'new_float', 'hide_edge_borders', 'for_window', 'assign', 'focus_follows_mouse', 'force_focus_wrapping', 'force_xinerama', 'force-xinerama', 'workspace_auto_back_and_forth', 'fake_outputs', 'fake-outputs', 'force_display_urgency_hint', 'workspace', 'ipc_socket', 'ipc-socket', 'restart_state', 'popup_during_fullscreen', 'exec_always', 'exec', 'client.background', 'client.focused_inactive', 'client.focused', 'client.unfocused', 'client.urgent'
+$expected_tail = <<'EOT';
ERROR: CONFIG: (in file <stdin>)
ERROR: CONFIG: Line 1: # context before
ERROR: CONFIG: Line 2: unknown qux
ERROR: CONFIG: ^^^^^^^^^^^
EOT
+$expected = $expected_all_tokens . $expected_tail;
+
is(parser_calls($config),
$expected,
'error message (1+0 context) ok');
# context after
EOT
-$expected = <<'EOT';
-ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'bindsym', 'bindcode', 'bind', 'bar', 'font', 'mode', 'floating_minimum_size', 'floating_maximum_size', 'floating_modifier', 'default_orientation', 'workspace_layout', 'new_window', 'new_float', 'hide_edge_borders', 'for_window', 'assign', 'focus_follows_mouse', 'force_focus_wrapping', 'force_xinerama', 'force-xinerama', 'workspace_auto_back_and_forth', 'fake_outputs', 'fake-outputs', 'force_display_urgency_hint', 'workspace', 'ipc_socket', 'ipc-socket', 'restart_state', 'popup_during_fullscreen', 'exec_always', 'exec', 'client.background', 'client.focused_inactive', 'client.focused', 'client.unfocused', 'client.urgent'
+$expected_tail = <<'EOT';
ERROR: CONFIG: (in file <stdin>)
ERROR: CONFIG: Line 1: unknown qux
ERROR: CONFIG: ^^^^^^^^^^^
ERROR: CONFIG: Line 2: # context after
EOT
+$expected = $expected_all_tokens . $expected_tail;
+
is(parser_calls($config),
$expected,
'error message (0+1 context) ok');
# context 2 after
EOT
-$expected = <<'EOT';
-ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'bindsym', 'bindcode', 'bind', 'bar', 'font', 'mode', 'floating_minimum_size', 'floating_maximum_size', 'floating_modifier', 'default_orientation', 'workspace_layout', 'new_window', 'new_float', 'hide_edge_borders', 'for_window', 'assign', 'focus_follows_mouse', 'force_focus_wrapping', 'force_xinerama', 'force-xinerama', 'workspace_auto_back_and_forth', 'fake_outputs', 'fake-outputs', 'force_display_urgency_hint', 'workspace', 'ipc_socket', 'ipc-socket', 'restart_state', 'popup_during_fullscreen', 'exec_always', 'exec', 'client.background', 'client.focused_inactive', 'client.focused', 'client.unfocused', 'client.urgent'
+$expected_tail = <<'EOT';
ERROR: CONFIG: (in file <stdin>)
ERROR: CONFIG: Line 1: unknown qux
ERROR: CONFIG: ^^^^^^^^^^^
ERROR: CONFIG: Line 3: # context 2 after
EOT
+$expected = $expected_all_tokens . $expected_tail;
+
is(parser_calls($config),
$expected,
'error message (0+2 context) ok');
$expected = <<'EOT';
cfg_bar_output(LVDS-1)
-ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'i3bar_command', 'status_command', 'socket_path', 'mode', 'modifier', 'position', 'output', 'tray_output', 'font', 'workspace_buttons', 'verbose', 'colors', '}'
+ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'i3bar_command', 'status_command', 'socket_path', 'mode', 'hidden_state', 'id', 'modifier', 'position', 'output', 'tray_output', 'font', 'workspace_buttons', 'verbose', 'colors', '}'
ERROR: CONFIG: (in file <stdin>)
ERROR: CONFIG: Line 1: bar {
ERROR: CONFIG: Line 2: output LVDS-1