hmm construct names manually?

g-counter
Jordan Orelli 4 years ago
parent c8f08097f5
commit a367c31d12

@ -10,21 +10,18 @@ type step struct {
} }
func (s *step) run(t *testing.T) { func (s *step) run(t *testing.T) {
if s.skip { name := ""
for s := s; s != nil; s = s.next {
name += s.name
if s.next != nil { if s.next != nil {
s.next.skip = true name += "/"
t.Run(s.next.name, s.next.run)
} }
t.SkipNow()
} }
t.Run(name, func(t *testing.T) {
for s := s; s != nil; s = s.next {
s.Test.Run(t) s.Test.Run(t)
if s.next != nil {
if t.Failed() || t.Skipped() {
s.next.skip = true
}
t.Run(s.next.name, s.next.run)
} }
})
} }
func (t *Tree) plan() []step { func (t *Tree) plan() []step {

@ -1,7 +1,6 @@
package tea package tea
import ( import (
// "reflect"
"testing" "testing"
) )
@ -9,7 +8,7 @@ import (
func Run(t *testing.T, tree *Tree) { func Run(t *testing.T, tree *Tree) {
plan := tree.plan() plan := tree.plan()
for _, step := range plan { for _, step := range plan {
t.Run(step.name, step.run) step.run(t)
} }
} }
@ -39,8 +38,4 @@ func parseName(test Test) string {
return s.String() return s.String()
} }
return "???" return "???"
// T := reflect.TypeOf(test)
// for i := 0; i < T.NumField(); i++ {
// field := T.Field(i)
// }
} }

Loading…
Cancel
Save