Commit 41240d2e authored by Kirill Smelkov's avatar Kirill Smelkov

go/internal/xtesting: FatalIf

This is utility to create X function, similar to exc.Raisif, but that
would call t.Fatal instead.
parent 13c77191
...@@ -232,11 +232,7 @@ func DrvTestLoad(t *testing.T, zdrv zodb.IStorageDriver, txnvOk []Txn) { ...@@ -232,11 +232,7 @@ func DrvTestLoad(t *testing.T, zdrv zodb.IStorageDriver, txnvOk []Txn) {
// DrvTestWatch verifies that storage driver watcher can observe commits done from outside. // DrvTestWatch verifies that storage driver watcher can observe commits done from outside.
func DrvTestWatch(t *testing.T, zurl string, zdrvOpen zodb.DriverOpener) { func DrvTestWatch(t *testing.T, zurl string, zdrvOpen zodb.DriverOpener) {
X := func(err error) { X := FatalIf(t)
if err != nil {
t.Fatal(err)
}
}
NeedPy(t, "zodbtools") NeedPy(t, "zodbtools")
...@@ -332,6 +328,15 @@ func DrvTestWatch(t *testing.T, zurl string, zdrvOpen zodb.DriverOpener) { ...@@ -332,6 +328,15 @@ func DrvTestWatch(t *testing.T, zurl string, zdrvOpen zodb.DriverOpener) {
} }
// FatalIf(t) returns function f(err), which call t.Fatal if err != nil.
func FatalIf(t *testing.T) func(error) {
return func(err error) {
if err != nil {
t.Fatal(err)
}
}
}
// b is syntactic sugar for byte literals. // b is syntactic sugar for byte literals.
// //
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment