X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fstorage%2Fquote_names.t;h=ff82d9f0a28495fc2545482a2300f9ac5bf8059d;hb=3cff955a7163e263490edecd0a1922aa5ee6c6db;hp=87517e9ad6237353bec514e646d17cce6a67b867;hpb=8d6b1478d8fa6f7c76e313ee72a72d5eb4c24d03;p=dbsrgits%2FDBIx-Class.git diff --git a/t/storage/quote_names.t b/t/storage/quote_names.t index 87517e9..ff82d9f 100644 --- a/t/storage/quote_names.t +++ b/t/storage/quote_names.t @@ -1,9 +1,11 @@ +BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } + use strict; use warnings; use Test::More; use Data::Dumper::Concise; use Try::Tiny; -use lib qw(t/lib); + use DBICTest; my %expected = ( @@ -50,8 +52,11 @@ my %expected = ( ); for my $class (keys %expected) { SKIP: { - eval "require ${class}" - or skip "Skipping test of quotes for $class due to missing dependencies", 1; + + eval "require ${class}" or do { + note "Failed load of $class:\n\n$@\n\n"; + skip "Skipping test of quotes for $class due to missing compile-time dependencies", 1; + }; my $mapping = $expected{$class}; my ($quote_char, $name_sep) = @$mapping{qw/quote_char name_sep/}; @@ -89,7 +94,9 @@ my %dbs = ( ); # lie that we already locked stuff - the tests below do not touch anything -$ENV{DBICTEST_LOCK_HOLDER} = -1; +# unless we are under travis, where the OOM killers reign and things are rough +$ENV{DBICTEST_LOCK_HOLDER} = -1 + unless DBICTest::RunMode->is_ci; # Make sure oracle is tried last - some clients (e.g. 10.2) have symbol # clashes with libssl, and will segfault everything coming after them @@ -104,12 +111,12 @@ for my $db (sort { my $schema; - try { + my $sql_maker = try { $schema = DBICTest::Schema->connect($dsn, $user, $pass, { quote_names => 1 }); $schema->storage->ensure_connected; - 1; + $schema->storage->sql_maker; } || next; my ($exp_quote_char, $exp_name_sep) = @@ -118,14 +125,26 @@ for my $db (sort { my ($quote_char_text, $name_sep_text) = map { dumper($_) } ($exp_quote_char, $exp_name_sep); - is_deeply $schema->storage->sql_maker->quote_char, + is_deeply $sql_maker->quote_char, $exp_quote_char, "$db quote_char with quote_names => 1 is $quote_char_text"; - is $schema->storage->sql_maker->name_sep, + is $sql_maker->name_sep, $exp_name_sep, "$db name_sep with quote_names => 1 is $name_sep_text"; + + # if something was produced - it better be quoted + if ( + # the SQLT producer has no idea what quotes are :/ + ! grep { $db eq $_ } qw( SYBASE DB2 ) + and + my $ddl = try { $schema->deployment_statements } + ) { + my $quoted_artist = $sql_maker->_quote('artist'); + + like ($ddl, qr/^CREATE\s+TABLE\s+\Q$quoted_artist/msi, "$db DDL contains expected quoted table name"); + } } done_testing;