Merged fix-821696-pt-va-snippet-delimiters

This commit is contained in:
Brian Fraser fraserb@gmail.com
2012-08-01 14:53:40 -03:00
2 changed files with 15 additions and 4 deletions

View File

@@ -3598,9 +3598,9 @@ sub print_advice {
foreach my $id ( @$advice ) {
my $info = $adv->get_rule_info($id);
my @desc = map {
$_ .= '.' unless m/\.$/;
$_ .= '.' unless m/[.?]$/;
$_;
} split(/\.\s{1,2}/, $info->{description} || '');
} split(/(?<=[.?])\s{1,2}/, $info->{description} || '');
$desc[1] ||= ""; # Some desc have only 1 sentence.
my $desc = $verbose == 1 ? $desc[0] # terse
: $verbose == 2 ? "$desc[0] $desc[1]" # fuller

View File

@@ -9,7 +9,7 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 5;
use Test::More;
use PerconaTest;
shift @INC; # These two shifts are required for tools that use base and
@@ -68,7 +68,18 @@ ok(
"--ignore-rules"
);
my ($output) = full_output(sub {
pt_variable_advisor::main(@args,
'--source-of-variables', "$sample/vars-baron-002.txt"
)});
like(
$output,
qr/\Qdual-master or ring replication configuration?\E$/sm,
"Sentences are delimited by . or ?"
);
# #############################################################################
# Done.
# #############################################################################
exit;
done_testing;