| Index: mojom/mojom_parser/parser/resolution_test.go
|
| diff --git a/mojom/mojom_parser/parser/resolution_test.go b/mojom/mojom_parser/parser/resolution_test.go
|
| index 57c0cb92e2e380f50e6326c5cebc6285c42d050a..1025231f632d1f7a4088ba91d9d68518bf98e877 100644
|
| --- a/mojom/mojom_parser/parser/resolution_test.go
|
| +++ b/mojom/mojom_parser/parser/resolution_test.go
|
| @@ -642,6 +642,10 @@ func TestSingleFileTypeValidationErrors(t *testing.T) {
|
| test := singleFileTest{}
|
|
|
| ////////////////////////////////////////////////////////////
|
| + // Group 1: Left-hand-side is a struct
|
| + ////////////////////////////////////////////////////////////
|
| +
|
| + ////////////////////////////////////////////////////////////
|
| // Test Case: Use struct as constant type
|
| ////////////////////////////////////////////////////////////
|
| {
|
| @@ -657,7 +661,7 @@ func TestSingleFileTypeValidationErrors(t *testing.T) {
|
| }
|
|
|
| ////////////////////////////////////////////////////////////
|
| - // Test Case: Assign struct as map key
|
| + // Test Case: Use struct as map key
|
| ////////////////////////////////////////////////////////////
|
| {
|
| contents := `
|
| @@ -691,6 +695,46 @@ func TestSingleFileTypeValidationErrors(t *testing.T) {
|
| }
|
|
|
| ////////////////////////////////////////////////////////////
|
| + // Group 2: Left-hand-side is an enum
|
| + ////////////////////////////////////////////////////////////
|
| +
|
| + ////////////////////////////////////////////////////////////
|
| + // Test Case: Assign an integer to an enum variable in a struct field.
|
| + ////////////////////////////////////////////////////////////
|
| + {
|
| + contents := `
|
| + enum Hats {
|
| + COWBOY,
|
| + TOP
|
| + };
|
| +
|
| + struct Bar{
|
| + Hats my_hat = 1;
|
| + };
|
| + `
|
| + test.addTestCase(contents, []string{
|
| + "Illegal assignment",
|
| + "Field my_hat of type Hats may not be assigned the value 1 of type int8."})
|
| + }
|
| +
|
| + ////////////////////////////////////////////////////////////
|
| + // Test Case: Assign an integer to an enum variable in a constant.
|
| + ////////////////////////////////////////////////////////////
|
| + {
|
| + contents := `
|
| + enum Hats {
|
| + COWBOY,
|
| + TOP
|
| + };
|
| +
|
| + const Hats MY_HAT = 1;
|
| + `
|
| + test.addTestCase(contents, []string{
|
| + "Illegal assignment",
|
| + "Const MY_HAT of type Hats may not be assigned the value 1 of type int8."})
|
| + }
|
| +
|
| + ////////////////////////////////////////////////////////////
|
| // Execute all of the test cases.
|
| ////////////////////////////////////////////////////////////
|
| for i, c := range test.cases {
|
|
|