]> git.sur5r.net Git - i3/i3/blob - testcases/t/193-ipc-version.t
Merge pull request #3435 from vivien/i3-msg/subscribe
[i3/i3] / testcases / t / 193-ipc-version.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 # Verifies that we can get the version number of i3 via IPC.
18 use i3test;
19
20 my $i3 = i3(get_socket_path());
21 $i3->connect->recv;
22 # We explicitly send the version message because AnyEvent::I3’s 'version' sugar
23 # method has a fallback which tries to parse the version number from i3
24 # --version for older versions, and we want to avoid using that.
25 my $version = $i3->message(7, "")->recv;
26
27 # We need to change this when the major version changes (but we need to touch a
28 # lot of changes then anyways).
29 is($version->{major}, 4, 'major version is 4');
30
31 cmp_ok($version->{minor}, '>', 0, 'minor version > 0');
32
33 is(int($version->{minor}), $version->{minor}, 'minor version is an integer');
34 is(int($version->{patch}), $version->{patch}, 'patch version is an integer');
35 like($version->{human_readable}, qr/branch/, 'human readable version contains branch name');
36
37 done_testing;