/
githubmirror
/
pop
Обзор
Документация
Войти
/
githubmirror
/
pop
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
columns/writeable_columns_test.go
51 строка
1 KB
Matthias Fasching
Migrate from packr to fs (#667)
23 ноя 2021, 21:47
Не верифицирован
23 ноя 2021, 21:47
45bb170
Код
Авторство
О чём код?
package columns_test import ( "testing" "github.com/gobuffalo/pop/v6/columns" "github.com/stretchr/testify/require" ) func Test_Columns_WriteableString_Symbolized(t *testing.T) { r := require.New(t) for _, f := range []interface{}{foo{}, &foo{}} { c := columns.ForStruct(f, "foo", "id") u := c.Writeable().SymbolizedString() r.Equal(u, ":LastName, :write") } } func Test_Columns_UpdateString(t *testing.T) { r := require.New(t) for _, f := range []interface{}{foo{}, &foo{}} { c := columns.ForStruct(f, "foo", "id") u := c.Writeable().UpdateString() r.Equal(u, "LastName = :LastName, write = :write") } } type testQuoter struct{} func (testQuoter) Quote(col string) string { return `"` + col + `"` } func Test_Columns_QuotedUpdateString(t *testing.T) { r := require.New(t) q := testQuoter{} for _, f := range []interface{}{foo{}, &foo{}} { c := columns.ForStruct(f, "foo", "id") u := c.Writeable().QuotedUpdateString(q) r.Equal(u, "\"LastName\" = :LastName, \"write\" = :write") } } func Test_Columns_WriteableString(t *testing.T) { r := require.New(t) for _, f := range []interface{}{foo{}, &foo{}} { c := columns.ForStruct(f, "foo", "id") u := c.Writeable().String() r.Equal(u, "LastName, write") } }