17 #include <gtest/gtest.h> 20 bool Parse(
const char* input,
string* err);
34 "build/ninja.o: ninja.cc ninja.h eval_env.h manifest_parser.h\n",
75 "Project\\Dir\\Build\\Release8\\Foo\\Foo.res : \\\n" 76 " Dir\\Library\\Foo.rc \\\n" 77 " Dir\\Library\\Version\\Bar.h \\\n" 78 " Dir\\Library\\Foo.ico \\\n" 79 " Project\\Thing\\Bar.tlb \\\n",
82 EXPECT_EQ(
"Project\\Dir\\Build\\Release8\\Foo\\Foo.res",
90 "a\\ bc\\ def: a\\ b c d",
109 "\\!\\@\\#$$\\%\\^\\&\\\\",
112 EXPECT_EQ(
"\\!\\@#$\\%\\^\\&\\",
122 "C:/Program\\ Files\\ (x86)/Microsoft\\ crtdefs.h: \n" 123 " en@quot.header~ t+t-x!=1 \n" 124 " openldap/slapd.d/cn=config/cn=schema/cn={0}core.ldif",
127 EXPECT_EQ(
"C:/Program Files (x86)/Microsoft crtdefs.h",
130 EXPECT_EQ(
"en@quot.header~",
132 EXPECT_EQ(
"t+t-x!=1",
134 EXPECT_EQ(
"openldap/slapd.d/cn=config/cn=schema/cn={0}core.ldif",
141 EXPECT_TRUE(
Parse(
"foo foo: x y z", &err));
152 EXPECT_FALSE(
Parse(
"foo bar: x y z", &err));
153 ASSERT_EQ(
"depfile has multiple output paths", err);
Parser for the dependency information emitted by gcc's -M flags.
bool Parse(string *content, string *err)
Parse an input file.
bool Parse(const char *input, string *err)
string AsString() const
Convert the slice into a full-fledged std::string, copying the data into a new string.
TEST_F(DepfileParserTest, Basic)
vector< StringPiece > ins_