Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit c9f4a27

Browse files
committed
clarify setter
1 parent 1e11c8a commit c9f4a27

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/graph.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,14 @@ struct Rule {
112112
bool restat() const { return restat_; }
113113

114114
const EvalString& command() const { return command_; }
115-
EvalString& command() { return command_; }
116115
const EvalString& description() const { return description_; }
117116
const EvalString& depfile() const { return depfile_; }
118117
const EvalString& rspfile() const { return rspfile_; }
119118
const EvalString& rspfile_content() const { return rspfile_content_; }
120119

120+
/// Used by a test.
121+
void set_command(const EvalString& command) { command_ = command; }
122+
121123
private:
122124
// Allow the parsers to reach into this object and fill out its fields.
123125
friend struct ManifestParser;

src/state_test.cc

+7-4
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ namespace {
2222
TEST(State, Basic) {
2323
State state;
2424

25+
EvalString command;
26+
command.AddText("cat ");
27+
command.AddSpecial("in");
28+
command.AddText(" > ");
29+
command.AddSpecial("out");
30+
2531
Rule* rule = new Rule("cat");
26-
rule->command().AddText("cat ");
27-
rule->command().AddSpecial("in");
28-
rule->command().AddText(" > ");
29-
rule->command().AddSpecial("out");
32+
rule->set_command(command);
3033
state.AddRule(rule);
3134

3235
Edge* edge = state.AddEdge(rule);

0 commit comments

Comments
 (0)