Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/perl6/roast into issue_2714
Browse files Browse the repository at this point in the history
  • Loading branch information
vrurg committed Jun 19, 2019
2 parents b3fe5fd + a96a2d4 commit 75ddc31
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 22 deletions.
8 changes: 3 additions & 5 deletions CONTRIBUTING.md
Expand Up @@ -33,11 +33,9 @@ When all is well, the commits are finalized, the branch is pushed
to the user's fork on Github, and there the PR is initiated.

If a new test file has been created, one additional step has to be
taken: the new test file has to be added to
`github.com/rakudo/rakudo/t/spectest.data` and a PR for project
`github.com/rakudo/rakudo` can be submitted for that. However, it is
easier just to ask for help adding the new test file on IRC channel
`#perl6`.
taken: the new test file has to be added to `spectest.data`.
(This file used to live in the Rakudo repo at `github.com/rakudo/rakudo`
but it is part of `roast` nowadays.)

#### Fudged tests

Expand Down
4 changes: 2 additions & 2 deletions S03-metaops/hyper.t
Expand Up @@ -400,7 +400,7 @@ my @e;
is [[2, 3], [4, [5, 6]]]».produce(&[+]).gist, "((2 5) (4 6))", ".produce is nodal";
is [[2, 3], [4, [5, 6]]]».reduce(&[+]).gist, "(5 6)", ".reduce is nodal";
is [[2, 3], [4, [5, 6]]]».repeated.gist, "(() ())", ".repeated is nodal";
is [[2, 3], [4, [5, 6]]]».reverse.gist, "([3 2] [[5 6] 4])", ".reverse is nodal";
is [[2, 3], [4, [5, 6]]]».reverse.gist, "((3 2) ([5 6] 4))", ".reverse is nodal";
is [[2, 3], [4, [5, 6]]]».roll(*).gist, "((...) (...))", ".roll is nodal";
is [[2, 3], [4, [5, 6]]]».rotate(1).gist, "([3 2] [[5 6] 4])", ".rotate is nodal";
is [[2, 3], [4, [5, 6]]]».rotor(2).gist, "(((2 3)) ((4 [5 6])))", ".rotor is nodal";
Expand All @@ -411,7 +411,7 @@ my @e;
is [[2, 3], [4, [5, 6]]]».sort.gist, "((2 3) (4 [5 6]))", ".sort is nodal";
is [[2, 3], [4, [5, 6]]]».squish.gist, "((2 3) (4 [5 6]))", ".squish is nodal";
is [[2, 3], [4, [5, 6]]]».Supply.elems, 2, ".Supply is nodal";
is [[2, 3], [4, [5, 6]]]».tree(*.reverse,*.reverse).gist, "((3 2) ([6 5] 4))", ".tree is nodal";
is [[2, 3], [4, [5, 6]]]».tree(*.reverse,*.reverse).gist, "((3 2) ((6 5) 4))", ".tree is nodal";
is ((2, 3), (2,3), (4, (5, (6, 7), (6, 7)), (5, (6, 7), (6, 7))))».unique(:with(&[eqv])).gist, "((2 3) (2 3) (4 (5 (6 7) (6 7))))", ".unique is nodal";
is [[2, 3], [4, [5, 6]]]».values.gist, "((2 3) (4 [5 6]))", ".values is nodal";
Expand Down
21 changes: 21 additions & 0 deletions S11-modules/gh2979.t
@@ -0,0 +1,21 @@
use v6;
use Test;

plan 8;

# GH#2979 Symbols are not to be exported in containerized form.

use lib $?FILE.IO.parent(2).add("packages/S11-modules/lib");

use GH2979;

is @foo.VAR.^name, 'Array', 're-exported Array';
is %foo.VAR.^name, 'Hash', 're-exported Hash';
is $foo.VAR.^name, 'Scalar', 're-exported Scalar';
is &foo.VAR.^name, 'Sub', 're-exported Sub';
is @bar.VAR.^name, 'Array', 'exported Array';
is %bar.VAR.^name, 'Hash', 'exported Hash';
is $bar.VAR.^name, 'Scalar', 'exported Scalar';
is &bar.VAR.^name, 'Sub', 'exported Sub';

# vim: ft=perl6 sw=4 expandtabs
33 changes: 24 additions & 9 deletions S17-channel/basic.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 19;
plan 27;

