1 files changed,
0 insertions(+),
22 deletions(-)
Author:
Oleksandr Smirnov
olexsmir@gmail.com
Committed at:
2026-07-11 14:04:12 +0300
Authored at:
2026-07-11 14:03:52 +0300
Change ID:
optpwqmwykqrkkwtlxztpltxuykprywk
Parent:
e64121e
M
json2go_test.go
··· 2 2 3 3 import ( 4 4 "errors" 5 - "fmt" 6 - "reflect" 7 5 "strings" 8 6 "testing" 9 7 ) 10 - 11 -func field(indentLvl int, name, type_ string, json_ ...string) string { 12 - indent := strings.Repeat("\t", indentLvl) 13 - if strings.Contains(type_, "struct") { 14 - return fmt.Sprintf("\n%s%s %s", indent, name, type_) 15 - } 16 - 17 - tag := strings.ToLower(name) 18 - if len(json_) == 1 { 19 - tag = json_[0] 20 - } 21 - return fmt.Sprintf("\n%s%s %s `json:\"%s\"`", indent, name, type_, tag) 22 -} 23 8 24 9 func TestTransform(t *testing.T) { 25 10 tests := map[string]struct { ··· 174 159 t.Errorf("expected error: %v, got: %v", expected, actual) 175 160 } 176 161 } 177 - 178 -func assertEqual[T any](t *testing.T, expected, actual T) { 179 - t.Helper() 180 - if !reflect.DeepEqual(expected, actual) { 181 - t.Errorf("expected: %v, got: %v\n", expected, actual) 182 - } 183 -}