option_test.go 383 B

12345678910111213141516171819202122232425
  1. package fserr
  2. import (
  3. "github.com/stretchr/testify/suite"
  4. "testing"
  5. )
  6. type TestOptionSuite struct {
  7. suite.Suite
  8. opt Option
  9. }
  10. func (s *TestOptionSuite) SetupTest() {
  11. s.opt = MsgOption("cover message")
  12. }
  13. func (s *TestOptionSuite) TestCode() {
  14. w := &withCode{}
  15. s.opt(w)
  16. s.Equal("cover message", w.Msg)
  17. }
  18. func TestOption(t *testing.T) {
  19. suite.Run(t, &TestOptionSuite{})
  20. }