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

Function TestIsObject

expr/types_test.go:200–264  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

198}
199
200func TestIsObject(t *testing.T) {
201 var (
202 object = &Object{
203 &NamedAttributeExpr{
204 Name: "foo",
205 Attribute: &AttributeExpr{
206 Type: String,
207 },
208 },
209 }
210 objectUserType = &UserTypeExpr{
211 AttributeExpr: &AttributeExpr{
212 Type: object,
213 },
214 }
215 notObjectUserType = &UserTypeExpr{
216 AttributeExpr: &AttributeExpr{
217 Type: Boolean,
218 },
219 }
220 objectResultType = &ResultTypeExpr{
221 UserTypeExpr: objectUserType,
222 }
223 notObjectResultType = &ResultTypeExpr{
224 UserTypeExpr: notObjectUserType,
225 }
226 )
227 cases := map[string]struct {
228 dt DataType
229 expected bool
230 }{
231 "object user type": {
232 dt: objectUserType,
233 expected: true,
234 },
235 "not object user type": {
236 dt: notObjectUserType,
237 expected: false,
238 },
239 "object result type": {
240 dt: objectResultType,
241 expected: true,
242 },
243 "not object result type": {
244 dt: notObjectResultType,
245 expected: false,
246 },
247 "object": {
248 dt: object,
249 expected: true,
250 },
251 "not object": {
252 dt: Boolean,
253 expected: false,
254 },
255 }
256
257 for k, tc := range cases {

Callers

nothing calls this directly

Calls 1

IsObjectFunction · 0.85

Tested by

no test coverage detected