mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-25 22:18:23 +02:00
atomicutil: use atomicutil.Value wherever possible (#3517)
* atomicutil: use atomicutil.Value wherever possible * fix test * fix mux router
This commit is contained in:
parent
5c14d2c994
commit
0ac7e45a21
23 changed files with 121 additions and 215 deletions
21
internal/atomicutil/value_test.go
Normal file
21
internal/atomicutil/value_test.go
Normal 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())
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue