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

Function TestIsAlias

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

Source from the content-addressed store, hash-verified

501}
502
503func TestIsAlias(t *testing.T) {
504 var (
505 aliasUserType = &UserTypeExpr{
506 AttributeExpr: &AttributeExpr{
507 Type: String,
508 },
509 }
510 notAliasUserType = &UserTypeExpr{
511 AttributeExpr: &AttributeExpr{
512 Type: &Object{},
513 },
514 }
515 aliasResultType = &ResultTypeExpr{
516 UserTypeExpr: aliasUserType,
517 }
518 notAliasResultType = &ResultTypeExpr{
519 UserTypeExpr: notAliasUserType,
520 }
521 )
522 cases := map[string]struct {
523 dt DataType
524 expected bool
525 }{
526 "alias user type": {
527 dt: aliasUserType,
528 expected: true,
529 },
530 "not alias user type": {
531 dt: notAliasUserType,
532 expected: false,
533 },
534 "alias result type": {
535 dt: aliasResultType,
536 expected: true,
537 },
538 "not alias result type": {
539 dt: notAliasResultType,
540 expected: false,
541 },
542 }
543 for k, tc := range cases {
544 if actual := IsAlias(tc.dt); tc.expected != actual {
545 t.Errorf("%s: got %#v, expected %#v", k, actual, tc.expected)
546 }
547 }
548}
549
550func TestPrimitiveIsCompatible(t *testing.T) {
551 var (

Callers

nothing calls this directly

Calls 1

IsAliasFunction · 0.85

Tested by

no test coverage detected