Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add basic test for condvar

  • Loading branch information...
commit fa7367d2cbf7db95e5779437fd89261045fb7b39 1 parent 8136ac5
@am0c am0c authored
Showing with 26 additions and 0 deletions.
  1. +26 −0 t/04-condvar.t
View
26 t/04-condvar.t
@@ -0,0 +1,26 @@
+use Test;
+use MuEvent;
+
+plan 5;
+
+my $start = time;
+my $plan = 1;
+
+{
+ my $cv = MuEvent::condvar;
+ ok $cv.send( "foo" ), "send";
+ ok $cv.recv ~~ "foo", "recv";
+}
+
+{
+ my $cv = MuEvent::condvar;
+
+ MuEvent::timer(after => 2, cb => sub {
+ ok $plan++ == 2 && $start+1 <= time <= $start+3, "timer occured";
+ $cv.send;
+ });
+
+ ok $plan++ == 1 && time - $start < 1, "not block timer";
+ $cv.recv;
+ ok $plan++ == 3 && $start+1 <= time <= $start+3, "received blocked";
+}
Please sign in to comment.
Something went wrong with that request. Please try again.