Permalink
Browse files

[t/spec] revert r26201 (except the part that touches TASKS)

The spec changed split($delimiter, $input) again, so we track that

git-svn-id: http://svn.pugscode.org/pugs@26252 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent c7ef092 commit 9c2b9a8591838e35ba4ccfbec1a47431bae31313 moritz committed Apr 17, 2009
Showing with 24 additions and 31 deletions.
  1. +1 −1 S03-junctions/autothreading.t
  2. +2 −2 S32-list/map_function_return_values.t
  3. +2 −2 S32-str/pack.t
  4. +5 −5 S32-str/split-simple.t
  5. +12 −19 S32-str/split.t
  6. +2 −2 S32-temporal/time.t
@@ -249,7 +249,7 @@ plan 72;
$c = 0;
sub my_substr ($str, $i, $j) {
$c++;
- my @c = $str.split: '';
+ my @c = split "", $str;
join("", @c[$i..($i+$j-1)]);
}
@@ -11,9 +11,9 @@ my %ret;
#?rakudo skip "Awaiting p6l clarification on Hash composer/block"
{
-%ret = map { $_ => uc $_; }, split $text, '';
+%ret = map { $_ => uc $_; }, split "", $text;
is ~%ret.sort, "a\tA b\tB c\tC", "=> works in a map block";
}
-%ret = map { $_, uc $_ }, split $text, '';
+%ret = map { $_, uc $_ }, split "", $text;
is ~%ret.sort, "a\tA b\tB c\tC", "map called with function return values works";
View
@@ -244,7 +244,7 @@ sub list_eq ($$) {
my $can_shriek = 'sSiIlL';
$can_shriek .= 'nNvV' unless $no_signedness;
# h and H can't do either, so act as sanity checks in blead
- foreach my $base (split 'hHsSiIlLqQjJfFdDpPnNvV', '') {
+ foreach my $base (split '', 'hHsSiIlLqQjJfFdDpPnNvV') {
foreach my $mod ('', '<', '>', '!', '<!', '>!', '!<', '!>') {
SKIP: {
# Avoid void context warnings.
@@ -1979,7 +1979,7 @@ is(unpack('c'), 65, "one-arg unpack (change #18751)"); # defaulting to $_
}
{
#50256
- my ($v) = split unpack ('(B)*', 'ab'), //;
+ my ($v) = split //, unpack ('(B)*', 'ab');
is($v, 0); # Doesn't SEGV :-)
}
@@ -20,16 +20,16 @@ sub split_test(@splitted, @expected, Str $desc) {
}
split_test 'a1b24f'.split(/\d+/), <a b f>, 'Str.split(/regex/)';
-split_test split('a1b24f', /\d+/), <a b f>, 'split(/regex/, Str)';
+split_test split(/\d+/, 'a1b24f'), <a b f>, 'split(/regex/, Str)';
split_test 'a1b'.split(1), <a b>, 'Str.split(Any) (with Str semantics';
split_test 'a1b24f'.split(/\d+/, *), <a b f>, 'Str.split(/regex/) (with * limit)';
-split_test split('a1b24f', /\d+/, *), <a b f>, 'split(/regex/, Str) (with * limit)';
+split_test split(/\d+/, 'a1b24f', *), <a b f>, 'split(/regex/, Str) (with * limit)';
split_test 'a1b'.split(1, *), <a b>, 'Str.split(Any) (with Str semantics (with * limit)';
{
split_test 123.split(2), <1 3>, 'Int.split(Int)';
- split_test split(123, 2), <1 3>, 'split(Int, Int)';
+ split_test split(2, 123), <1 3>, 'split(Int, Int)';
}
split_test '1234'.split(/X/), @(<1234>), 'Non-matching regex returns whole string';
@@ -82,10 +82,10 @@ ok (''.split('')).elems == 0, q{''.split('') returns empty list};
ok (split('', '')).elems == 0, q{''.split('') returns empty list};
# split should return capture
-#?rakudo skip "split should return captures"
+my @split = 'abc def ghi'.split(/(\s+)/);
+#?rakudo todo "split should return captures"
#?DOES 3
{
- my @split = 'abc def ghi'.split(/(\s+)/, :all);
ok @split.elems == 5, q{split returns captured delimiter} ;
ok @split[1] eq ' ', q{split captured single space};
ok @split[3] eq ' ', q{split captured multiple spaces};
View
@@ -24,7 +24,6 @@ my %ords = (
9 => 'ninth',
);
-#?DOES 3
sub split_test(@splitted, @expected, Str $desc) {
is +@splitted, +@expected,
"split created the correct value amount for: $desc";
@@ -34,29 +33,25 @@ sub split_test(@splitted, @expected, Str $desc) {
is_deeply [~<< @splitted], [~<< @expected], "values match";
}
-#?rakud skip 'parse errors'
-{
- is_deeply split(:input("fiSMBoC => fREW is Station's Most Bodacious Creation"), " "),
- qw/fiSMBoC => fREW is Station's Most Bodacious Creation/,
- q{split(:input(Str), " "};
+is_deeply split(:input("fiSMBoC => fREW is Station's Most Bodacious Creation"), " "),
+ qw/fiSMBoC => fREW is Station's Most Bodacious Creation/,
+ q{split(:input(Str), " "};
- is_deeply split(:input("UNIFICATIONS => Unions Normally Identified From Initial Characters; Aesthetically Tailored to Infer Other Notions Subconsciously"), /\s+/),
- qw/UNIFICATIONS => Unions Normally Identified From Initial Characters; Aesthetically Tailored to Infer Other Notions Subconsciously/,
- q{split(:input(Str), /\s+/};
-}
+is_deeply split(:input("UNIFICATIONS => Unions Normally Identified From Initial Characters; Aesthetically Tailored to Infer Other Notions Subconsciously"), /\s+/),
+ qw/UNIFICATIONS => Unions Normally Identified From Initial Characters; Aesthetically Tailored to Infer Other Notions Subconsciously/,
+ q{split(:input(Str), /\s+/};
-is_deeply split("forty-two", ""),
+is_deeply split("", "forty-two"),
qw/f o r t y - t w o/,
- q{split Str, ""};
+ q{split "", Str};
# split on a space
-is_deeply split('split this string', ' '),
+is_deeply split(' ', 'split this string'),
qw/split this string/,
- q{split Str, ' '};
+ q{split ' ', Str};
# split on a single character delimiter
-#?rakudo skip 'parse error'
-is_deeply split('try$this$string', '$'),
+is_deeply split('$', 'try$this$string'),
qw/try this string/,
q{split '$', Str};
@@ -136,7 +131,7 @@ is_deeply "a.b".split(/\./), <a b>,
q{"a.b".split(/\./)};
is_deeply "abcd".split(/<null>/), <a b c d>,
- q["abcd".split(/<null>/)];
+ q{"abcd".split(/<null>/)};
{
' ' ~~ /(\s)/;
@@ -148,5 +143,3 @@ is_deeply "abcd".split(/<null>/), <a b c d>,
skip q{' ' ~~ /\s/ did not result in ' '};
}
}
-
-# vim: ft=perl6
View
@@ -15,7 +15,7 @@ plan 10;
# Used in place of Rules for the moment
sub is_dt (Str $datetime) returns Bool {
- my ($dow, $mon, $day, $time, $year) = $datetime.split: ' ';
+ my ($dow, $mon, $day, $time, $year) = split(' ', $datetime);
my $result = 0;
for < Sun Mon Tue Wed Thu Fri Sat > {
@@ -36,7 +36,7 @@ sub is_dt (Str $datetime) returns Bool {
$result++;
}
- my ($hour, $min, $sec) = $time.split: ':';
+ my ($hour, $min, $sec) = split(':',$time);
if $hour >= 0 && $hour <= 23 &&
$min >= 0 && $min <= 59 &&

0 comments on commit 9c2b9a8

Please sign in to comment.