-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
Let's consider the following test
func TestXXX(t *testing.T) {
t.Run("foo", func(t *testing.T) { /* ... */ })
t.Run("bar", func(t *testing.T) { /* ... */ })
...
}It would be useful to has DSL for
func TestXXX(t *testing.T) {
t.Run("foo", it.Then(t).Should(/* ... */))
t.Run("bar", it.Then(t).Should(/* ... */))
...
}or even
func TestXXX(t *testing.T) {
it.Ok("foo", t).Should(/* ... */))
it.Ok("bar", t).Should(/* ... */))
...
}Given syntax simplifies definition of table tests. Full example
func TestXXX(t *testing.T) {
Seq := func(t *testing.T, /* input for test */) it.SeqOf[SomeType] { /* ... common testing function ... */ }
it.Ok("foo", t).Should(
Seq(t, /*... */).Equal(/* ... expected results */)
)
it.Ok("bar", t).Should(
Seq(t, /*... */).Equal(/* ... expected results */)
)
}