mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-25 13:46:22 +00:00
Merged fix-1007938-mysqlconfig-eol-comments
This commit is contained in:
@@ -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;
|
||||
|
9
t/lib/samples/configs/mycnf-kc-001.txt
Normal file
9
t/lib/samples/configs/mycnf-kc-001.txt
Normal 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
|
Reference in New Issue
Block a user