@@ -4,7 +4,7 @@ use Test;
4
4
5
5
# L<S32-setting-library/Str"=item split">
6
6
7
- plan 59 ;
7
+ plan 60 ;
8
8
9
9
# Legend:
10
10
# r result
@@ -525,3 +525,25 @@ is "aaaaabbbbb".split(<aaa aa bb bbb>,:v), " aaa aa bbb bb ",
525
525
# .List is to check it's not a BOOTArray (which doesn't have p6 method resolution)
526
526
is *. split (" -" ). (" a-b-c" ). List ,<a b c >,' *.split result is HLLized' ;
527
527
}
528
+
529
+ # RT #129242
530
+ subtest ' .split works on Cool same as it works on Str' => {
531
+ plan 11 ;
532
+
533
+ my $ m = Match . new (
534
+ ast => Any , list => (), hash => Map . new (()),
535
+ orig => " 123" , to => 2 , from => 1 ,
536
+ );
537
+
538
+ is-deeply 123 . split (' 2' , : v), (' 1' , ' 2' , ' 3' ), ' :v; Cool' ;
539
+ is-deeply 123 . split (/2 /, : v), (' 1' , $ m , ' 3' ), ' :v; Regex' ;
540
+ is-deeply 123 . split (' 2' , : kv), (' 1' , 0 , ' 2' , ' 3' ), ' :kv; Cool' ;
541
+ is-deeply 123 . split (/2 /, : kv), (' 1' , 0 , $ m , ' 3' ), ' :kv; Regex' ;
542
+ is-deeply 123 . split (' 2' , : p), (' 1' , 0 => ' 2' , ' 3' ), ' :p; Cool' ;
543
+ is-deeply 123 . split (/2 /, : p), (' 1' , 0 => $ m , ' 3' ), ' :p; Regex' ;
544
+ is-deeply 123 . split (' 2' , : k), (' 1' , 0 , ' 3' ), ' :k; Cool' ;
545
+ is-deeply 123 . split (/2 /, : k), (' 1' , 0 , ' 3' ), ' :k; Regex' ;
546
+ is-deeply 4 . split (' ' , : skip-empty), (' 4' ,), ' :skip-empty; Cool' ;
547
+ is-deeply 4 . split (/<< | >> /, : skip-empty), (' 4' ,), ' :skip-empty; Regex' ;
548
+ is-deeply 12345 . split ((' 2' , /4 /)), (" 1" , " 3" , " 5" ), ' @needles form' ;
549
+ }
0 commit comments