mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-07 15:10:01 +08:00
22 lines
333 B
Go
22 lines
333 B
Go
|
|
package errorx
|
||
|
|
|
||
|
|
import (
|
||
|
|
"errors"
|
||
|
|
"testing"
|
||
|
|
|
||
|
|
"github.com/stretchr/testify/assert"
|
||
|
|
)
|
||
|
|
|
||
|
|
var errDummy = errors.New("hello")
|
||
|
|
|
||
|
|
func TestAtomicError(t *testing.T) {
|
||
|
|
var err AtomicError
|
||
|
|
err.Set(errDummy)
|
||
|
|
assert.Equal(t, errDummy, err.Load())
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestAtomicErrorNil(t *testing.T) {
|
||
|
|
var err AtomicError
|
||
|
|
assert.Nil(t, err.Load())
|
||
|
|
}
|