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

Unified Diff: mojom/generators/go/templates/test_utils.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/templates.go ('k') | mojom/generators/go/templates/unions.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojom/generators/go/templates/test_utils.go
diff --git a/mojom/generators/go/templates/declarations_test.go b/mojom/generators/go/templates/test_utils.go
similarity index 72%
rename from mojom/generators/go/templates/declarations_test.go
rename to mojom/generators/go/templates/test_utils.go
index 5b4b3329a6096069dcb38968d0a8a7cfd9463828..e0d87d1ae7f935868238176d3ad5e701ace18f1f 100644
--- a/mojom/generators/go/templates/declarations_test.go
+++ b/mojom/generators/go/templates/test_utils.go
@@ -11,7 +11,6 @@ import (
"testing"
"mojom/generators/go/gofmt"
- "mojom/generators/go/translator"
)
func check(t *testing.T, expected string, template string, input interface{}) {
@@ -20,6 +19,11 @@ func check(t *testing.T, expected string, template string, input interface{}) {
panic(err)
}
+ expected, err := gofmt.FormatFragment(expected)
+ if err != nil {
+ panic(err)
+ }
+
src := buffer.String()
actual, err := gofmt.FormatFragment(src)
if err != nil {
@@ -34,20 +38,3 @@ func check(t *testing.T, expected string, template string, input interface{}) {
t.Fatalf(errorMsg)
}
}
-
-func TestStructDecl(t *testing.T) {
- expected := `type Foo struct {
- Alpha string
- Beta uint32
-}`
-
- s := translator.StructTemplate{
- Name: "Foo",
- Fields: []translator.StructFieldTemplate{
- {Name: "Alpha", Type: "string"},
- {Name: "Beta", Type: "uint32"},
- },
- }
-
- check(t, expected, "StructDecl", s)
-}
« no previous file with comments | « mojom/generators/go/templates/templates.go ('k') | mojom/generators/go/templates/unions.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698