Skip to content

Instantly share code, notes, and snippets.

@ingydotnet
Created September 22, 2010 16:19
Show Gist options
  • Save ingydotnet/592008 to your computer and use it in GitHub Desktop.
Save ingydotnet/592008 to your computer and use it in GitHub Desktop.
> cat yamlxs-tt2-utf8.t
use strict;
use warnings;
use Test::More tests => 1;
use Template::Toolkit::Simple;
use YAML::XS;
my $template = <<'...';
Hello, [% name %]
...
my $data1 = { name => 'Ingy döt Net' };
my $data2 = YAML::XS::Load("name: Ingy döt Net\n");
my $render1 = tt->data($data1)->render(\$template);
my $render2 = tt->data($data2)->render(\$template);
is $render1, $render2, 'YAML::XS + TT2 + UTF8 == \o/';
> perl yamlxs-tt2-utf8.t
1..1
not ok 1 - YAML::XS + TT2 + UTF8 == \o/
# Failed test 'YAML::XS + TT2 + UTF8 == \o/'
# at yamlxs-tt2-utf8.t line 17.
# got: 'Hello, Ingy döt Net
# '
# expected: 'Hello, Ingy d?t Net
# '
# Looks like you failed 1 test of 1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment