| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package parser | 5 package parser |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "mojom/mojom_parser/mojom" | 8 "mojom/mojom_parser/mojom" |
| 9 "strings" | 9 "strings" |
| 10 "testing" | 10 "testing" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 int32 y; | 149 int32 y; |
| 150 | 150 |
| 151 [MinVersion = 1] | 151 [MinVersion = 1] |
| 152 array<int32> z; | 152 array<int32> z; |
| 153 | 153 |
| 154 [MinVersion = 2] | 154 [MinVersion = 2] |
| 155 array<int32>? w; | 155 array<int32>? w; |
| 156 };` | 156 };` |
| 157 test.addTestCase(contents, []string{ | 157 test.addTestCase(contents, []string{ |
| 158 "Invalid type for field z: array<int32>.", | 158 "Invalid type for field z: array<int32>.", |
| 159 » » » "Non-nullable fields are only allowed in version 0 of of
a struct.", | 159 » » » "Non-nullable reference fields are only allowed in versi
on 0 of of a struct.", |
| 160 "This field's MinVersion is 1."}) | 160 "This field's MinVersion is 1."}) |
| 161 } | 161 } |
| 162 | 162 |
| 163 //////////////////////////////////////////////////////////// | 163 //////////////////////////////////////////////////////////// |
| 164 // Execute all of the test cases. | 164 // Execute all of the test cases. |
| 165 //////////////////////////////////////////////////////////// | 165 //////////////////////////////////////////////////////////// |
| 166 for i, c := range test.cases { | 166 for i, c := range test.cases { |
| 167 // Parse anresolve the mojom input. | 167 // Parse anresolve the mojom input. |
| 168 descriptor := mojom.NewMojomDescriptor() | 168 descriptor := mojom.NewMojomDescriptor() |
| 169 specifiedName := "" | 169 specifiedName := "" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 191 | 191 |
| 192 got := err.Error() | 192 got := err.Error() |
| 193 for _, expected := range c.expectedErrors { | 193 for _, expected := range c.expectedErrors { |
| 194 if !strings.Contains(got, expected) { | 194 if !strings.Contains(got, expected) { |
| 195 t.Errorf("%s:\n*****expected to contain:\n%s\n**
**actual\n%s", c.fileName, expected, got) | 195 t.Errorf("%s:\n*****expected to contain:\n%s\n**
**actual\n%s", c.fileName, expected, got) |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 } | 199 } |
| 200 } | 200 } |
| OLD | NEW |