OLD | NEW |
(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, std::string* output); |
| 12 } // namespace commands |
| 13 |
| 14 TEST(Format, AllTests) { |
| 15 std::string out; |
| 16 std::string expected; |
| 17 for (int i = 1; i <= 3; ++i) { |
| 18 char buf[256]; |
| 19 base::snprintf(buf, sizeof(buf), "//tools/gn/format_test_data/%03d.gn", i); |
| 20 EXPECT_TRUE(commands::FormatFileToString(buf, &out)); |
| 21 base::FilePath golden; |
| 22 base::snprintf( |
| 23 buf, sizeof(buf), "tools/gn/format_test_data/%03d.golden", i); |
| 24 golden = golden.AppendASCII(buf); |
| 25 ASSERT_TRUE(base::ReadFileToString(golden, &expected)); |
| 26 EXPECT_EQ(out, expected); |
| 27 } |
| 28 } |
OLD | NEW |