summaryrefslogtreecommitdiffstats
path: root/ninja_test.cc
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2010-10-24 19:48:09 (GMT)
committerEvan Martin <martine@danga.com>2010-10-24 19:48:09 (GMT)
commit25b24710d2af7cc01020eb688e45c57cd9f1927b (patch)
treee5c926d6bbc1d2be7888292a9715496cb448278b /ninja_test.cc
parentbf702219fb035aa1a79b7a2a94669a6eebe8291d (diff)
downloadNinja-25b24710d2af7cc01020eb688e45c57cd9f1927b.zip
Ninja-25b24710d2af7cc01020eb688e45c57cd9f1927b.tar.gz
Ninja-25b24710d2af7cc01020eb688e45c57cd9f1927b.tar.bz2
refactor rule creation
Diffstat (limited to 'ninja_test.cc')
-rw-r--r--ninja_test.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/ninja_test.cc b/ninja_test.cc
index 32afaa0..0270f96 100644
--- a/ninja_test.cc
+++ b/ninja_test.cc
@@ -75,8 +75,6 @@ TEST(Parser, Comment) {
}
TEST(Parser, Errors) {
- State state;
-
{
ManifestParser parser(NULL);
string err;
@@ -99,6 +97,7 @@ TEST(Parser, Errors) {
}
{
+ State state;
ManifestParser parser(&state);
string err;
EXPECT_FALSE(parser.Parse("x = 3\ny 2", &err));
@@ -106,6 +105,7 @@ TEST(Parser, Errors) {
}
{
+ State state;
ManifestParser parser(&state);
string err;
EXPECT_FALSE(parser.Parse("build x: y z\n", &err));
@@ -113,6 +113,7 @@ TEST(Parser, Errors) {
}
{
+ State state;
ManifestParser parser(&state);
string err;
EXPECT_FALSE(parser.Parse("build x:: y z\n", &err));
@@ -120,6 +121,7 @@ TEST(Parser, Errors) {
}
{
+ State state;
ManifestParser parser(&state);
string err;
EXPECT_FALSE(parser.Parse("rule cat\n command = cat ok\n"
@@ -129,6 +131,7 @@ TEST(Parser, Errors) {
}
{
+ State state;
ManifestParser parser(&state);
string err;
EXPECT_FALSE(parser.Parse("rule cat\n"
@@ -138,6 +141,7 @@ TEST(Parser, Errors) {
}
{
+ State state;
ManifestParser parser(&state);
string err;
EXPECT_FALSE(parser.Parse("rule %foo\n",
@@ -161,7 +165,9 @@ TEST(Parser, BuildDir) {
TEST(State, Basic) {
State state;
- Rule* rule = state.AddRule("cat", "cat @in > $out");
+ Rule* rule = new Rule("cat");
+ rule->ParseCommand("cat @in > $out");
+ state.AddRule(rule);
Edge* edge = state.AddEdge(rule);
state.AddInOut(edge, Edge::IN, "in1");
state.AddInOut(edge, Edge::IN, "in2");