atomicerror_test.go 333 B

123456789101112131415161718192021
  1. package errorx
  2. import (
  3. "errors"
  4. "testing"
  5. "github.com/stretchr/testify/assert"
  6. )
  7. var errDummy = errors.New("hello")
  8. func TestAtomicError(t *testing.T) {
  9. var err AtomicError
  10. err.Set(errDummy)
  11. assert.Equal(t, errDummy, err.Load())
  12. }
  13. func TestAtomicErrorNil(t *testing.T) {
  14. var err AtomicError
  15. assert.Nil(t, err.Load())
  16. }