Fix and test UpgradeResults::format_query_times001().

This commit is contained in:
Daniel Nichter
2013-03-11 18:51:43 -06:00
parent 8eb3c26236
commit b2809f2a0c
4 changed files with 59 additions and 162 deletions

50
t/lib/UpgradeResults.t Normal file
View File

@@ -0,0 +1,50 @@
#!/usr/bin/perl
BEGIN {
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
};
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
use UpgradeResults;
use PerconaTest;
my $output;
my $samples = "t/lib/samples/UpgradeResults";
my $r = new UpgradeResults(
max_class_size => 100,
max_examples => 3,
);
# #############################################################################
# _format_query_times()
# #############################################################################
$output = UpgradeResults::_format_query_times(
[
'INSERT INTO t (id, username) VALUES (NULL, \'long_username\')',
'0.000812',
'0.039595',
'48.8'
],
);
ok(
no_diff(
$output,
"$samples/format_query_times001",
cmd_output => 1,
),
"format_query_times001"
) or diag($test_diff);
# #############################################################################
# Done.
# #############################################################################
done_testing;