mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
vendor: bump datadriven
Picks up some fixes for papercuts.
This commit is contained in:
committed by
Gyuho Lee
parent
faa71d89d4
commit
69c97cdc8f
59
vendor/github.com/cockroachdb/datadriven/datadriven.go
generated
vendored
59
vendor/github.com/cockroachdb/datadriven/datadriven.go
generated
vendored
@@ -93,36 +93,45 @@ func runTestInternal(
|
||||
|
||||
r := newTestDataReader(t, sourceName, reader, rewrite)
|
||||
for r.Next(t) {
|
||||
d := &r.data
|
||||
actual := func() string {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
fmt.Printf("\npanic during %s:\n%s\n", d.Pos, d.Input)
|
||||
panic(r)
|
||||
t.Run("", func(t *testing.T) {
|
||||
d := &r.data
|
||||
actual := func() string {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
fmt.Printf("\npanic during %s:\n%s\n", d.Pos, d.Input)
|
||||
panic(r)
|
||||
}
|
||||
}()
|
||||
actual := f(d)
|
||||
if !strings.HasSuffix(actual, "\n") {
|
||||
actual += "\n"
|
||||
}
|
||||
return actual
|
||||
}()
|
||||
return f(d)
|
||||
}()
|
||||
|
||||
if r.rewrite != nil {
|
||||
r.emit("----")
|
||||
if hasBlankLine(actual) {
|
||||
if r.rewrite != nil {
|
||||
r.emit("----")
|
||||
r.rewrite.WriteString(actual)
|
||||
r.emit("----")
|
||||
r.emit("----")
|
||||
} else {
|
||||
r.emit(actual)
|
||||
if hasBlankLine(actual) {
|
||||
r.emit("----")
|
||||
r.rewrite.WriteString(actual)
|
||||
r.emit("----")
|
||||
r.emit("----")
|
||||
} else {
|
||||
r.emit(actual)
|
||||
}
|
||||
} else if d.Expected != actual {
|
||||
t.Fatalf("\n%s: %s\nexpected:\n%s\nfound:\n%s", d.Pos, d.Input, d.Expected, actual)
|
||||
} else if testing.Verbose() {
|
||||
input := d.Input
|
||||
if input == "" {
|
||||
input = "<no input to command>"
|
||||
}
|
||||
// TODO(tbg): it's awkward to reproduce the args, but it would be helpful.
|
||||
fmt.Printf("\n%s:\n%s [%d args]\n%s\n----\n%s", d.Pos, d.Cmd, len(d.CmdArgs), input, actual)
|
||||
}
|
||||
} else if d.Expected != actual {
|
||||
t.Fatalf("\n%s: %s\nexpected:\n%s\nfound:\n%s", d.Pos, d.Input, d.Expected, actual)
|
||||
} else if testing.Verbose() {
|
||||
input := d.Input
|
||||
if input == "" {
|
||||
input = "<no input to command>"
|
||||
}
|
||||
// TODO(tbg): it's awkward to reproduce the args, but it would be helpful.
|
||||
fmt.Printf("\n%s:\n%s [%d args]\n%s\n----\n%s", d.Pos, d.Cmd, len(d.CmdArgs), input, actual)
|
||||
})
|
||||
if t.Failed() {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user