walk tree without that plan routine

g-counter
Jordan Orelli 4 years ago
parent a367c31d12
commit 32e73e2626

@ -6,10 +6,30 @@ import (
// Run runs a tree of tests, starting from its root. // Run runs a tree of tests, starting from its root.
func Run(t *testing.T, tree *Tree) { func Run(t *testing.T, tree *Tree) {
plan := tree.plan() t.Run(tree.name, func(t *testing.T) {
for _, step := range plan { tree.Test.Run(t)
step.run(t)
} if t.Failed() || t.Skipped() {
for _, child := range tree.children {
skip(t, child)
}
return
}
for _, child := range tree.children {
tree.Test.Run(t)
Run(t, child)
}
})
}
func skip(t *testing.T, tree *Tree) {
t.Run(tree.name, func(t *testing.T) {
t.Skip("tea skipped: dependency failed")
for _, child := range tree.children {
skip(t, child)
}
})
} }
func New(test Test) *Tree { func New(test Test) *Tree {

Loading…
Cancel
Save