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

Unified Diff: mojom/generators/go/templates/decoding_test.go

Issue 2045063002: [New go generator] Implement declaring unions. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 6 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/generators/go/templates/decoding.go ('k') | mojom/generators/go/templates/encoding.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojom/generators/go/templates/decoding_test.go
diff --git a/mojom/generators/go/templates/decoding_test.go b/mojom/generators/go/templates/decoding_test.go
index b530dad2b45fc7f8d29859525590a235eb9aa1e8..43a8b4060ee10c2ccd0129c7e66af5553d238ec3 100644
--- a/mojom/generators/go/templates/decoding_test.go
+++ b/mojom/generators/go/templates/decoding_test.go
@@ -8,33 +8,6 @@ import (
"testing"
)
-func TestDecodingStructVersions(t *testing.T) {
- expected := `var someStruct_Versions []bindings.DataHeader = []bindings.DataHeader{
- bindings.DataHeader{80, 0},
- bindings.DataHeader{100, 1},
- bindings.DataHeader{120, 2},
-}`
-
- type structVersion struct {
- NumBytes uint32
- Version uint32
- }
-
- s := struct {
- PrivateName string
- Versions []structVersion
- }{
- PrivateName: "someStruct",
- Versions: []structVersion{
- {80, 0},
- {100, 1},
- {120, 2},
- },
- }
-
- check(t, expected, "StructVersions", s)
-}
-
func TestDecodingSimpleFieldDecoding(t *testing.T) {
expected := `value, err := decoder.ReadUint8()
if err != nil {
@@ -43,9 +16,9 @@ if err != nil {
s.Fuint8 = value`
encodingInfo := mockEncodingInfo{
- IsSimple: true,
- Identifier: "s.Fuint8",
- ReadFunction: "ReadUint8",
+ isSimple: true,
+ identifier: "s.Fuint8",
+ readFunction: "ReadUint8",
}
check(t, expected, "FieldDecodingTmpl", encodingInfo)
@@ -63,9 +36,9 @@ if handle.IsValid() {
}`
encodingInfo := mockEncodingInfo{
- IsHandle: true,
- Identifier: "s.SomeHandle",
- ReadFunction: "ReadHandle",
+ isHandle: true,
+ identifier: "s.SomeHandle",
+ readFunction: "ReadHandle",
}
check(t, expected, "FieldDecodingTmpl", encodingInfo)
@@ -83,10 +56,10 @@ if handle.IsValid() {
}`
encodingInfo := mockEncodingInfo{
- IsHandle: true,
- Identifier: "s.SomeNullableHandle",
- ReadFunction: "ReadHandle",
- IsNullable: true,
+ isHandle: true,
+ identifier: "s.SomeNullableHandle",
+ readFunction: "ReadHandle",
+ isNullable: true,
}
check(t, expected, "FieldDecodingTmpl", encodingInfo)
@@ -108,10 +81,10 @@ if pointer == 0 {
}`
encodingInfo := mockEncodingInfo{
- IsSimple: true,
- Identifier: "s.FString",
- ReadFunction: "ReadString",
- IsPointer: true,
+ isSimple: true,
+ identifier: "s.FString",
+ readFunction: "ReadString",
+ isPointer: true,
}
check(t, expected, "FieldDecodingTmpl", encodingInfo)
@@ -133,11 +106,11 @@ if pointer == 0 {
}`
encodingInfo := mockEncodingInfo{
- IsSimple: true,
- Identifier: "s.FString",
- ReadFunction: "ReadString",
- IsPointer: true,
- IsNullable: true,
+ isSimple: true,
+ identifier: "s.FString",
+ readFunction: "ReadString",
+ isPointer: true,
+ isNullable: true,
}
check(t, expected, "FieldDecodingTmpl", encodingInfo)
@@ -157,9 +130,9 @@ if pointer == 0 {
}`
encodingInfo := mockEncodingInfo{
- IsPointer: true,
- IsStruct: true,
- Identifier: "s.FStruct",
+ isPointer: true,
+ isStruct: true,
+ identifier: "s.FStruct",
}
check(t, expected, "FieldDecodingTmpl", encodingInfo)
@@ -180,11 +153,11 @@ if pointer == 0 {
}`
encodingInfo := mockEncodingInfo{
- IsNullable: true,
- IsPointer: true,
- IsStruct: true,
- Identifier: "s.FStruct",
- GoType: "SomeStruct",
+ isNullable: true,
+ isPointer: true,
+ isStruct: true,
+ identifier: "s.FStruct",
+ goType: "SomeStruct",
}
check(t, expected, "FieldDecodingTmpl", encodingInfo)
« no previous file with comments | « mojom/generators/go/templates/decoding.go ('k') | mojom/generators/go/templates/encoding.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698