| Index: mojom/generators/go/templates/declarations_test.go
|
| diff --git a/mojom/generators/go/templates/declarations_test.go b/mojom/generators/go/templates/declarations_test.go
|
| deleted file mode 100644
|
| index 5b4b3329a6096069dcb38968d0a8a7cfd9463828..0000000000000000000000000000000000000000
|
| --- a/mojom/generators/go/templates/declarations_test.go
|
| +++ /dev/null
|
| @@ -1,53 +0,0 @@
|
| -// Copyright 2016 The Chromium Authors. All rights reserved.
|
| -// Use of this source code is governed by a BSD-style license that can be
|
| -// found in the LICENSE file.
|
| -
|
| -package templates
|
| -
|
| -import (
|
| - "bytes"
|
| - "fmt"
|
| - "strings"
|
| - "testing"
|
| -
|
| - "mojom/generators/go/gofmt"
|
| - "mojom/generators/go/translator"
|
| -)
|
| -
|
| -func check(t *testing.T, expected string, template string, input interface{}) {
|
| - buffer := &bytes.Buffer{}
|
| - if err := goFileTmpl.ExecuteTemplate(buffer, template, input); err != nil {
|
| - panic(err)
|
| - }
|
| -
|
| - src := buffer.String()
|
| - actual, err := gofmt.FormatFragment(src)
|
| - if err != nil {
|
| - t.Fatalf("Formatting failed: %s\n%s\n", err, src)
|
| - }
|
| -
|
| - if expected != actual {
|
| - errorMsg := fmt.Sprintf("Failed check: Expected\n%s\nActual\n%s\n", expected, actual)
|
| - if strings.TrimSpace(expected) == strings.TrimSpace(actual) {
|
| - errorMsg = fmt.Sprintf("%s\nTrailing or leading spaces differ.\n", errorMsg)
|
| - }
|
| - 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)
|
| -}
|
|
|