X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fsqlmaker%2Fcore.t;h=1c2a1c35c6ebabd21a74677cdec548480246097d;hb=a5a7bb733a940db710b7408508374833683a2e79;hp=2cf88ba9c2724a4a4409654c53ad8dc6f610ed15;hpb=d5dedbd62928f65a9071b4d9b6d56c6b663a073b;p=dbsrgits%2FDBIx-Class.git diff --git a/t/sqlmaker/core.t b/t/sqlmaker/core.t index 2cf88ba..1c2a1c3 100644 --- a/t/sqlmaker/core.t +++ b/t/sqlmaker/core.t @@ -5,9 +5,7 @@ use Test::More; use Test::Exception; use lib qw(t/lib); -use DBIC::SqlMakerTest; - -use_ok('DBICTest'); +use DBICTest ':DiffSQL'; my $schema = DBICTest->init_schema(no_deploy => 1); @@ -69,6 +67,36 @@ my $sql_maker = $schema->storage->sql_maker; ); } +# Tests base class for => \'FOO' actually generates proper query. for => +# 'READ'|'SHARE' is tested in db-specific subclasses +# we have to instantiate base because SQLMaker::SQLite disables _lock_select +{ + require DBIx::Class::SQLMaker; + my $sa = DBIx::Class::SQLMaker->new; + { + my ($sql, @bind) = $sa->select('foo', '*', {}, { for => 'update' } ); + is_same_sql_bind( + $sql, + \@bind, + 'SELECT * FROM foo FOR UPDATE', + [], + ); + } + + { + my ($sql, @bind) = $sa->select('bar', '*', {}, { for => \'baz' } ); + is_same_sql_bind( + $sql, + \@bind, + 'SELECT * FROM bar FOR baz', + [], + ); + } + +} + + + # Make sure the carp/croak override in SQLA works (via SQLMaker) my $file = quotemeta (__FILE__); throws_ok (sub {