2 # vim:ts=4:sw=4:expandtab
4 # Please read the following documents before working on tests:
5 # • http://build.i3wm.org/docs/testsuite.html
8 # • http://build.i3wm.org/docs/lib-i3test.html
9 # (alternatively: perldoc ./testcases/lib/i3test.pm)
11 # • http://build.i3wm.org/docs/ipc.html
14 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
15 # (unless you are already familiar with Perl)
17 # Check whether the -C option works without a display and doesn't
18 # accidentally start the nagbar.
20 use i3test i3_autostart => 0;
21 use File::Temp qw(tempfile);
23 my ($cfg, $ret, $out);
27 my ($fh, $tmpfile) = tempfile(UNLINK => 1);
29 my $output = qx(DISPLAY= i3 -C -c $tmpfile 2>&1);
33 return ($retval >> 8, $output);
36 ################################################################################
37 # 1: test with a bogus configuration file
38 ################################################################################
42 i_am_an_unknown_config option
45 ($ret, $out) = check_config($cfg);
46 is($ret, 1, "exit code == 1");
47 like($out, qr/ERROR: *CONFIG: *[Ee]xpected.*tokens/, 'bogus config file');
49 ################################################################################
50 # 2: test with a valid configuration file
51 ################################################################################
55 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
58 ($ret, $out) = check_config($cfg);
59 is($ret, 0, "exit code == 0");
60 is($out, "", 'valid config file');