Exemple #1
0
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()
}
Exemple #2
0
func TestNoError(t *testing.T) {
	eTask := tasks.NilTask()
	e := tasks.Start(eTask)
	<-e.Done()
	if e.Error() != nil {
		t.Error("Expected no error.")
	}
}
Exemple #3
0
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.")
	}
}
Exemple #4
0
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.")
	}
}
Exemple #5
0
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.")
	}
}
Exemple #6
0
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.")
	}
}
Exemple #7
0
func TestNoError2(t *testing.T) {
	eTask := tasks.NilTask()
	if err := tasks.Run(eTask); err != nil {
		t.Error("Expected no error.")
	}
}