| 105 | } |
| 106 | |
| 107 | func TestOneOfCustomKeysSameKeyError(t *testing.T) { |
| 108 | eval.Context = &eval.DSLContext{} |
| 109 | |
| 110 | ut := &expr.UserTypeExpr{ |
| 111 | AttributeExpr: &expr.AttributeExpr{ |
| 112 | Type: &expr.Object{}, |
| 113 | }, |
| 114 | TypeName: "TestType", |
| 115 | } |
| 116 | |
| 117 | eval.Execute(func() { |
| 118 | OneOf("Shape", func() { |
| 119 | Meta("oneof:type:field", "same") |
| 120 | Meta("oneof:value:field", "same") |
| 121 | Attribute("Circle", Int) |
| 122 | }) |
| 123 | }, ut) |
| 124 | |
| 125 | if eval.Context.Errors == nil { |
| 126 | t.Fatal("expected DSL error for same type and value keys, got none") |
| 127 | } |
| 128 | } |