Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' of github.com:perl6/roast
  • Loading branch information
niner committed Jul 18, 2015
2 parents a8ce6fb + 256d6a9 commit 564b3b6
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 17 deletions.
16 changes: 15 additions & 1 deletion S12-attributes/class.t
@@ -1,6 +1,8 @@
use v6;

use Test;
use lib 't/spec/packages';
use Test::Util;

=begin pod
Expand All @@ -11,7 +13,7 @@ Class Attributes
#L<S12/Class attributes/"Class attributes are declared">
#L<S12/Class methods/Such a metaclass method is always delegated>

plan 21;
plan 23;

class Foo {
our $.bar = 23;
Expand Down Expand Up @@ -128,4 +130,16 @@ dies-ok {$test5 = Quux.bar}, 'class attribute accessor hidden by accessor in sub
'cannot declare attribute inside of an EVAL in class';
}

# RT #125625
is_run(
'our $.a',
{ err => -> $o { $o ~~ /:i useless/ && $o ~~ /:i accessor/ } },
'useless our $.a accessor method generation error contains useful enough hints'
);
is_run(
'my $.a',
{ err => -> $o { $o ~~ /:i useless/ && $o ~~ /:i accessor/ } },
'useless my $.a accessor method generation error contains useful enough hints'
);

# vim: ft=perl6
24 changes: 21 additions & 3 deletions S14-roles/mixin.t
@@ -1,6 +1,6 @@
use v6;
use Test;
plan 37;
plan 45;

# L<S14/Run-time Mixins/>

Expand Down Expand Up @@ -61,8 +61,6 @@ is $y.test, 42, 'method from other role was OK too';
is $x.b, 2, 'mixining in two roles one after the other';
}


#?rakudo skip 'mixin at the point of declaration is compile time RT #124747'
#?niecza skip 'Trait does not available on variables'
{
my @array does R1;
Expand Down Expand Up @@ -187,4 +185,24 @@ lives-ok {(True but role {}).gist}, 'can mix into True';
ok ([] but B) ~~ B, 'Mix-in to item array works';
}

# RT #124121
{
my $x;
lives-ok { $x = True but [1, 2] }, 'but with array literal on RHS works';
is $x.Array, [1, 2], 'but with array literal provides a .Array method';
}
{
my $x;
lives-ok { $x = True but (1, 2).list }, 'but with (1, 2).list on RHS works';
is $x.List, (1, 2).list, 'but with (1, 2).list provides a .List method';
}
{
my $x;
lives-ok { $x = True but (1, "x") }, 'but with (1, "2") on RHS works';
is $x.Int, 1, 'but with (1, "x") provides a .Int method returning 1';
is $x.Str, "x", 'but with (1, "x") provides a .Str method returning "x"';
}
throws-like 'True but (1, 1)', Exception, gist => { $^g ~~ /'Int'/ && $g ~~ /resolved/ },
'True but (1, 1) gets Int conflict to resolve due to generating two Int methods';

# vim: syn=perl6
11 changes: 10 additions & 1 deletion S32-exceptions/misc.t
Expand Up @@ -3,7 +3,7 @@ use Test;
use lib "t/spec/packages";
use Test::Util;

plan 326;
plan 328;

throws-like '42 +', X::AdHoc, "missing rhs of infix", message => rx/term/;

Expand Down Expand Up @@ -702,4 +702,13 @@ throws-like 'my package P { }; sub foo(P of Int) { }', X::NotParametric;
throws-like 'my module M { }; sub foo(M of Int) { }', X::NotParametric;
throws-like 'my class C { }; sub foo(C of Int)', X::NotParametric;

# RT #125620
{
my class CustomException is Exception {}
try die CustomException.new;
lives-ok { $!.gist }, 'Can gist an exception with no message method';
ok $!.gist ~~ /CustomException/,
'The gist of exception with no message method mentions the type';
}

# vim: ft=perl6
6 changes: 2 additions & 4 deletions S32-str/split-simple.t
Expand Up @@ -57,17 +57,16 @@ split_test(
'Limit larger than number of split values doesn\'t return extranuous elements'
);

#?niecza skip 'niecza has empty value at beginning of list'
{
split_test
'abcdefg'.split('', 3),
<a b cdefg>,
('', 'a', 'bcdefg'),
'split into characters respects limit (1)';

# catch possible off-by-one errors
split_test
'abc'.split('', 3),
<a b c>,
( '', 'a', 'bc'),
'split into characters respects limit (2)';
}

Expand Down Expand Up @@ -107,7 +106,6 @@ ok (split('', '')).elems == 0, q{''.split('') returns empty list};
{
my $rt112868 = 'splitting on empty';
ok $rt112868.split('').elems > 0, q<.split('') does something>;
#?rakudo todo 'RT #112868'
is $rt112868.split(''), $rt112868.split(/''/),
q<.split('') does the same thing as .split(/''/) (RT #112868)>;
}
Expand Down
9 changes: 4 additions & 5 deletions S32-str/split.t
Expand Up @@ -7,16 +7,15 @@ use Test;
plan 53;

# split on empty string
#?niecza todo "split on empty string has leading empty elements"
{
is split("", "forty-two").join(','), 'f,o,r,t,y,-,t,w,o',
is split("", "forty-two").join(','), ',f,o,r,t,y,-,t,w,o,',
q{split "", Str};
is "forty-two".split("").join(','), 'f,o,r,t,y,-,t,w,o',
is "forty-two".split("").join(','), ',f,o,r,t,y,-,t,w,o,',
q{Str.split: ""};

is split("", "forty-two", 3).join(','), 'f,o,rty-two',
is split("", "forty-two", 3).join(','), ',f,orty-two',
q{split "", Str};
is "forty-two".split("",3).join(','), 'f,o,rty-two',
is "forty-two".split("",3).join(','), ',f,orty-two',
q{Str.split: ""};
}

Expand Down
2 changes: 1 addition & 1 deletion integration/advent2011-day23.t
Expand Up @@ -68,7 +68,7 @@ for 'I must go down to the seas again' {
my @chars;

@chars = $word.split('');
is-deeply @chars, [<C a m e l i a>], q<@chars = $word.split('');>;
is-deeply @chars, ['', <C a m e l i a>, ''], q<@chars = $word.split('');>;

@chars = $word.comb;
is-deeply @chars, [<C a m e l i a>], '@chars = $word.comb;';
Expand Down
4 changes: 2 additions & 2 deletions integration/real-strings.t
Expand Up @@ -33,8 +33,8 @@ throws-like { for "a b c".split(/\s/) -> $foo { $foo = $foo; } },
#?niecza todo 'Suspect test'
{
my @foo = 'AB'.split('');
@foo[0]++;
is ~@foo, 'B B', 'Str.split(Str) works with postfix:<++>';
@foo[1]++;
is ~@foo, ' B B ', 'Str.split(Str) works with postfix:<++>';
}

ok 1.Str ~~ / ^ 1 $ /, 'RT 66366; 1.Str is a "good" Str';
Expand Down

0 comments on commit 564b3b6

Please sign in to comment.