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

Unified Diff: tools/gn/command_format_unittest.cc

Issue 588813002: gn: beginnings of format command (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: handle line comments at eof Created 6 years, 3 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 | « tools/gn/command_format.cc ('k') | tools/gn/commands.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/command_format_unittest.cc
diff --git a/tools/gn/command_format_unittest.cc b/tools/gn/command_format_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..454400e2d32cc518da94dfb00a2483e0431581f6
--- /dev/null
+++ b/tools/gn/command_format_unittest.cc
@@ -0,0 +1,28 @@
+// Copyright 2014 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.
+
+#include "base/files/file_util.h"
+#include "base/strings/string_util.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "tools/gn/commands.h"
+
+namespace commands {
+bool FormatFileToString(const std::string& input_filename, std::string* output);
+} // namespace commands
+
+TEST(Format, AllTests) {
+ std::string out;
+ std::string expected;
+ for (int i = 1; i <= 3; ++i) {
+ char buf[256];
+ base::snprintf(buf, sizeof(buf), "//tools/gn/format_test_data/%03d.gn", i);
+ EXPECT_TRUE(commands::FormatFileToString(buf, &out));
+ base::FilePath golden;
+ base::snprintf(
+ buf, sizeof(buf), "tools/gn/format_test_data/%03d.golden", i);
+ golden = golden.AppendASCII(buf);
+ ASSERT_TRUE(base::ReadFileToString(golden, &expected));
+ EXPECT_EQ(out, expected);
+ }
+}
« no previous file with comments | « tools/gn/command_format.cc ('k') | tools/gn/commands.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698