Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 63 lines (46 sloc) 2.518 kb
6477312 [gsoc_spectest] moved repeat.t into spec, added more tests (added 11 …
Auzon authored
1 use v6;
2
3 use Test;
4
5 =begin pod
6
7 This file was derived from the perl5 CPAN module Perl6::Rules,
8 version 0.3 (12 Apr 2004), file t/repeat.t.
9
10 It has (hopefully) been, and should continue to be, updated to
11 be valid perl6.
12
13 =end pod
14
15 # Note: single-quotes.t tests repetition on single quoted items in regexes.
16
4d80dbc [t/spec] test for RT #76792, ** and \w interact badly in regexes
moritz authored
17 plan 22;
6477312 [gsoc_spectest] moved repeat.t into spec, added more tests (added 11 …
Auzon authored
18
19 # L<S05/Bracket rationalization/The general repetition specifier is now>
20
21 # Exact repetition
932ac54 [repeat.t] don't use [abc] to mean 'abc' since it looks like old-scho…
lwall authored
22 ok("abcabcabcabcd" ~~ m/'abc'**4/, 'Fixed exact repetition');
1571369 test for RT #72872, Mu eqv Mu
moritz authored
23 is $/, 'abc' x 4, '...with the correct capture';
932ac54 [repeat.t] don't use [abc] to mean 'abc' since it looks like old-scho…
lwall authored
24 ok(!("abcabcabcabcd" ~~ m/'abc'**5/), 'Fail fixed exact repetition');
6477312 [gsoc_spectest] moved repeat.t into spec, added more tests (added 11 …
Auzon authored
25 #?pugs todo force_todo
932ac54 [repeat.t] don't use [abc] to mean 'abc' since it looks like old-scho…
lwall authored
26 ok("abcabcabcabcd" ~~ m/'abc'**{4}/, 'Fixed exact repetition using closure');
171846e [t/spec] fudge S05-metasyntax/repeat.t for rakudo
moritz authored
27 #?rakudo todo 'closure repetition'
932ac54 [repeat.t] don't use [abc] to mean 'abc' since it looks like old-scho…
lwall authored
28 ok(!( "abcabcabcabcd" ~~ m/'abc'**{5}/ ), 'Fail fixed exact repetition using closure');
6477312 [gsoc_spectest] moved repeat.t into spec, added more tests (added 11 …
Auzon authored
29
30 # Closed range repetition
932ac54 [repeat.t] don't use [abc] to mean 'abc' since it looks like old-scho…
lwall authored
31 ok("abcabcabcabcd" ~~ m/'abc'**2..4/, 'Fixed range repetition');
32 ok(!( "abc" ~~ m/'abc'**2..4/ ), 'Fail fixed range repetition');
6477312 [gsoc_spectest] moved repeat.t into spec, added more tests (added 11 …
Auzon authored
33 #?pugs todo force_todo
932ac54 [repeat.t] don't use [abc] to mean 'abc' since it looks like old-scho…
lwall authored
34 ok("abcabcabcabcd" ~~ m/'abc'**{2..4}/, 'Fixed range repetition using closure');
171846e [t/spec] fudge S05-metasyntax/repeat.t for rakudo
moritz authored
35 #?rakudo todo 'closure repetition'
932ac54 [repeat.t] don't use [abc] to mean 'abc' since it looks like old-scho…
lwall authored
36 ok(!( "abc" ~~ m/'abc'**{2..4}/ ), 'Fail fixed range repetition using closure');
6477312 [gsoc_spectest] moved repeat.t into spec, added more tests (added 11 …
Auzon authored
37
38 # Open range repetition
932ac54 [repeat.t] don't use [abc] to mean 'abc' since it looks like old-scho…
lwall authored
39 ok("abcabcabcabcd" ~~ m/'abc'**2..*/, 'Open range repetition');
40 ok(!( "abcd" ~~ m/'abc'**2..*/ ), 'Fail open range repetition');
6477312 [gsoc_spectest] moved repeat.t into spec, added more tests (added 11 …
Auzon authored
41 #?pugs todo force_todo
932ac54 [repeat.t] don't use [abc] to mean 'abc' since it looks like old-scho…
lwall authored
42 ok("abcabcabcabcd" ~~ m/'abc'**{2..*}/, 'Open range repetition using closure');
171846e [t/spec] fudge S05-metasyntax/repeat.t for rakudo
moritz authored
43 #?rakudo todo 'closure repetition'
932ac54 [repeat.t] don't use [abc] to mean 'abc' since it looks like old-scho…
lwall authored
44 ok(!( "abcd" ~~ m/'abc'**{2..*}/), 'Fail open range repetition using closure');
6477312 [gsoc_spectest] moved repeat.t into spec, added more tests (added 11 …
Auzon authored
45
46 # It is illegal to return a list, so this easy mistake fails:
f8648bf [spec] s/dies_ok/eval_dies_ok/ in S05-metasyntax/repeat.t
moritz authored
47 eval_dies_ok('"foo" ~~ m/o{1,3}/', 'P5-style {1,3} range mistake is caught');
448f109 @sorear [S05-metasyntax/repeat] Fix syntax in an eval_dies_ok
sorear authored
48 eval_dies_ok('"foo" ~~ m/o{1,}/', 'P5-style {1,} range mistake is caught');
6477312 [gsoc_spectest] moved repeat.t into spec, added more tests (added 11 …
Auzon authored
49
50 # A successful match of such a quantifier always ends "in the middle"
382f35b [repeat.t] ** is not allowed on an already quantified atom
lwall authored
51 is(~('foo,bar,baz,' ~~ m/[<alpha>+] ** ','/), 'foo,bar,baz', '** with a term worked');
52 is(~('foo,bar,baz,' ~~ m/[<alpha>+] **? ','/), 'foo', '**? with a term worked');
53 is(~('foo, bar,' ~~ m/[<alpha>+] **[','\s*]/), 'foo, bar', '** with a more complex term');
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
54
f0ac25a [t/spec] simple tests for combining ** quantifier and :sigspace
moritz authored
55 ok 'a, b, c' !~~ /:s^<alpha>**\,$/, 'with no spaces around **, no spaces can be matched';
56 ok 'a, b, c' ~~ /:s^ <alpha> ** \, $/, 'with spaces around **, spaces can be matched';
57 ok 'a , b ,c' ~~ /:s^ <alpha> ** \, $/, 'same, but with leading spaces';
58
4d80dbc [t/spec] test for RT #76792, ** and \w interact badly in regexes
moritz authored
59 # RT #76792
60 ok ('a b,c,d' ~~ token { \w \s \w ** \, }), 'can combine ** with backslash character classes';
61
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
62 # vim: ft=perl6
Something went wrong with that request. Please try again.