Skip to content

Commit

Permalink
modified: scheduler_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
nbari committed Sep 16, 2016
1 parent 4cf2dc5 commit c2f0887
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions scheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,27 @@ func TestScheduler(t *testing.T) {
case <-time.After(3 * time.Second):
sk.StopAll()
}
if c.Get() != 3 {
t.Error("Expecting 3")
if c.Get() <= 1 {
t.Error("Expecting c > 0")
}
}

func TestStopError(t *testing.T) {
sk := New()
c := &count{}
sk.AddScheduler("print", 1, func() { fmt.Println(c.Get()); c.Add(1) })
err := sk.Stop("none")
if err == nil {
t.Error("Expecint error")
}
}

func TestStop(t *testing.T) {
sk := New()
c := &count{}
sk.AddScheduler("print", 1, func() { fmt.Println(c.Get()); c.Add(1) })
err := sk.Stop("print")
if err != nil {
t.Error(err)
}
}

0 comments on commit c2f0887

Please sign in to comment.