root/branches/release-36/t/13-dirify.t @ 2105

Revision 2105, 0.9 kB (checked in by mpaschal, 19 months ago)

Update test in light of change to dirification of dashes (revision 2086)
Convert dirify test script to data-driven format

  • Property svn:keywords set to Id
Line 
1#!/usr/bin/perl
2# $Id$
3use strict;
4use warnings;
5
6use lib 't/lib';
7use lib 'lib';
8use lib 'extlib';
9
10use MT;
11use MT::Util;
12
13my @tests;
14BEGIN {
15    @tests = (
16        {
17            text => 'Siegfried & Roy',
18            iso  => 'siegfried_roy',
19            utf8 => 'siegfried_roy',
20        },
21        {
22            text => 'Cauchy-Schwartz Inequality',
23            iso  => 'cauchy-schwartz_inequality',
24            utf8 => 'cauchy-schwartz_inequality',
25        },
26        {
27            text => "M\303\272m",
28            utf8 => 'mum',
29        },
30    );
31}
32
33use Test::More tests => 5;
34
35MT->set_language('en_US');
36
37for my $test (@tests) {
38    my ($text, $iso, $utf8) = @{ $test }{qw( text iso utf8 )};
39    is(MT::Util::iso_dirify($text), $iso, "String '$text' iso_dirifies correctly")
40        if $iso;
41    is(MT::Util::utf8_dirify($text), $utf8, "String '$text' utf8_dirifies correctly")
42        if $utf8;
43}
44
Note: See TracBrowser for help on using the browser.