i3/testcases/t/193-ipc-version.t
Michael Stapelberg 78f5f2204d ipc: implement GET_VERSION to find out the i3 version
This is useful for third-party scripts which require certain features
and want to error out cleanly when they are run with an old i3 version.

Additionally, i3 --version might be different from what’s actually
running (an old version of the binary), so i3-msg -t get_version will be
the best way to figure out the i3 version you are actually running from
this commit on.
2012-08-05 14:30:05 +02:00

24 lines
902 B
Perl
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!perl
# vim:ts=4:sw=4:expandtab
# Verifies that we can get the version number of i3 via IPC.
use i3test;
my $i3 = i3(get_socket_path());
$i3->connect->recv;
# We explicitly send the version message because AnyEvent::I3s 'version' sugar
# method has a fallback which tries to parse the version number from i3
# --version for older versions, and we want to avoid using that.
my $version = $i3->message(7, "")->recv;
# We need to change this when the major version changes (but we need to touch a
# lot of changes then anyways).
is($version->{major}, 4, 'major version is 4');
cmp_ok($version->{minor}, '>', 0, 'minor version > 0');
is(int($version->{minor}), $version->{minor}, 'minor version is an integer');
is(int($version->{patch}), $version->{patch}, 'patch version is an integer');
like($version->{human_readable}, qr/branch/, 'human readable version contains branch name');
done_testing;