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

Unified 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, 10 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
+ }
+}
« 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