Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[S32] more unfossiling
  • Loading branch information
moritz committed May 23, 2011
1 parent 19614fb commit 85d2267
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 31 deletions.
3 changes: 1 addition & 2 deletions S32-str/quotemeta.t
Expand Up @@ -23,7 +23,7 @@ use v6;
use Test;


plan 12;
plan 11;

# For the moment I don't know how to handle the lack of Config.pm...
# Sorry for ebcdic users!
Expand All @@ -35,7 +35,6 @@ is('Config.pm', 'available', 'Config.pm availability');
# L<S32::Str/Str/quotemeta>

is(quotemeta("HeLLo World-72_1"), "HeLLo\\ World\\-72_1", "simple quotemeta test");
is(quotemeta(:string("fREW => fROOH represents encephelon welkin")), "frew\\ \\=\\>\\ frooh\\ represents\\ encephelon\\ welkin", "quotemeta works with named argument");
is(quotemeta(""), "", "empty string");

$_ = "HeLLo World-72_1";
Expand Down
4 changes: 1 addition & 3 deletions S32-str/rindex.t
Expand Up @@ -3,14 +3,12 @@ use Test;

# L<S32::Str/Str/"=item rindex">

plan 33;
plan 32;

# Simple - with just a single char

is(rindex("Hello World", "H"), 0, "One char, at beginning");
is(rindex("Hello World", "l"), 9, "One char, in the middle");
#?rakudo skip 'calling positional params by name'
is(rindex(:string("fROOH => fRUE: Robotic Ominous Ossified Herald"), "O"), 2, "rindex works with named argument");
is(rindex("Hello World", "d"), 10, "One char, in the end");
ok(!defined(rindex("Hello World", "x")), "One char, no match");

Expand Down
3 changes: 1 addition & 2 deletions S32-str/sameaccent.t
Expand Up @@ -3,10 +3,9 @@ use Test;

# L<S32::Str/Str/"=item sameaccent">

plan 8;
plan 7;

is(sameaccent('ABb', '茥茥茥'), '群蓛苺', 'sameaccent as a function works');
is(sameaccent(:string('ABb'), '茥茥茥'), '群蓛苺', 'sameaccent works with named argument');

# should this be an exception or a Failure instead?
is(sameaccent('AF', '茥茥'), '群F', 'sameaccent without matching character silently fails');
Expand Down
4 changes: 1 addition & 3 deletions S32-str/samecase.t
Expand Up @@ -9,7 +9,7 @@ Basic test for the samecase() builtin with a string (Str).
=end pod

plan 9;
plan 8;

# As a function
is( samecase('Perl6', 'abcdE'), 'perl6', 'as a function');
Expand All @@ -18,8 +18,6 @@ is( samecase('Perl6', 'abcdE'), 'perl6', 'as a function');
is( ''.samecase(''), '', 'empty string' );
is( 'Hello World !'.samecase('AbCdEfGhIjKlMnOpQrStUvWxYz'), 'HeLlO WoRlD !', 'literal');

#?rakudo skip 'calling positional params by name'
is( samecase(:string( "fRUE => fRIOUX's Rectitude is Underpinned by Equivalence"), 'AbCdEfGhIjKlMnOpQrStUvWxYz'), "FrUe => FrIoUx's rEcTiTuDE is Underpinned by Equivalence", 'samecase works with a named argument');

# On a variable
my Str $a = 'Just another Perl6 hacker';
Expand Down
11 changes: 1 addition & 10 deletions S32-str/split.t
Expand Up @@ -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 39;
plan 37;

# split on an empty string

Expand All @@ -24,15 +24,6 @@ my %ords = (
9 => 'ninth',
);

