forked from movabletype/movabletype
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path13-dirify.t
43 lines (36 loc) · 925 Bytes
/
13-dirify.t
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
#!/usr/bin/perl
# $Id: 13-dirify.t 2562 2008-06-12 05:12:23Z bchoate $
use strict;
use warnings;
use lib 't/lib';
use lib 'lib';
use lib 'extlib';
use MT;
use MT::Test;
use MT::Util;
my @tests = (
{
text => 'Siegfried & Roy',
iso => 'siegfried_roy',
utf8 => 'siegfried_roy',
},
{
text => 'Cauchy-Schwartz Inequality',
iso => 'cauchy-schwartz_inequality',
utf8 => 'cauchy-schwartz_inequality',
},
{
text => "M\303\272m",
utf8 => 'mum',
},
);
use Test::More tests => 5;
MT->set_language('en_US');
for my $test (@tests) {
my ($text, $iso, $utf8) = @{ $test }{qw( text iso utf8 )};
$text = Encode::decode_utf8($text);
is(MT::Util::iso_dirify($text), $iso, "String '$text' iso_dirifies correctly")
if $iso;
is(MT::Util::utf8_dirify($text), $utf8, "String '$text' utf8_dirifies correctly")
if $utf8;
}