migrate-config: mode foo → mode "foo" (+test) (Thanks cradle)

This commit is contained in:
Michael Stapelberg 2011-07-15 00:22:26 +02:00
parent 2d71102796
commit e117a8a77f
2 changed files with 14 additions and 2 deletions

View File

@ -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 <left|right|top|bottom> [+|-]<pixels>\n")

View File

@ -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();