From 5e50b0a02eb8f0245c072b47baef9f2cd9c64f09 Mon Sep 17 00:00:00 2001 From: "wu.xu" Date: Tue, 3 Feb 2026 11:01:47 +0800 Subject: [PATCH] Normalize numeric columns in bulk_insert_special_chars test for robust comparison --- t/pt-archiver/bulk_insert_special_chars.t | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/t/pt-archiver/bulk_insert_special_chars.t b/t/pt-archiver/bulk_insert_special_chars.t index 1e0f52a4..3b7da859 100644 --- a/t/pt-archiver/bulk_insert_special_chars.t +++ b/t/pt-archiver/bulk_insert_special_chars.t @@ -64,10 +64,16 @@ is($src_count, 0, 'Source table is purged'); is($dst_count, scalar(@test_rows), 'All rows archived to dest'); # Compare archived data with expected (order by id). +# Normalize numeric columns (id, stu_id) so comparison is robust across DBD::mysql +# returning integers or strings. my $archived = $dbh->selectall_arrayref( 'SELECT id, name, job, stu_id, title FROM bulk_escape.dest ORDER BY id' ); -is_deeply($archived, \@test_rows, 'Bulk-insert preserves tabs, newlines, backslashes (no field misalignment)'); +my $normalized = [ map { + [ 0 + $_->[0], $_->[1], $_->[2], 0 + $_->[3], $_->[4] ] +} @$archived ]; +is_deeply($normalized, \@test_rows, + 'Bulk-insert preserves tabs, newlines, backslashes (no field misalignment)'); $sb->wipe_clean($dbh); ok($sb->ok(), 'Sandbox servers') or BAIL_OUT(__FILE__ . ' broke the sandbox');