|
|
|
@ -6,10 +6,30 @@ import (
|
|
|
|
|
|
|
|
|
|
// Run runs a tree of tests, starting from its root.
|
|
|
|
|
func Run(t *testing.T, tree *Tree) {
|
|
|
|
|
plan := tree.plan()
|
|
|
|
|
for _, step := range plan {
|
|
|
|
|
step.run(t)
|
|
|
|
|
}
|
|
|
|
|
t.Run(tree.name, func(t *testing.T) {
|
|
|
|
|
tree.Test.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 {
|
|
|
|
|