From e117a8a77f5314fb4da25f021f6993ae8a10d8fa Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Fri, 15 Jul 2011 00:22:26 +0200 Subject: [PATCH] =?UTF-8?q?migrate-config:=20mode=20foo=20=E2=86=92=20mode?= =?UTF-8?q?=20"foo"=20(+test)=20(Thanks=20cradle)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i3-migrate-config-to-v4.pl | 7 ++++++- testcases/t/71-config-migrate.t | 9 ++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) 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();