| 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);
|
| + }
|
| +}
|
|
|