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 132 lines (108 sloc) 3.731 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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
use v6;

use Test;

=begin pod

This file was derived from the perl5 CPAN module Perl6::Rules,
version 0.3 (12 Apr 2004), file t/charset.t.

It has (hopefully) been, and should continue to be, updated to
be valid perl6.

=end pod

plan 41;

# Broken:
# L<S05/Extensible metasyntax (C<< <...> >>)/"A leading [ ">

#?pugs todo
ok("zyxaxyz" ~~ m/(<[aeiou]>)/, 'Simple set');
#?pugs todo
is($0, 'a', 'Simple set capture');

# L<S05/Extensible metasyntax (C<< <...> >>)/"A leading - indicates">
ok(!( "a" ~~ m/<-[aeiou]>/ ), 'Simple neg set failure');
#?pugs todo
ok("f" ~~ m/(<-[aeiou]>)/, 'Simple neg set match');
#?pugs todo
is($0, 'f', 'Simple neg set capture');

# L<S05/Extensible metasyntax (C<< <...> >>)/Character classes can be combined>
ok(!( "a" ~~ m/(<[a..z]-[aeiou]>)/ ), 'Difference set failure');
#?pugs todo
ok("y" ~~ m/(<[a..z]-[aeiou]>)/, 'Difference set match');
#?pugs todo
is($0, 'y', 'Difference set capture');

# RT #115802
#?pugs todo
ok( "abc" ~~ m/<[\w]-[\n]>/, 'Difference set match 1');
ok(!("abc" ~~ m/<[\w]-[\N]>/), 'Difference set match 2');
#?pugs todo
is(("abc123" ~~ m/<[\w]-[a\d]>+/), 'bc', 'Difference set match 3');
#?pugs todo
is(("abc123" ~~ m/<[\w]-[1\D]>+/), '23', 'Difference set match 4');
#?pugs todo
#?niecza todo 'gives c123?'
is(("abc123def" ~~ m/<[\w]-[\D\n]>+/), '123', 'Difference set match 5');
#?pugs todo
is(("abc123def" ~~ m/<[\w]-[\D\h]>+/), '123', 'Difference set match 6');
#?pugs todo
is(("abc" ~~ /<-["\\\t\n]>+/), 'abc', 'Difference set match 7');

ok(!( "a" ~~ m/(<+alpha-[aeiou]>)/ ), 'Named difference set failure');
#?pugs todo
ok("y" ~~ m/(<+alpha-[aeiou]>)/, 'Named difference set match');
#?pugs todo
is($0, 'y', 'Named difference set capture');
ok(!( "y" ~~ m/(<[a..z]-[aeiou]-[y]>)/ ), 'Multi-difference set failure');
#?pugs todo
ok("f" ~~ m/(<[a..z]-[aeiou]-[y]>)/, 'Multi-difference set match');
#?pugs todo
is($0, 'f', 'Multi-difference set capture');

#?pugs todo
ok(']' ~~ m/(<[\]]>)/, 'quoted close LSB match');
#?pugs todo
is($0, ']', 'quoted close LSB capture');
#?pugs todo
ok('[' ~~ m/(<[\[]>)/, 'quoted open LSB match');
#?pugs todo
is($0, '[', 'quoted open LSB capture');
#?pugs todo
ok('{' ~~ m/(<[\{]>)/, 'quoted open LCB match');
#?pugs todo
is($0, '{', 'quoted open LCB capture');
#?pugs todo
ok('}' ~~ m/(<[\}]>)/, 'quoted close LCB match');
#?pugs todo
is($0, '}', 'quoted close LCB capture');

# RT #67124
eval_lives_ok( '"foo" ~~ /<[f] #`[comment] + [o]>/',
               'comment embedded in charset can be parsed' );
#?pugs todo
ok( "foo" ~~ /<[f] #`[comment] + [o]>/, 'comment embedded in charset works' );

# RT #67122
#?rakudo skip 'large \\x char spec in regex (RT #67122) (noauto)'
#?pugs todo
ok "\x[10001]" ~~ /<[\x10000..\xEFFFF]>/, 'large \\x char spec';

#?niecza todo
#?pugs todo
eval_dies_ok( "'RT 71702' ~~ /<[d..b]>? RT/",
    'reverse range in charset is lethal (RT 71702)' );

# RT #64220
#?pugs todo
ok 'b' ~~ /<[. .. b]>/, 'weird char class matches at least its end point';

# RT #69682
#?pugs todo
{
try { EVAL "/<[a-z]>/"; }
ok ~$! ~~ / 'Unsupported use of - as character range; in Perl 6 please use ..'/,
    "STD error message for - as character range";
}

#?pugs todo
ok 'ab' ~~ /^(.*) b/,
    'Quantifiers in capture groups work (RT 100650)';

# RT #74012
# backslashed characters in char classes
#?pugs todo
ok '[]\\' ~~ /^ <[ \[ .. \] ]>+ $ /, 'backslashed chars in char classes';
nok '^' ~~ / <[ \[ .. \] ]> /, '... does not match outside its range';

# RT #89470
{
    nok '' ~~ / <[a..z]-[x]> /, 'Can match empty string against char class';
    nok 'x' ~~ / <[a..z]-[x]> /, 'char excluded from class';
    #?pugs todo
     ok 'z' ~~ / <[a..z]-[x]> /, '... but others are fine';
}

done;

# vim: ft=perl6
Something went wrong with that request. Please try again.