atomicutil: use atomicutil.Value wherever possible (#3517)

* atomicutil: use atomicutil.Value wherever possible

* fix test

* fix mux router
This commit is contained in:
Caleb Doxsey 2022-07-28 15:38:38 -06:00 committed by GitHub
parent 5c14d2c994
commit 0ac7e45a21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 121 additions and 215 deletions

View file

@ -0,0 +1,21 @@
package atomicutil
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestValue(t *testing.T) {
v := NewValue(5)
assert.Equal(t, 5, v.Load())
t.Run("nil", func(t *testing.T) {
var v *Value[int]
assert.Equal(t, 0, v.Load())
})
t.Run("default", func(t *testing.T) {
var v Value[int]
assert.Equal(t, 0, v.Load())
})
}