You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
333 B
Go
22 lines
333 B
Go
4 years ago
|
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())
|
||
|
}
|