File: encoding.t

package info (click to toggle)
libgit-pure-perl 0.48-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 348 kB
  • sloc: perl: 3,087; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 642 bytes parent folder | download | duplicates (5)
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
#!perl
use strict;
use warnings;
use Test::More;
use Git::PurePerl;
use Test::utf8;

my $git = Git::PurePerl->new( directory => "test-encoding" );

for (
    [$git->master, "utf-8"],
    [$git->master->parent, "iso-8859-1"],
) {
    my ($commit, $encoding) = @{$_};
    is( $commit->encoding, $encoding );
    for my $role (qw(author committer)) {
        is_flagged_utf8( $commit->$role->name );
        is_sane_utf8( $commit->$role->name );
        is( $commit->author->name, "T\x{e9}st User" );
    }
    is_flagged_utf8( $commit->comment );
    is_sane_utf8( $commit->comment );
    is( $commit->comment, "Touch\x{e9}");
}

done_testing;