Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
samber committed Jun 22, 2024
1 parent 4743593 commit 81dbcaf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 6 additions & 4 deletions io_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import (
)

func ExampleIO() {
t := time.Date(2024, 6, 22, 0, 0, 0, 0, time.Local)

io := NewIO(func() int {
return time.Now().Year()
return t.Year()
})

result1 := io.Run()
Expand All @@ -18,7 +20,7 @@ func ExampleIO() {
fmt.Println(result2)
fmt.Println(result3)
// Output:
// 2023
// 2023
// 2023
// 2024
// 2024
// 2024
}
6 changes: 4 additions & 2 deletions task_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import (
)

func ExampleTask() {
t := time.Date(2024, 6, 22, 0, 0, 0, 0, time.Local)

task := NewTask(func() *Future[int] {
return NewFuture(func(resolve func(int), reject func(error)) {
resolve(time.Now().Year())
resolve(t.Year())
})
})

Expand All @@ -20,5 +22,5 @@ func ExampleTask() {

fmt.Println(result)
// Output:
// 2023
// 2024
}

0 comments on commit 81dbcaf

Please sign in to comment.