mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 13:11:32 +00:00
PT-1554 Test fixes for pt-archiver
This commit is contained in:
@@ -7156,10 +7156,16 @@ sub escape {
|
||||
|
||||
return join($fields_separated_by, map {
|
||||
s/([\t\n\\])/\\$1/g if defined $_; # Escape tabs etc
|
||||
$_ = defined $_ ? $_ : '\N'; # NULL = \N
|
||||
my $s = defined $_ ? $_ : '\N'; # NULL = \N
|
||||
# var & ~var will return 0 only for numbers
|
||||
$_ =~ s/([^\\])"/$1\\"/g if ($_ !~ /^[0-9,.E]+$/ && $optionally_enclosed_by eq '"');
|
||||
$_ = $optionally_enclosed_by && $_ & ~$_ ? $optionally_enclosed_by."$_".$optionally_enclosed_by : $_;
|
||||
if ($s !~ /^[0-9,.E]+$/ && $optionally_enclosed_by eq '"') {
|
||||
$s =~ s/([^\\])"/$1\\"/g;
|
||||
$s = $optionally_enclosed_by."$s".$optionally_enclosed_by;
|
||||
}
|
||||
# $_ =~ s/([^\\])"/$1\\"/g if ($_ !~ /^[0-9,.E]+$/ && $optionally_enclosed_by eq '"');
|
||||
# $_ = $optionally_enclosed_by && ($_ & ~$_) ? $optionally_enclosed_by."$_".$optionally_enclosed_by : $_;
|
||||
chomp $s;
|
||||
$s;
|
||||
} @$row);
|
||||
|
||||
}
|
||||
|
@@ -46,7 +46,6 @@ is($output, <<EOF
|
||||
2\t\\N\t3\t4
|
||||
3\t2\t3\t\\\t
|
||||
4\t2\t3\t\\
|
||||
|
||||
EOF
|
||||
, 'File has the right stuff');
|
||||
`rm -f archive.test.table_1`;
|
||||
@@ -124,8 +123,8 @@ $output = output(
|
||||
);
|
||||
$output = `cat archive.test.table_2`;
|
||||
is($output, <<EOF
|
||||
1, 2, 3, "4"
|
||||
2, "\\N", 3, "4"
|
||||
1, 2, 3, 4
|
||||
2, "\\N", 3, 4
|
||||
3, 2, 3, "\\\t"
|
||||
4, 2, 3, "\\\n"
|
||||
5, 2, 3, "Zapp \\"Brannigan"
|
||||
|
Reference in New Issue
Block a user