clarify setter
authorEvan Martin <martine@danga.com>
Tue, 4 Sep 2012 22:43:45 +0000 (18:43 -0400)
committerEvan Martin <martine@danga.com>
Tue, 4 Sep 2012 22:43:45 +0000 (18:43 -0400)
src/graph.h
src/state_test.cc

index 893ec09..0e203b4 100644 (file)
@@ -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;
index 354468b..bc24edd 100644 (file)
@@ -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);