7 "github.com/stretchr/testify/require"
10func TestValue_GetSet(t *testing.T) {
14 require.Equal(t, 42, v.Get())
17 require.Equal(t, 100, v.Get())
20func TestValue_ZeroValue(t *testing.T) {
24 require.Equal(t, "", v.Get())
27 require.Equal(t, "hello", v.Get())
30func TestValue_Struct(t *testing.T) {
38 v := NewValue(config{Name: "test", Count: 1})
39 require.Equal(t, config{Name: "test", Count: 1}, v.Get())
41 v.Set(config{Name: "updated", Count: 2})
42 require.Equal(t, config{Name: "updated", Count: 2}, v.Get())
45func TestValue_PointerPanics(t *testing.T) {
48 require.Panics(t, func() {
53func TestValue_SlicePanics(t *testing.T) {
56 require.Panics(t, func() {
57 NewValue([]string{"a", "b"})
61func TestValue_MapPanics(t *testing.T) {
64 require.Panics(t, func() {
65 NewValue(map[string]int{"a": 1})
69func TestValue_ConcurrentAccess(t *testing.T) {
75 // Concurrent writers.
84 // Concurrent readers.
93 // Value should be one of the set values (0-99).
95 require.GreaterOrEqual(t, got, 0)
96 require.Less(t, got, 100)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list