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.
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 #include "tools/gn/setup.h"
12 bool FormatFileToString(Setup
* setup
,
13 const SourceFile
& file
,
16 } // namespace commands
18 #define FORMAT_TEST(n) \
22 std::string expected; \
23 EXPECT_TRUE(commands::FormatFileToString( \
25 SourceFile("//tools/gn/format_test_data/" #n ".gn"), \
28 ASSERT_TRUE(base::ReadFileToString( \
29 base::FilePath(FILE_PATH_LITERAL("tools/gn/format_test_data/") \
30 FILE_PATH_LITERAL(#n) \
31 FILE_PATH_LITERAL(".golden")), \
33 EXPECT_EQ(expected, out); \
36 // These are expanded out this way rather than a runtime loop so that
37 // --gtest_filter works as expected for individual test running.
71 // TODO(scottmg): args+rebase_path unnecessarily split: FORMAT_TEST(034)
77 // TODO(scottmg): Bad break, exceeding 80 col: FORMAT_TEST(040)
81 // TODO(scottmg): Dewrapped caused exceeding 80 col: FORMAT_TEST(044)
86 // TODO(scottmg): Eval is broken (!) and comment output might have extra ,