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

Function TestIsPrimitive

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

Source from the content-addressed store, hash-verified

393}
394
395func TestIsPrimitive(t *testing.T) {
396 var (
397 primitiveUserType = &UserTypeExpr{
398 AttributeExpr: &AttributeExpr{
399 Type: Boolean,
400 },
401 }
402 notPrimitiveUserType = &UserTypeExpr{
403 AttributeExpr: &AttributeExpr{
404 Type: &Object{},
405 },
406 }
407 primitiveResultType = &ResultTypeExpr{
408 UserTypeExpr: primitiveUserType,
409 }
410 notPrimitiveResultType = &ResultTypeExpr{
411 UserTypeExpr: notPrimitiveUserType,
412 }
413 )
414 cases := map[string]struct {
415 dt DataType
416 expected bool
417 }{
418 "boolean": {
419 dt: Boolean,
420 expected: true,
421 },
422 "int": {
423 dt: Int,
424 expected: true,
425 },
426 "int32": {
427 dt: Int32,
428 expected: true,
429 },
430 "int64": {
431 dt: Int64,
432 expected: true,
433 },
434 "uint": {
435 dt: UInt,
436 expected: true,
437 },
438 "uint32": {
439 dt: UInt32,
440 expected: true,
441 },
442 "uint64": {
443 dt: UInt64,
444 expected: true,
445 },
446 "float32": {
447 dt: Float32,
448 expected: true,
449 },
450 "float64": {
451 dt: Float64,
452 expected: true,

Callers

nothing calls this directly

Calls 1

IsPrimitiveFunction · 0.85

Tested by

no test coverage detected