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

Unified Diff: mojom/mojom_parser/serialization/serialization_test.go

Issue 1825653002: Mojom frontend: Correctly handle empty structs in computeVersionInfo() (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase and regenerate sha1s. Created 4 years, 9 months 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/computed_data.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojom/mojom_parser/serialization/serialization_test.go
diff --git a/mojom/mojom_parser/serialization/serialization_test.go b/mojom/mojom_parser/serialization/serialization_test.go
index baf834c57399bd8eb6d3a3db5a7dd47f2a3affc9..56e42358956aaeb500ca2a8a9cfdc0a3eab550b7 100644
--- a/mojom/mojom_parser/serialization/serialization_test.go
+++ b/mojom/mojom_parser/serialization/serialization_test.go
@@ -1155,6 +1155,33 @@ func TestWithComputedData(t *testing.T) {
test := singleFileTest{}
////////////////////////////////////////////////////////////
+ // Test Case: Empty struct
+ ////////////////////////////////////////////////////////////
+ {
+ contents := `
+ struct Foo{
+ };`
+
+ test.addTestCase("", contents)
+
+ test.expectedFile().DeclaredMojomObjects.Structs = &[]string{"TYPE_KEY:Foo"}
+
+ test.expectedGraph().ResolvedTypes["TYPE_KEY:Foo"] = &mojom_types.UserDefinedTypeStructType{mojom_types.MojomStruct{
+ DeclData: test.newDeclData("Foo", "Foo"),
+ Fields: []mojom_types.StructField{},
+ VersionInfo: &[]mojom_types.StructVersion{
+ mojom_types.StructVersion{
+ VersionNumber: 0,
+ NumFields: 0,
+ NumBytes: 8,
+ },
+ },
+ }}
+
+ test.endTestCase()
+ }
+
+ ////////////////////////////////////////////////////////////
// Test Case: Test struct field min versions: 1,2
////////////////////////////////////////////////////////////
{
« no previous file with comments | « mojom/mojom_parser/mojom/computed_data.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698