Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1251)

Unified Diff: mojom/mojom_parser/mojom/types_test.go

Issue 1514173002: New Mojom parser: Don't allow enum variables to be assigned int values. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: working on stuff Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojom/mojom_parser/mojom/types.go ('k') | mojom/mojom_parser/mojom/user_defined_types.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojom/mojom_parser/mojom/types_test.go
diff --git a/mojom/mojom_parser/mojom/types_test.go b/mojom/mojom_parser/mojom/types_test.go
index 8853be5588807c09e988aee8c055e5e1346c3806..92e4eb3b62f483924e8d41be24ba472b84977569 100644
--- a/mojom/mojom_parser/mojom/types_test.go
+++ b/mojom/mojom_parser/mojom/types_test.go
@@ -171,7 +171,8 @@ func TestMarkTypeCompatible(t *testing.T) {
{NewArrayTypeRef(SimpleTypeInt32, 0, false), []bool{false, false, false, false, false, false, false, false, false, false, false, true}},
{NewMapTypeRef(SimpleTypeInt32, SimpleTypeInt64, false), []bool{false, false, false, false, false, false, false, false, false, false, false, true}},
{BuiltInType("handle"), []bool{false, false, false, false, false, false, false, false, false, false, false, false}},
- {userTypeRef, []bool{false, false, true, true, true, true, true, true, true, true, false, true}},
+ // Assignments to UserTypeRefs are not validated at all during parsing.
+ {userTypeRef, []bool{true, true, true, true, true, true, true, true, true, true, true, true}},
}
for _, c := range cases {
for i, v := range literalValues {
@@ -337,10 +338,10 @@ func TestValidateAfterResolution(t *testing.T) {
// An enum type may be the type of a map key
{NewResolvedEnumRef(true, false, nil), true},
{NewResolvedEnumRef(false, false, &stringLiteral), false},
- // Enums ma be assigned an integer literal
- {NewResolvedEnumRef(false, false, &intLiteral), true},
+ // Enums may not be assigned an integer literal
+ {NewResolvedEnumRef(false, false, &intLiteral), false},
{NewResolvedEnumRef(false, false, &floatLiteral), false},
- {NewResolvedEnumRef(false, false, &defaultLiteral), true},
+ {NewResolvedEnumRef(false, false, &defaultLiteral), false},
}
for i, c := range cases {
success := nil == c.typeRef.validateAfterResolution()
« no previous file with comments | « mojom/mojom_parser/mojom/types.go ('k') | mojom/mojom_parser/mojom/user_defined_types.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698