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

Unified Diff: tools/gn/command_format_unittest.cc

Issue 591373002: gn: start of format command (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-more-comment-stuff
Patch Set: change 'copyright header block' to 'standard header block' for android_webview/tools/check_licenses… 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..f7fa0013808c53c02fac5cf45afb59d0964536fb
--- /dev/null
+++ b/tools/gn/command_format_unittest.cc
@@ -0,0 +1,45 @@
+// 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,
+ bool dump_tree,
+ std::string* output);
+} // namespace commands
+
+#define FORMAT_TEST(n) \
+ TEST(Format, n) { \
+ std::string out; \
+ std::string expected; \
+ EXPECT_TRUE(commands::FormatFileToString( \
+ "//tools/gn/format_test_data/" #n ".gn", false, &out)); \
+ ASSERT_TRUE(base::ReadFileToString( \
+ base::FilePath(FILE_PATH_LITERAL("tools/gn/format_test_data/") \
+ FILE_PATH_LITERAL(#n) \
+ FILE_PATH_LITERAL(".golden")), \
+ &expected)); \
+ EXPECT_EQ(out, expected); \
+ }
+
+// These are expanded out this way rather than a runtime loop so that
+// --gtest_filter works as expected for individual test running.
+FORMAT_TEST(001)
+FORMAT_TEST(002)
+FORMAT_TEST(003)
+FORMAT_TEST(004)
+FORMAT_TEST(005)
+FORMAT_TEST(006)
+FORMAT_TEST(007)
+FORMAT_TEST(008)
+FORMAT_TEST(009)
+FORMAT_TEST(010)
+FORMAT_TEST(011)
+FORMAT_TEST(012)
+FORMAT_TEST(013)
+FORMAT_TEST(014)
« 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