| // 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. |
| func testOutputFileByFilePath(t *testing.T) { |
| config := generatorCliConfig{ |
| outputDir: "/some/output/path/", |
| fileName := "/alpha/beta/gamma/file.d" |
| expected := "/some/output/path/beta/gamma/file.d" |
| actual := outputFileByFilePath(fileName, config) |
| 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") |
| 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") |
| t.Fatalf("Expected: %q\nActual: %q", expected, actual) |