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

Side by Side Diff: mojom/mojom_parser/generators/common/util_test.go

Issue 1737143003: A mojom .d generator. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Update sha1. Created 4 years, 9 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 unified diff | Download patch
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « mojom/mojom_parser/generators/common/util.go ('k') | mojom/mojom_parser/generators/deps/deps_generator.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698