OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/files/file_util.h" | 5 #include "base/files/file_util.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "tools/gn/command_format.h" |
9 #include "tools/gn/commands.h" | 10 #include "tools/gn/commands.h" |
10 #include "tools/gn/setup.h" | 11 #include "tools/gn/setup.h" |
11 | 12 |
12 namespace commands { | |
13 bool FormatFileToString(Setup* setup, | |
14 const SourceFile& file, | |
15 bool dump_tree, | |
16 std::string* output); | |
17 } // namespace commands | |
18 | |
19 #define FORMAT_TEST(n) \ | 13 #define FORMAT_TEST(n) \ |
20 TEST(Format, n) { \ | 14 TEST(Format, n) { \ |
21 ::Setup setup; \ | 15 ::Setup setup; \ |
22 std::string out; \ | 16 std::string out; \ |
23 std::string expected; \ | 17 std::string expected; \ |
24 base::FilePath src_dir; \ | 18 base::FilePath src_dir; \ |
25 PathService::Get(base::DIR_SOURCE_ROOT, &src_dir); \ | 19 PathService::Get(base::DIR_SOURCE_ROOT, &src_dir); \ |
26 base::SetCurrentDirectory(src_dir); \ | 20 base::SetCurrentDirectory(src_dir); \ |
27 EXPECT_TRUE(commands::FormatFileToString( \ | 21 EXPECT_TRUE(commands::FormatFileToString( \ |
28 &setup, SourceFile("//tools/gn/format_test_data/" #n ".gn"), false, \ | 22 &setup, SourceFile("//tools/gn/format_test_data/" #n ".gn"), false, \ |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 FORMAT_TEST(058) | 92 FORMAT_TEST(058) |
99 FORMAT_TEST(059) | 93 FORMAT_TEST(059) |
100 FORMAT_TEST(060) | 94 FORMAT_TEST(060) |
101 FORMAT_TEST(061) | 95 FORMAT_TEST(061) |
102 FORMAT_TEST(062) | 96 FORMAT_TEST(062) |
103 FORMAT_TEST(063) | 97 FORMAT_TEST(063) |
104 FORMAT_TEST(064) | 98 FORMAT_TEST(064) |
105 FORMAT_TEST(065) | 99 FORMAT_TEST(065) |
106 FORMAT_TEST(066) | 100 FORMAT_TEST(066) |
107 FORMAT_TEST(067) | 101 FORMAT_TEST(067) |
OLD | NEW |