From 7621731f534c6d202a5d8cb977da875f9ec078d1 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Thu, 2 Sep 2010 11:24:15 -0400 Subject: [PATCH] Add timestamptz tabletype to tests. --- t/10-pushdelta.t | 4 +- t/10-swap.t | 4 +- t/BucardoTesting.pm | 132 ++++++++++++++++++++++---------------------- 3 files changed, 70 insertions(+), 70 deletions(-) diff --git a/t/10-pushdelta.t b/t/10-pushdelta.t index 38e87dc01..1d524c0c6 100644 --- a/t/10-pushdelta.t +++ b/t/10-pushdelta.t @@ -117,7 +117,7 @@ for my $table (sort keys %tabletype) { ## INSERT for my $x (1..6) { - $SQL = $table =~ /0/ + $SQL = $table =~ /X/ ? "INSERT INTO $table($pkey{$table}) VALUES (?)" : "INSERT INTO $table($pkey{$table},data1,inty) VALUES (?,'foo',$x)"; $sth{insert}{$x}{$table}{A} = $dbhA->prepare($SQL); @@ -128,7 +128,7 @@ for my $table (sort keys %tabletype) { ## SELECT $sql{select}{$table} = "SELECT inty FROM $table ORDER BY $pkey{$table}"; - $table =~ /0/ and $sql{select}{$table} =~ s/inty/$pkey{$table}/; + $table =~ /X/ and $sql{select}{$table} =~ s/inty/$pkey{$table}/; ## DELETE $SQL = "DELETE FROM $table"; diff --git a/t/10-swap.t b/t/10-swap.t index fe859053f..eed784caa 100644 --- a/t/10-swap.t +++ b/t/10-swap.t @@ -102,7 +102,7 @@ for my $table (sort keys %tabletype) { ## INSERT for my $x (1..8) { - $SQL = $table =~ /0/ + $SQL = $table =~ /X/ ? "INSERT INTO $table($pkey{$table}) VALUES (?)" : "INSERT INTO $table($pkey{$table},data1,inty) VALUES (?,'foo',$x)"; $sth{insert}{$x}{$table}{A} = $dbhA->prepare($SQL); @@ -115,7 +115,7 @@ for my $table (sort keys %tabletype) { ## SELECT $sql{select}{$table} = "SELECT inty FROM $table ORDER BY $pkey{$table}"; - $table =~ /0/ and $sql{select}{$table} =~ s/inty/$pkey{$table}/; + $table =~ /X/ and $sql{select}{$table} =~ s/inty/$pkey{$table}/; ## DELETE $SQL = "DELETE FROM $table"; diff --git a/t/BucardoTesting.pm b/t/BucardoTesting.pm index a7fd2d200..6c5deafda 100644 --- a/t/BucardoTesting.pm +++ b/t/BucardoTesting.pm @@ -45,15 +45,16 @@ my @dbs = qw/A B C D/; our %tabletype = ( - 'bucardo_test1' => 'SMALLINT', - 'bucardo_test2' => 'INT', - 'bucardo_test3' => 'BIGINT', - 'bucardo_test4' => 'TEXT', - 'bucardo_test5' => 'DATE', - 'bucardo_test6' => 'TIMESTAMP', - 'bucardo_test7' => 'NUMERIC', - 'bucardo_test8' => 'BYTEA', - 'bucardo_test9' => 'int_unsigned', + 'bucardo_test1' => 'SMALLINT', + 'bucardo_test2' => 'INT', + 'bucardo_test3' => 'BIGINT', + 'bucardo_test4' => 'TEXT', + 'bucardo_test5' => 'DATE', + 'bucardo_test6' => 'TIMESTAMP', + 'bucardo_test7' => 'NUMERIC', + 'bucardo_test8' => 'BYTEA', + 'bucardo_test9' => 'int_unsigned', + 'bucardo_test10' => 'TIMESTAMPTZ', ); our @tables2empty = (qw/droptest/); @@ -172,6 +173,7 @@ for (1..30) { $val{NUMERIC}{$_} = 0.7 + $_; $val{BYTEA}{$_} = "$_\0Z"; $val{int_unsigned}{$_} = 5000 + $_; + $val{TIMESTAMPTZ}{$_} = $val{DATE}{$_} . " 11:22:33"; } @@ -635,7 +637,7 @@ sub add_test_schema { $SQL = qq{ CREATE TABLE $table ( $pkeyname $tabletype{$table} NOT NULL $pkindex}; - $SQL .= $table =~ /0/ ? "\n)" : qq{, + $SQL .= $table =~ /X/ ? "\n)" : qq{, data1 TEXT NULL, inty SMALLINT NULL, bite1 BYTEA NULL, @@ -1405,64 +1407,62 @@ sub drop_database { ## Hack to override some Test::More methods ## no critic -{ - #no warnings; ## Yes, we know they are being redefined! - sub is_deeply { - t($_[2],$_[3] || (caller)[2]); - return if Test::More::is_deeply($_[0],$_[1],$testmsg); - if ($bail_on_error > $total_errors++) { - my $line = (caller)[2]; - my $time = time; - Test::More::diag("GOT: ".Dumper $_[0]); - Test::More::diag("EXPECTED: ".Dumper $_[1]); - Test::More::BAIL_OUT "Stopping on a failed 'is_deeply' test from line $line. Time: $time"; - } - } ## end of is_deeply - sub like($$;$) { - t($_[2],(caller)[2]); - return if Test::More::like($_[0],$_[1],$testmsg); - if ($bail_on_error > $total_errors++) { - my $line = (caller)[2]; - my $time = time; - Test::More::diag("GOT: ".Dumper $_[0]); - Test::More::diag("EXPECTED: ".Dumper $_[1]); - Test::More::BAIL_OUT "Stopping on a failed 'like' test from line $line. Time: $time"; - } - } ## end of like - sub pass(;$) { - t($_[0],$_[1]||(caller)[2]); +sub is_deeply { + t($_[2],$_[3] || (caller)[2]); + return if Test::More::is_deeply($_[0],$_[1],$testmsg); + if ($bail_on_error > $total_errors++) { + my $line = (caller)[2]; + my $time = time; + Test::More::diag("GOT: ".Dumper $_[0]); + Test::More::diag("EXPECTED: ".Dumper $_[1]); + Test::More::BAIL_OUT "Stopping on a failed 'is_deeply' test from line $line. Time: $time"; + } +} ## end of is_deeply +sub like($$;$) { + t($_[2],(caller)[2]); + return if Test::More::like($_[0],$_[1],$testmsg); + if ($bail_on_error > $total_errors++) { + my $line = (caller)[2]; + my $time = time; + Test::More::diag("GOT: ".Dumper $_[0]); + Test::More::diag("EXPECTED: ".Dumper $_[1]); + Test::More::BAIL_OUT "Stopping on a failed 'like' test from line $line. Time: $time"; + } +} ## end of like +sub pass(;$) { + t($_[0],$_[1]||(caller)[2]); + Test::More::pass($testmsg); +} ## end of pass +sub is($$;$) { + t($_[2],(caller)[2]); + return if Test::More::is($_[0],$_[1],$testmsg); + if ($bail_on_error > $total_errors++) { + my $line = (caller)[2]; + my $time = time; + Test::More::BAIL_OUT "Stopping on a failed 'is' test from line $line. Time: $time"; + } +} ## end of is +sub isa_ok($$;$) { + t("Object isa $_[1]",(caller)[2]); + my ($name, $type, $msg) = ($_[0],$_[1]); + if (ref $name and ref $name eq $type) { Test::More::pass($testmsg); - } ## end of pass - sub is($$;$) { - t($_[2],(caller)[2]); - return if Test::More::is($_[0],$_[1],$testmsg); - if ($bail_on_error > $total_errors++) { - my $line = (caller)[2]; - my $time = time; - Test::More::BAIL_OUT "Stopping on a failed 'is' test from line $line. Time: $time"; - } - } ## end of is - sub isa_ok($$;$) { - t("Object isa $_[1]",(caller)[2]); - my ($name, $type, $msg) = ($_[0],$_[1]); - if (ref $name and ref $name eq $type) { - Test::More::pass($testmsg); - return; - } - $bail_on_error > $total_errors++ and Test::More::BAIL_OUT "Stopping on a failed test"; - } ## end of isa_ok - sub ok($;$) { - t($_[1]||$testmsg); - return if Test::More::ok($_[0],$testmsg); - if ($bail_on_error > $total_errors++) { - my $line = (caller)[2]; - my $time = time; - Test::More::BAIL_OUT "Stopping on a failed 'ok' test from line $line. Time: $time"; - } - } ## end of ok -} + return; + } + $bail_on_error > $total_errors++ and Test::More::BAIL_OUT "Stopping on a failed test"; +} ## end of isa_ok +sub ok($;$) { + t($_[1]||$testmsg); + return if Test::More::ok($_[0],$testmsg); + if ($bail_on_error > $total_errors++) { + my $line = (caller)[2]; + my $time = time; + Test::More::BAIL_OUT "Stopping on a failed 'ok' test from line $line. Time: $time"; + } +} ## end of ok + ## use critic -## end of Test::More hacks + 1; -- 2.39.5