Merged fix-1007938-mysqlconfig-eol-comments

This commit is contained in:
Brian Fraser fraserb@gmail.com
2012-12-05 20:43:40 -03:00
4 changed files with 93 additions and 19 deletions

View File

@@ -827,6 +827,45 @@ SKIP: {
);
}
$config = new MySQLConfig(
file => "$trunk/t/lib/samples/configs/mycnf-kc-001.txt",
TextResultSetParser => $trp,
);
is(
$config->value_of('user'),
'mysql',
'end of line comment in option file'
);
is(
$config->value_of('password'),
'password # still part of it!',
'end of line comments respect quoted values'
);
is(
$config->value_of('something'),
'something ; or # another',
"..and removing comments doesn't leave trailing whitespace"
);
ok(
defined $config->value_of('log_bin'),
"bools with comments in the end are found"
);
is(
$config->value_of('log_bin'),
"ON",
"And the comment is correctly stripped out"
);
is_deeply(
[ sort keys %{$config->variables} ],
[ sort qw( password something user log_bin )],
"start of line comments with # or ; are ignored"
);
# #############################################################################
# Use of uninitialized value in substitution (s///) at pt-config-diff line 1996
# https://bugs.launchpad.net/percona-toolkit/+bug/917770
@@ -865,5 +904,6 @@ like(
'_d() works'
);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
done_testing;
exit;

View File

@@ -0,0 +1,9 @@
[mysqld]
user=mysql # comment
password="password # still part of it!"# comment
something='something ; or # another' # comment
;semicolon="start of line comment with ;"
#pound="start of line comment with #"
;spacecolon
#spacepound
log_bin # bool with comment