OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package common |
| 6 |
| 7 import ( |
| 8 "testing" |
| 9 ) |
| 10 |
| 11 func testOutputFileByFilePath(t *testing.T) { |
| 12 config := generatorCliConfig{ |
| 13 outputDir: "/some/output/path/", |
| 14 srcRootPath: "/alpha/", |
| 15 } |
| 16 fileName := "/alpha/beta/gamma/file.d" |
| 17 |
| 18 expected := "/some/output/path/beta/gamma/file.d" |
| 19 |
| 20 actual := outputFileByFilePath(fileName, config) |
| 21 if actual != expected { |
| 22 t.Fatalf("Expected: %q\nActual: %q", expected, actual) |
| 23 } |
| 24 } |
| 25 |
| 26 func testChangeExt(t *testing.T) { |
| 27 fileName := "/alpha/beta/gamma/file.mojom" |
| 28 expected := "/alpha/beta/gamma/file.d" |
| 29 actual := changeExt(fileName, ".d") |
| 30 |
| 31 if actual != expected { |
| 32 t.Fatalf("Expected: %q\nActual: %q", expected, actual) |
| 33 } |
| 34 } |
| 35 |
| 36 func testChangeExtNoExt(t *testing.T) { |
| 37 fileName := "/alpha/beta/gamma/file" |
| 38 expected := "/alpha/beta/gamma/file.d" |
| 39 actual := changeExt(fileName, ".d") |
| 40 |
| 41 if actual != expected { |
| 42 t.Fatalf("Expected: %q\nActual: %q", expected, actual) |
| 43 } |
| 44 } |
OLD | NEW |