| Index: mojom/mojom_parser/generators/common/util_test.go
|
| diff --git a/mojom/mojom_parser/generators/common/util_test.go b/mojom/mojom_parser/generators/common/util_test.go
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4adc9b2b29df2ca0e7bd890b437c9847ed8b9fe0
|
| --- /dev/null
|
| +++ b/mojom/mojom_parser/generators/common/util_test.go
|
| @@ -0,0 +1,44 @@
|
| +// 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 common
|
| +
|
| +import (
|
| + "testing"
|
| +)
|
| +
|
| +func testOutputFileByFilePath(t *testing.T) {
|
| + config := generatorCliConfig{
|
| + outputDir: "/some/output/path/",
|
| + srcRootPath: "/alpha/",
|
| + }
|
| + fileName := "/alpha/beta/gamma/file.d"
|
| +
|
| + expected := "/some/output/path/beta/gamma/file.d"
|
| +
|
| + actual := outputFileByFilePath(fileName, config)
|
| + if actual != expected {
|
| + t.Fatalf("Expected: %q\nActual: %q", expected, actual)
|
| + }
|
| +}
|
| +
|
| +func testChangeExt(t *testing.T) {
|
| + fileName := "/alpha/beta/gamma/file.mojom"
|
| + expected := "/alpha/beta/gamma/file.d"
|
| + actual := changeExt(fileName, ".d")
|
| +
|
| + if actual != expected {
|
| + t.Fatalf("Expected: %q\nActual: %q", expected, actual)
|
| + }
|
| +}
|
| +
|
| +func testChangeExtNoExt(t *testing.T) {
|
| + fileName := "/alpha/beta/gamma/file"
|
| + expected := "/alpha/beta/gamma/file.d"
|
| + actual := changeExt(fileName, ".d")
|
| +
|
| + if actual != expected {
|
| + t.Fatalf("Expected: %q\nActual: %q", expected, actual)
|
| + }
|
| +}
|
|
|