From: Daisuke Murase Date: Fri, 3 Mar 2006 04:12:33 +0000 (+0000) Subject: * added a test for UTF8Columns X-Git-Tag: v0.06000~60^2~65 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e59c17fe744031457d375cb464250950881f4c56;p=dbsrgits%2FDBIx-Class.git * added a test for UTF8Columns --- diff --git a/t/basicrels/25utf8.t b/t/basicrels/25utf8.t new file mode 100644 index 0000000..c5fe364 --- /dev/null +++ b/t/basicrels/25utf8.t @@ -0,0 +1,7 @@ +use Test::More; +use lib qw(t/lib); +use DBICTest; +use DBICTest::BasicRels; + +require "t/run/25utf8.tl"; +run_tests(DBICTest->schema); diff --git a/t/helperrels/25utf8.t b/t/helperrels/25utf8.t new file mode 100644 index 0000000..ad3fe14 --- /dev/null +++ b/t/helperrels/25utf8.t @@ -0,0 +1,7 @@ +use Test::More; +use lib qw(t/lib); +use DBICTest; +use DBICTest::HelperRels; + +require "t/run/25utf8.tl"; +run_tests(DBICTest->schema); diff --git a/t/run/25utf8.tl b/t/run/25utf8.tl new file mode 100644 index 0000000..278dde4 --- /dev/null +++ b/t/run/25utf8.tl @@ -0,0 +1,23 @@ +sub run_tests { + my $schema = shift; + + eval 'use Encode ; 1' + or plan skip_all, 'Install Encode run this test'; + + plan tests => 2; + + DBICTest::Schema::Artist->load_components('UTF8Columns'); + DBICTest::Schema::Artist->utf8_columns('name'); + Class::C3->reinitialize(); + + my $artist = $schema->resultset("Artist")->create( { name => 'uni' } ); + ok( Encode::is_utf8( $artist->name ), 'got name with utf8 flag' ); + + my $utf8_char = 'uniuni'; + Encode::_utf8_on($utf8_char); + $artist->name($utf8_char); + ok( !Encode::is_utf8( $artist->{_column_data}->{name} ), + 'store utf8 less chars' ); +} + +1;