[DBD::Pg] Adjust tests to skip some things if client_encoding is not UTF8 (and it really ought to be!)
dbdpg-commits-gENoVmVU/[email protected] Sun, 8 Feb 2015 18:10:45 +0000
| Newsgroups | gmane.comp.db.postgresql.dbdpg.cvs |
|---|---|
| Message-ID | <[email protected]> |
Committed by Greg Sabino Mullane <greg-O9fzpki4YnJWk0Htik3J/[email protected]> Adjust tests to skip some things if client_encoding is not UTF8 (and it really ought to be!) --- t/12placeholders.t | 4 ++++ t/30unicode.t | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/t/12placeholders.t b/t/12placeholders.t index 548cd19..bd16aa1 100644 --- a/t/12placeholders.t +++ b/t/12placeholders.t @@ -657,9 +657,13 @@ for my $char (qw{0 9 A Z a z}) { ## six letters SKIP: { my $server_encoding = $dbh->selectrow_array('SHOW server_encoding'); + my $client_encoding = $dbh->selectrow_array('SHOW client_encoding'); skip "Cannot test non-ascii dollar quotes with server_encoding='$server_encoding' (need UTF8 or SQL_ASCII)", 3, unless $server_encoding =~ /\A(?:UTF8|SQL_ASCII)\z/; + skip 'Cannot test non-ascii dollar quotes unless client_encoding is UTF8', 3 + if $client_encoding ne 'UTF8'; + for my $ident (qq{\x{5317}}, qq{abc\x{5317}}, qq{_cde\x{5317}}) { ## hi-bit chars eval { $sth = $dbh->prepare(qq{SELECT \$$ident\$ 123 \$$ident\$}); diff --git a/t/30unicode.t b/t/30unicode.t index aa993b6..533601d 100644 --- a/t/30unicode.t +++ b/t/30unicode.t @@ -27,6 +27,7 @@ isnt ($dbh, undef, 'Connect to database for unicode testing'); my @tests; my $server_encoding = $dbh->selectrow_array('SHOW server_encoding'); +my $client_encoding = $dbh->selectrow_array('SHOW client_encoding'); # Beware, characters used for testing need to be known to Unicode version 4.0.0, # which is what perl 5.8.1 shipped with. @@ -90,6 +91,10 @@ foreach (@tests) { ) { skip "Can't do $range tests with server_encoding='$server_encoding'", 1 if $range !~ ($ranges{$server_encoding} || qr/\A(?:ascii)\z/); + + skip 'Cannot perform range tests if client_encoding is not UTF8', 1 + if $client_encoding ne 'UTF8'; + foreach my $enable_utf8 (1, 0, -1) { my $desc = "$state $range UTF-8 $test->{qtype} $type (pg_enable_utf8=$enable_utf8)"; my @args = @{$test->{args} || []}; -- 1.8.4