summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/graph.h4
-rw-r--r--src/state_test.cc11
2 files changed, 10 insertions, 5 deletions
diff --git a/src/graph.h b/src/graph.h
index 893ec09..0e203b4 100644
--- a/src/graph.h
+++ b/src/graph.h
@@ -112,12 +112,14 @@ struct Rule {
bool restat() const { return restat_; }
const EvalString& command() const { return command_; }
- EvalString& command() { return command_; }
const EvalString& description() const { return description_; }
const EvalString& depfile() const { return depfile_; }
const EvalString& rspfile() const { return rspfile_; }
const EvalString& rspfile_content() const { return rspfile_content_; }
+ /// Used by a test.
+ void set_command(const EvalString& command) { command_ = command; }
+
private:
// Allow the parsers to reach into this object and fill out its fields.
friend struct ManifestParser;
diff --git a/src/state_test.cc b/src/state_test.cc
index 354468b..bc24edd 100644
--- a/src/state_test.cc
+++ b/src/state_test.cc
@@ -22,11 +22,14 @@ namespace {
TEST(State, Basic) {
State state;
+ EvalString command;
+ command.AddText("cat ");
+ command.AddSpecial("in");
+ command.AddText(" > ");
+ command.AddSpecial("out");
+
Rule* rule = new Rule("cat");
- rule->command().AddText("cat ");
- rule->command().AddSpecial("in");
- rule->command().AddText(" > ");
- rule->command().AddSpecial("out");
+ rule->set_command(command);
state.AddRule(rule);
Edge* edge = state.AddEdge(rule);