File: 961-rt57182-charset.t

package info (click to toggle)
libparse-dia-sql-perl 0.31-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 924 kB
  • sloc: perl: 3,865; makefile: 2
file content (60 lines) | stat: -rw-r--r-- 1,215 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

#   $Id: 961-rt57182-charset.t,v 1.2 2011/02/15 20:15:54 aff Exp $

use warnings;
use strict;

use locale;
use Data::Dumper;
use Test::More;
use Test::Exception;
use File::Spec::Functions;
use lib catdir qw ( blib lib );

plan tests => 6;
 
use lib q{lib};
use_ok ('Parse::Dia::SQL');

my $diasql =
  Parse::Dia::SQL->new(file => catfile(qw(t data non-latin1-chars.dia)), db => 'postgres');
isa_ok($diasql, q{Parse::Dia::SQL}, q{Expect a Parse::Dia::SQL object});
can_ok($diasql, q{get_sql});

my $sql = undef;
lives_ok(
		 sub {  $sql = $diasql->get_sql() },
		 q{get_sql should live on supported model type 'Database - Table'}
		);

my $components = $diasql->get_components_ref();
# diag(Dumper($components));

my $expected = [
				{
				 'text' => "'fjallg\x{f6}nguma\x{f0}ur'",
				 'name' => 'words'
				}
			   ];

is_deeply($components, $expected, q{Expect arrayref with text/name hash pairs});

my $outputter = $diasql->get_output_instance();
my $inserts = $outputter->get_inserts();

like($inserts, qr/.* fjallg\x{f6}nguma\x{f0}ur .*/x, q{Icelandic word for mountaineer});

#diag $inserts;
#print $inserts;

__END__


=pod

=head1 DESCRIPTION

 https://rt.cpan.org/Public/Bug/Display.html?id=57182

=cut