Skip to content
Browse files

Test suite refactoring (spec/S29).

Refactored comb/split tests.


git-svn-id: http://svn.pugscode.org/pugs@19454 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent f199a9d commit 76bd7fac9f1ef6c74d27950467ab61b90c245b57 cosimo committed Jan 12, 2008
Showing with 41 additions and 13 deletions.
  1. +40 −0 S29-functions/str/comb.t
  2. +1 −13 S29-functions/str/split.t
View
40 S29-functions/str/comb.t
@@ -0,0 +1,40 @@
+use v6-alpha;
+
+use Test;
+
+plan 10;
+
+# L<S29/Str/=item comb>
+
+# comb Str
+is "".comb, (), 'comb on empty string';
+is "a bc d".comb, <a bc d>, 'default matcher and limit';
+is "a bc d".comb(:limit(2)), <a bc>, 'default matcher with supplied limit',
+ :todo<feature>;
+
+is_deeply @('split this string'.comb).map:{ "$_" },
+ <split this string>,
+ q{Str.comb};
+
+is "a ab bc ad ba".comb(m:Perl5/\ba\S*/), <a ab ad>,
+ 'match for any a* words';
+is "a ab bc ad ba".comb(m:Perl5/\S*a\S*/), <a ab ad ba>,
+ 'match for any *a* words';
+is eval('"a ab bc ad ba".comb(m:Perl5/\S*a\S*/, 2)'), <a ab>,
+ 'matcher and limit', :todo<feature>;
+
+is_deeply "forty-two".comb(/./),
+ qw/f o r t y - t w o/,
+ q{Str.comb(/./)};
+
+is_deeply "forty two".comb(/./),
+ (qw/f o r t y/, ' ', qw/t w o/),
+ q{Str.comb(/./)};
+
+# comb a list
+is eval('(<a ab>, <bc ad ba>).comb(m:Perl5/\S*a\S*/)'), <a ab ad ba>,
+ 'comb a list', :todo<feature>;
+
+# needed: comb a filehandle
+
+# needed: captures in pattern return Match objects
View
14 S29-functions/str/split.t
@@ -8,7 +8,7 @@ use Test;
# this test really wants is_deeply()
# and got it, except for a couple of cases that fail because of Match objects
# being returned -- Aankhen
-plan 30;
+plan 27;
# split on an empty string
@@ -37,23 +37,11 @@ is_deeply split("", "forty-two"),
qw/f o r t y - t w o/,
q{split "", Str};
-is_deeply "forty-two".comb(/./),
- qw/f o r t y - t w o/,
- q{Str.comb(/./)};
-
-is_deeply "forty two".comb(/./),
- (qw/f o r t y/, ' ', qw/t w o/),
- q{Str.comb(/./)};
-
# split on a space
is_deeply split(' ', 'split this string'),
qw/split this string/,
q{split ' ', Str};
-is_deeply @('split this string'.comb).map:{ "$_" },
- <split this string>,
- q{Str.comb};
-
# split on a single character delimiter
is_deeply split('$', 'try$this$string'),
qw/try this string/,

0 comments on commit 76bd7fa

Please sign in to comment.
Something went wrong with that request. Please try again.