Add test case for Must helper.

This commit is contained in:
Maxim Bublis 2018-01-03 17:44:51 +00:00
parent f6920249aa
commit 36e9d2ebbd
1 changed files with 10 additions and 0 deletions

View File

@ -23,6 +23,7 @@ package uuid
import (
"bytes"
"fmt"
"testing"
. "gopkg.in/check.v1"
@ -88,3 +89,12 @@ func (s *testSuite) TestSetVariant(c *C) {
u.SetVariant(VariantFuture)
c.Assert(u.Variant(), Equals, VariantFuture)
}
func (s *testSuite) TestMust(c *C) {
defer func() {
c.Assert(recover(), NotNil)
}()
Must(func() (UUID, error) {
return Nil, fmt.Errorf("uuid: expected error")
}())
}