[MM-57963] Log Name and DisplayName of groups (#26836)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3513d310af
Коммит
0e6bfbdd26
39
server/public/model/builtin_test.go
Обычный файл
39
server/public/model/builtin_test.go
Обычный файл
@@ -0,0 +1,39 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestSafeDereference(t *testing.T) {
|
||||
t.Run("any", func(t *testing.T) {
|
||||
s := SafeDereference[any](nil)
|
||||
assert.Nil(t, s)
|
||||
})
|
||||
|
||||
t.Run("struct", func(t *testing.T) {
|
||||
s := SafeDereference[struct{}](nil)
|
||||
assert.Equal(t, struct{}{}, s)
|
||||
|
||||
s = SafeDereference(&struct{}{})
|
||||
assert.Equal(t, struct{}{}, s)
|
||||
})
|
||||
|
||||
t.Run("string", func(t *testing.T) {
|
||||
s := SafeDereference[string](nil)
|
||||
assert.Equal(t, "", s)
|
||||
|
||||
s = SafeDereference(NewString("foo"))
|
||||
assert.Equal(t, "foo", s)
|
||||
})
|
||||
|
||||
t.Run("string pointer", func(t *testing.T) {
|
||||
s := SafeDereference[*string](nil)
|
||||
assert.Nil(t, s)
|
||||
|
||||
f := NewString("foo")
|
||||
s = SafeDereference(&f)
|
||||
assert.Equal(t, f, s)
|
||||
})
|
||||
}
|
||||
Ссылка в новой задаче
Block a user