From c9f4a275a5794b60bdb2d8a4a4e9358b060d550c Mon Sep 17 00:00:00 2001 From: Evan Martin Date: Tue, 4 Sep 2012 18:43:45 -0400 Subject: clarify setter --- src/graph.h | 4 +++- src/state_test.cc | 11 +++++++---- 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); -- cgit v0.12