func TestRecurringEnded(t *testing.T) { tk := tasks.NilTask() r := recurring.AtInterval(kNow, time.Hour) e := tasks.Start(tasks.RecurringTask(tk, r)) e.End() <-e.Done() }
func TestNoError(t *testing.T) { eTask := tasks.NilTask() e := tasks.Start(eTask) <-e.Done() if e.Error() != nil { t.Error("Expected no error.") } }
func TestParallelZeroOrOne(t *testing.T) { task := &fakeTask{} if tasks.ParallelTasks() != tasks.NilTask() { t.Error("Expected zero parallel tasks to be nil task.") } if tasks.ParallelTasks(task) != task { t.Error("Expected one parallel task to be that task.") } }
func TestRecurringCloseStream(t *testing.T) { task := tasks.NilTask() r := &testForClose{} tasks.RunForTesting( tasks.RecurringTask(task, r), &tasks.ClockForTesting{kNow}) if !r.closeCalled { t.Error("Expected close to be called.") } }
func TestRepeatingZeroOrOne(t *testing.T) { task := &fakeTask{} if tasks.RepeatingTask(task, 0) != tasks.NilTask() { t.Error("Expect zero repeating task to be nil task.") } if tasks.RepeatingTask(task, 1) != task { t.Error("Expected one repeating task to be that task.") } }
func TestSeriesZeroOrOne(t *testing.T) { task := &fakeTask{} if tasks.SeriesTasks() != tasks.NilTask() { t.Error("Expected zero series tasks to be nil task.") } if tasks.SeriesTasks(task) != task { t.Error("Expected one series task to be that task.") } }
func TestNoError2(t *testing.T) { eTask := tasks.NilTask() if err := tasks.Run(eTask); err != nil { t.Error("Expected no error.") } }