#?rakudo skip 'named arguments to split()'
is split(:input("fiSMBoC => fREW is Station's Most Bodacious Creation"), " ").join(','),
qw/fiSMBoC => fREW is Station's Most Bodacious Creation/.join(','),
q{split(:input(Str), " "};

#?rakudo skip 'named arguments to split()'
is split(:input("UNIFICATIONS => Unions Normally Identified From Initial Characters; Aesthetically Tailored to Infer Other Notions Subconsciously"), /\s+/).join(','),
qw/UNIFICATIONS => Unions Normally Identified From Initial Characters; Aesthetically Tailored to Infer Other Notions Subconsciously/.join(','),
q{split(:input(Str), /\s+/};

is split("", "forty-two").join(','),
<f o r t y - t w o>.join(','),
Expand Down
4 changes: 1 addition & 3 deletions S32-str/sprintf.t
Expand Up @@ -2,13 +2,11 @@ use v6;

use Test;

plan 44;
plan 43;

# L<S32::Str/Str/"identical to" "C library sprintf">

is sprintf("Hi"), "Hi", "sprintf() works with zero args";
#?rakudo skip 'calling positional params by name'
is sprintf(:format("RESEARCH => Robots Eagerly Sailing Epic Artificial Rhythmic Cyclical Homonyms")), "RESEARCH => Robots Eagerly Sailing Epic Artificial Rhythmic Cyclical Homonyms", "sprintf() works with named argument";
is sprintf("%%"), "%", "sprintf() escapes % correctly";
is sprintf("%03d", 3), "003", "sprintf() works with one arg";
is sprintf("%03d %02d", 3, 1), "003 01", "sprintf() works with two args";
Expand Down
4 changes: 0 additions & 4 deletions S32-str/substr.t
Expand Up @@ -15,8 +15,6 @@ plan 126;
is(substr($str, -1), "r", "last char");
is(substr($str, -4, 2), "ob", "counted from the end");
is(substr($str, 1, 2), "oo", "arbitrary middle");
#?rakudo skip 'calling positional params by name'
is(substr(:string("IMAGINATIVE => Insane Mimicries of Amazingly Gorgeous, Incomplete Networks, Axiomatic Theorems, and Immortally Vivacious Ecstasy"), 1, 2), "MA", "substr works with named argument");
is(substr($str, 3), "bar", "length omitted");
is(substr($str, 3, 10), "bar", "length goes past end");
ok(!defined(substr($str, 20, 5)), "substr outside of string");
Expand Down Expand Up @@ -141,8 +139,6 @@ sub l (Int $a) { my $l = $a; return $l }
is(substr($str, -1, l(1)), "r", "last char (substr(Int, StrLen)).");
is(substr($str, -4, l(2)), "ob", "counted from the end (substr(Int, StrLen)).");
is(substr($str, 1, l(2)), "oo", "arbitrary middle (substr(Int, StrLen)).");
#?rakudo skip 'calling positional params by name'
is(substr(:string("IMAGINATIVE => Insane Mimicries of Amazingly Gorgeous, Incomplete Networks, Axiomatic Theorems, and Immortally Vivacious Ecstasy"), 1, l(2)), "MA", "substr works with named argument (substr(Int, StrLen)).");
is(substr($str, 3, l(6)), "bar", "length goes past end (substr(Int, StrLen)).");
ok(!defined(substr($str, 20, l(5))), "substr outside of string (substr(Int, StrLen)).");
ok(!defined(substr($str, -100, l(5))), "... on the negative side (substr(Int, StrLen)).");
Expand Down
3 changes: 1 addition & 2 deletions S32-str/uc.t
Expand Up @@ -2,12 +2,11 @@ use v6;

use Test;

plan 20;
plan 19;

# L<S32::Str/"Str"/=item uc>

is(uc("Hello World"), "HELLO WORLD", "simple");
is(uc(:string("station")), "STATION", "uc with named argument");
is(uc(""), "", "empty string");
{
is(uc("氓盲枚"), "脜脛脰", "some finnish non-ascii chars");
Expand Down
3 changes: 1 addition & 2 deletions S32-str/ucfirst.t
Expand Up @@ -2,12 +2,11 @@ use v6;

use Test;

plan 5;
plan 4;

# L<S32::Str/Str/ucfirst>

is ucfirst("hello world"), "Hello world", "simple";
is ucfirst(:string("station")), "Station", "ucfirst works with named argument";
is ucfirst(""), "", "empty string";
is ucfirst("眉眉眉眉"), "脺眉眉眉", "umlaut";
is ucfirst("贸贸贸贸"), "脫贸贸贸", "accented chars";
Expand Down

0 comments on commit 85d2267

Please sign in to comment.