#!perl # vim:ts=4:sw=4:expandtab # # Tests if i3-migrate-config-to-v4 correctly migrates all config file # directives and commands # use i3test i3_autostart => 0; use Cwd qw(abs_path); use File::Temp qw(tempfile tempdir); 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('/tmp/i3-migrate-cfg.XXXXXX', UNLINK => 1); print $fh $config; close($fh); my $cmd = "sh -c 'exec " . abs_path("../i3-migrate-config-to-v4") . " --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 = <