Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 58 lines (47 sloc) 1.709 kb
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
use strict;
use warnings;
use Test::More tests => 3 * 14;
use lib '../lib';
use lib 'lib';

use charnames qw(:full);

use Perl6::Str;
use Perl6::Str::Test qw(expand_str);


my @tests = (
    # basic sanity
    ['abc', 'abc', 'eq'],
    ['a', 'b', 'lt'],
    ['a', 'b', 'ne'],
    ['a', 'b', 'le'],
    # grapehme level
    ['A\N{COMBINING DIAERESIS}',
        '\N{LATIN CAPITAL LETTER A WITH DIAERESIS}', 'eq'],

    ['\N{LATIN CAPITAL LETTER A WITH DIAERESIS}',
        '\N{LATIN CAPITAL LETTER O WITH DIAERESIS}', 'ne'],
    ['\N{LATIN CAPITAL LETTER A WITH DIAERESIS}',
        '\N{LATIN CAPITAL LETTER O WITH DIAERESIS}', 'lt'],
    ['\N{LATIN CAPITAL LETTER A WITH DIAERESIS}',
        '\N{LATIN CAPITAL LETTER O WITH DIAERESIS}', 'le'],

    ['A\N{COMBINING DIAERESIS}',
        '\N{LATIN CAPITAL LETTER O WITH DIAERESIS}', 'ne'],
    ['A\N{COMBINING DIAERESIS}',
        '\N{LATIN CAPITAL LETTER O WITH DIAERESIS}', 'lt'],
    ['A\N{COMBINING DIAERESIS}',
        '\N{LATIN CAPITAL LETTER O WITH DIAERESIS}', 'le'],

    ['\N{LATIN CAPITAL LETTER A WITH DIAERESIS}',
        '\N{COMBINING DIAERESIS}', 'ne'],
    ['\N{LATIN CAPITAL LETTER A WITH DIAERESIS}',
        '\N{COMBINING DIAERESIS}', 'lt'],
    ['\N{LATIN CAPITAL LETTER A WITH DIAERESIS}',
        '\N{COMBINING DIAERESIS}', 'le'],
);

for my $test_spec (@tests){
    my ($a, $b, $cmp) = @$test_spec;
    my $sa = expand_str $a;
    my $sb = expand_str $b;

    my $p6a = Perl6::Str->new($sa);
    my $p6b = Perl6::Str->new($sb);
# warn "$p6a $cmp $p6b\n";

    ok eval "\$p6a $cmp \$p6b", "$a $cmp $b (p6, p6)";
    ok eval "\$sa $cmp \$p6b", "$a $cmp $b (p5, p6)";
    ok eval "\$p6a $cmp \$sb", "$a $cmp $b (p6, p5)";
}
Something went wrong with that request. Please try again.