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

Side by Side 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: ignore blockcomment in list eval Created 6 years, 2 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 2014 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 #include "base/files/file_util.h"
6 #include "base/strings/string_util.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "tools/gn/commands.h"
9
10 namespace commands {
11 bool FormatFileToString(const std::string& input_filename,
12 std::string* output,
13 bool dump_tree);
14 } // namespace commands
15
16 #define FORMAT_TEST(n) \
17 TEST(Format, n) { \
18 std::string out; \
19 std::string expected; \
20 EXPECT_TRUE(commands::FormatFileToString( \
21 "//tools/gn/format_test_data/" #n ".gn", &out, false)); \
22 ASSERT_TRUE(base::ReadFileToString( \
23 base::FilePath(FILE_PATH_LITERAL("tools/gn/format_test_data/") \
24 FILE_PATH_LITERAL(#n) \
25 FILE_PATH_LITERAL(".golden")), \
26 &expected)); \
27 EXPECT_EQ(out, expected); \
28 }
29
30 // These are expanded out this way rather than a runtime loop so that
31 // --gtest_filter works as expected for individual test running.
32 FORMAT_TEST(001)
33 FORMAT_TEST(002)
34 FORMAT_TEST(003)
35 FORMAT_TEST(004)
36 FORMAT_TEST(005)
37 FORMAT_TEST(006)
38 FORMAT_TEST(007)
39 FORMAT_TEST(008)
40 FORMAT_TEST(009)
41 FORMAT_TEST(010)
42 FORMAT_TEST(011)
43 FORMAT_TEST(012)
44 FORMAT_TEST(013)
45 FORMAT_TEST(014)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698