mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-22 02:51:21 -05:00
df520db380
We can still get useful error messages out of d.Try without specifically wrapping every single thing that might throw a noms UsageError, so do so. The code is cleaner. Towards issue #176
23 lines
329 B
Go
23 lines
329 B
Go
package d
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestTry(t *testing.T) {
|
|
assert := assert.New(t)
|
|
|
|
e := Try(func() { Exp.Fail("hey-o") })
|
|
assert.IsType(UsageError{}, e)
|
|
|
|
assert.Panics(func() {
|
|
Try(func() { Chk.Fail("hey-o") })
|
|
})
|
|
|
|
assert.Panics(func() {
|
|
Try(func() { panic("hey-o") })
|
|
})
|
|
}
|