Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Proc::Async: test more exceptions
  • Loading branch information
moritz committed Jan 25, 2015
1 parent bc2983c commit e223c44
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion S17-procasync/basic.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 12;
plan 14;

my $pc = $*DISTRO.is-win
?? Proc::Async.new( 'cmd', </c echo Hello World> )
Expand All @@ -22,10 +22,14 @@ $se.act: { $stderr ~= $_.subst("\r", "", :g) };
my $pm = $pc.start;
isa_ok $pm, Promise;

throws_like { $pc.start }, X::Proc::Async::AlreadyStarted;

throws_like { $pc.print("foo") }, X::Proc::Async::OpenForWriting, :method<print>;
throws_like { $pc.say("foo") }, X::Proc::Async::OpenForWriting, :method<say>;
throws_like { $pc.write(Buf.new(0)) }, X::Proc::Async::OpenForWriting, :method<write>;

throws_like { $pc.stdout.tap(&say) }, X::Proc::Async::TapBeforeSpawn, :handle<stdout>;

my $ps = await $pm;
isa_ok $ps, Proc::Status;
ok $ps, 'was execution successful';
Expand Down

0 comments on commit e223c44

Please sign in to comment.