MCPcopy Create free account
hub / github.com/goadesign/goa / TestGoNativeTypeName

Function TestGoNativeTypeName

codegen/types_test.go:130–155  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

128}
129
130func TestGoNativeTypeName(t *testing.T) {
131 cases := map[string]struct {
132 dataType expr.DataType
133 expected string
134 }{
135 "BooleanKind": {expr.Boolean, "bool"},
136 "IntKind": {expr.Int, "int"},
137 "Int32Kind": {expr.Int32, "int32"},
138 "Int64Kind": {expr.Int64, "int64"},
139 "UIntKind": {expr.UInt, "uint"},
140 "UInt32Kind": {expr.UInt32, "uint32"},
141 "UInt64Kind": {expr.UInt64, "uint64"},
142 "Float32Kind": {expr.Float32, "float32"},
143 "Float64Kind": {expr.Float64, "float64"},
144 "StringKind": {expr.String, "string"},
145 "BytesKind": {expr.Bytes, "[]byte"},
146 "AnyKind": {expr.Any, "any"},
147 }
148
149 for k, tc := range cases {
150 actual := GoNativeTypeName(tc.dataType)
151 if actual != tc.expected {
152 t.Errorf("%s: got %#v, expected %#v", k, actual, tc.expected)
153 }
154 }
155}
156
157func TestAttributeTagsWithName_JSONName(t *testing.T) {
158 parent := &expr.AttributeExpr{

Callers

nothing calls this directly

Calls 1

GoNativeTypeNameFunction · 0.85

Tested by

no test coverage detected