{
my Channel $c .= new;
Expand All @@ -14,29 +14,43 @@ plan 19;

{
my $c = Channel.new;
my $closed = $c.closed;
$c.send(42);
$c.close();
nok $c.closed, "Channel not closed before value received";
nok $closed, "Channel not closed before value consumed";
is $c.receive, 42, "Received value";
ok $c.closed, "Channel closed after all values received";
ok $closed, "Channel closed after all values consumed";
is $closed.status, Kept, "closed status";
ok $c.poll === Nil, 'poll returns Nil when channel closed';
throws-like { $c.receive }, X::Channel::ReceiveOnClosed;
throws-like { $c.send(18) }, X::Channel::SendOnClosed;
}

{
my $c = Channel.new;
my $closed = $c.closed;
$c.send(1);
$c.fail("oh noes");
is $c.receive, 1, "received first value";
dies-ok { $c.receive }, "error thrown on receive";
my $error = "oh noes";
$c.fail($error);
nok $closed, "Channel not closed before value consumed";
is $c.poll, 1, "Polled value";
ok $closed, "Channel closed after all values consumed";
is $closed.status, Broken, "closed status";
is $closed.cause.message, $error, "failure reason conveyed";
ok $c.poll === Nil, 'poll returns Nil when channel failed';
throws-like { $c.receive }, X::AdHoc, payload => $error,
"error thrown on receive";
throws-like { $c.send(18) }, X::Channel::SendOnClosed;
is $c.closed.cause.message, "oh noes", "failure reason conveyed";
}

{
my class X::Roast::Channel is Exception { };
my $c = Channel.new;
my $closed = $c.closed;
$c.fail(X::Roast::Channel.new);
is $closed.status, Broken,
'Failing an empty channel immediately breaks its .closed promise';
isa-ok $closed.cause, X::Roast::Channel, "failure reason conveyed";
throws-like { $c.receive }, X::Roast::Channel;
}

Expand All @@ -52,9 +66,10 @@ plan 19;

{
my $c = Channel.new;
my $closed = $c.closed;
$c.close;
is $c.closed.status, Kept, 'Closing a channel immediately keeps its .closed promise';

is $closed.status, Kept,
'Closing an empty channel immediately keeps its .closed promise';
}

#?rakudo.jvm skip 'NullPointerException'
Expand Down
8 changes: 4 additions & 4 deletions S32-list/skip.t
Expand Up @@ -117,7 +117,7 @@ subtest 'Seq.skip does not leave original Seq consumable' => {

subtest 'uncached, .skip()' => {
plan 2;
my $s := (1, 2, 3).Seq;
my $s := (1..3).Seq;
my $skipped := $s.skip;

throws-like { @$s }, X::Seq::Consumed, 'original got consumed';
Expand All @@ -126,7 +126,7 @@ subtest 'Seq.skip does not leave original Seq consumable' => {

subtest 'uncached, .skip(n)' => {
plan 2;
my $s := (1, 2, 3).Seq;
my $s := (1..3).Seq;
my $skipped := $s.skip: 2;

throws-like { @$s }, X::Seq::Consumed, 'original got consumed';
Expand All @@ -135,7 +135,7 @@ subtest 'Seq.skip does not leave original Seq consumable' => {

subtest 'cached, .skip()' => {
plan 2;
my $s := (1, 2, 3).Seq;
my $s := (1..3).Seq;
$s.cache;
my $skipped := $s.skip;

Expand All @@ -145,7 +145,7 @@ subtest 'Seq.skip does not leave original Seq consumable' => {

subtest 'cached, .skip(n)' => {
plan 2;
my $s := (1, 2, 3).Seq;
my $s := (1..3).Seq;
$s.cache;
my $skipped := $s.skip: 2;

Expand Down
7 changes: 7 additions & 0 deletions packages/S11-modules/lib/GH2979-Foo.pm6
@@ -0,0 +1,7 @@
use v6;
unit module GH2979-Foo;

our @foo is export;
our %foo is export;
our $foo is export;
sub foo is export { }
17 changes: 17 additions & 0 deletions packages/S11-modules/lib/GH2979.pm6
@@ -0,0 +1,17 @@
use v6;
use GH2979-Foo;

our @b;
our %b;
our $b;
sub b { }

multi EXPORT {
%(
GH2979-Foo::EXPORT::ALL::,
'@bar' => @b,
'%bar' => %b,
'$bar' => $b,
'&bar' => &b,
)
}
4 changes: 2 additions & 2 deletions test_summary
Expand Up @@ -479,7 +479,7 @@ sub get_test_names {

# Build the list of test scripts to run in @tfiles
my @tfiles;
my $testlist = $ARGV[1] || 't/spectest.data';
my $testlist = $ARGV[1] || 't/spec/spectest.data';
my $fh;
open($fh, '<', $testlist) || die "Can't read $testlist: $!";
while (<$fh>) {
Expand Down Expand Up @@ -542,7 +542,7 @@ This test harness written in Perl 5, runs the Perl 6 specification test
suite. It uses the same Test Anything Protocol (TAP) as for example
L<TAP::Harness>, but does not depend those modules.
The names of the tests are listed in t/spectest.data, or another file
The names of the tests are listed in t/spec/spectest.data, or another file
whose name is passed on the command line.
=head2 OUTPUT
Expand Down

0 comments on commit 75ddc31

Please sign in to comment.