From: Michael Stapelberg Date: Thu, 14 Jul 2011 22:22:26 +0000 (+0200) Subject: migrate-config: mode foo → mode "foo" (+test) (Thanks cradle) X-Git-Tag: tree-pr4~5 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e117a8a77f5314fb4da25f021f6993ae8a10d8fa;p=i3%2Fi3 migrate-config: mode foo → mode "foo" (+test) (Thanks cradle) --- diff --git a/i3-migrate-config-to-v4.pl b/i3-migrate-config-to-v4.pl index 0d1d0183..99e58635 100755 --- a/i3-migrate-config-to-v4.pl +++ b/i3-migrate-config-to-v4.pl @@ -179,7 +179,6 @@ sub convert_command { my @unchanged_cmds = qw( exec - mode mark kill restart @@ -277,6 +276,12 @@ sub convert_command { return; } + if ($command =~ /^mode/) { + my ($parameters) = ($command =~ /^mode (.*)/); + print qq|$statement $key mode "$parameters"\n|; + return; + } + # the parameters of the resize command have changed if ($command =~ /^resize/) { # OLD: resize [+|-]\n") diff --git a/testcases/t/71-config-migrate.t b/testcases/t/71-config-migrate.t index c467a4b4..ba83a6a1 100644 --- a/testcases/t/71-config-migrate.t +++ b/testcases/t/71-config-migrate.t @@ -155,7 +155,7 @@ ok(line_exists($output, qr|^bindsym Mod1\+s stack-limit cols 2$|), 'stack-limit ok(line_exists($output, qr|^bindsym Mod1\+s stack-limit rows 3$|), 'stack-limit unchanged'); ok(line_exists($output, qr|^bindcode Mod1\+c exec /usr/bin/urxvt$|), 'bind changed to bindcode'); ok(line_exists($output, qr|^mode "asdf" {$|), 'mode asdf unchanged'); -ok(line_exists($output, qr|^bindcode 36 mode default$|), 'mode default unchanged'); +ok(line_exists($output, qr|^bindcode 36 mode \"default\"$|), 'mode default unchanged'); ok(line_exists($output, qr|^}$|), 'closing mode bracket still there'); ##################################################################### @@ -335,4 +335,11 @@ ok(line_exists($output, qr|i3bar|), 'i3bar added'); $output = migrate_config('workspace_bar no'); ok(!line_exists($output, qr|i3bar|), 'no i3bar added'); +##################################################################### +# check whether the mode command gets quotes +##################################################################### + +$output = migrate_config('bindsym Mod1+m mode foobar'); +ok(line_exists($output, qr|^bindsym Mod1\+m mode "foobar"|), 'mode got quotes'); + done_testing();