]> git.sur5r.net Git - i3/i3/blob - testcases/t/270-config-no-newline-end.t
Merge pull request #2953 from CyberShadow/focus_wrapping
[i3/i3] / testcases / t / 270-config-no-newline-end.t
1 #!perl
2 # vim:ts=4:sw=4:expandtab
3 #
4 # Please read the following documents before working on tests:
5 # • https://build.i3wm.org/docs/testsuite.html
6 #   (or docs/testsuite)
7 #
8 # • https://build.i3wm.org/docs/lib-i3test.html
9 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
10 #
11 # • https://build.i3wm.org/docs/ipc.html
12 #   (or docs/ipc)
13 #
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 #   (unless you are already familiar with Perl)
16 #
17 # Make sure that configs that end without a newline don't crash i3.
18 # Ticket: #2934
19 use i3test i3_autostart => 0;
20
21 my $first_lines = <<'EOT';
22 set $workspace1 workspace number 1
23 set $workspace0 workspace eggs
24
25 bindsym Mod4+1 $workspace1
26 EOT
27
28 # Intentionally don't add a trailing newline for the last line since this is
29 # what triggered the bug.
30 my $last_line = 'bindsym Mod4+0 $workspace0';
31 my $config = "${first_lines}${last_line}";
32
33 my $pid = launch_with_config($config);
34 does_i3_live;
35
36 my $i3 = i3(get_socket_path());
37 my $ws = $i3->get_workspaces->recv;
38 is($ws->[0]->{name}, 'eggs', 'last line processed correctly');
39
40 exit_gracefully($pid);
41 done_testing;