-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_test.go
55 lines (40 loc) · 1.23 KB
/
test_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package tempo
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewTest(t *testing.T) {
t.Parallel()
t.Run("new test", func(t *testing.T) {
t.Parallel()
test := NewTest(Example)
assert.Equal(t, "Example", test.Name())
assert.NotNil(t, test.(*workflowWrapper[any, any]).fn)
})
t.Run("new test with input", func(t *testing.T) {
t.Parallel()
test := NewTestWithInput(ExampleWithInput)
assert.Equal(t, "ExampleWithInput", test.Name())
assert.NotNil(t, test.(*workflowWrapper[string, any]).fnWithIn)
})
t.Run("new test with output", func(t *testing.T) {
t.Parallel()
test := NewTestWithOutput(ExampleWithOutput)
assert.Equal(t, "ExampleWithOutput", test.Name())
assert.NotNil(t, test.(*workflowWrapper[any, string]).fnWithOut)
})
t.Run("new test with input and output", func(t *testing.T) {
t.Parallel()
test := NewTestWithInputAndOutput(ExampleWithInputAndOutput)
assert.Equal(t, "ExampleWithInputAndOutput", test.Name())
assert.NotNil(t, test.(*workflowWrapper[string, string]).fnWithInAndOut)
})
}
func Example(t *T) {}
func ExampleWithInput(t *T, input string) {}
func ExampleWithOutput(t *T) string {
return ""
}
func ExampleWithInputAndOutput(t *T, input string) string {
return ""
}