#!perl # vim:ts=4:sw=4:expandtab # !NO_I3_INSTANCE! will prevent complete-run.pl from starting i3 # # Tests if i3-migrate-config-to-v4.pl correctly migrates all config file # directives and commands # use i3test; use Cwd qw(abs_path); use Proc::Background; use File::Temp qw(tempfile tempdir); use POSIX qw(getuid); use Data::Dumper; use v5.10; # reads in a whole file sub slurp { open my $fh, '<', shift; local $/; <$fh>; } sub migrate_config { my ($config) = @_; my ($fh, $tmpfile) = tempfile(); print $fh $config; close($fh); my $cmd = "sh -c 'exec " . abs_path("../i3-migrate-config-to-v4.pl") . " --v3 <$tmpfile'"; return [ split /\n/, qx($cmd) ]; } sub line_exists { my ($lines, $pattern) = @_; for my $line (@$lines) { return 1 if $line =~ $pattern; } return 0 } ##################################################################### # check that some directives remain untouched ##################################################################### my $input = <