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 ) { foreach my $id ( @$advice ) {
my $info = $adv->get_rule_info($id); my $info = $adv->get_rule_info($id);
my @desc = map { 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. $desc[1] ||= ""; # Some desc have only 1 sentence.
my $desc = $verbose == 1 ? $desc[0] # terse my $desc = $verbose == 1 ? $desc[0] # terse
: $verbose == 2 ? "$desc[0] $desc[1]" # fuller : $verbose == 2 ? "$desc[0] $desc[1]" # fuller

View File

@@ -9,7 +9,7 @@ BEGIN {
use strict; use strict;
use warnings FATAL => 'all'; use warnings FATAL => 'all';
use English qw(-no_match_vars); use English qw(-no_match_vars);
use Test::More tests => 5; use Test::More;
use PerconaTest; use PerconaTest;
shift @INC; # These two shifts are required for tools that use base and shift @INC; # These two shifts are required for tools that use base and
@@ -68,7 +68,18 @@ ok(
"--ignore-rules" "--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. # Done.
# ############################################################################# # #############################################################################
exit; done_testing;