From: Evan Martin Date: Tue, 4 Sep 2012 22:43:45 +0000 (-0400) Subject: clarify setter X-Git-Tag: v1.0.0^2~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c9f4a275a5794b60bdb2d8a4a4e9358b060d550c;p=platform%2Fupstream%2Fninja.git clarify setter --- 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);