Ninja
Main Page
Namespaces
Classes
Files
File List
File Members
state_test.cc
Go to the documentation of this file.
1
// Copyright 2011 Google Inc. All Rights Reserved.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#include <gtest/gtest.h>
16
17
#include "
graph.h
"
18
#include "
state.h
"
19
20
namespace
{
21
22
TEST
(
State
, Basic) {
23
State
state;
24
25
EvalString
command;
26
command.
AddText
(
"cat "
);
27
command.
AddSpecial
(
"in"
);
28
command.
AddText
(
" > "
);
29
command.
AddSpecial
(
"out"
);
30
31
Rule
* rule =
new
Rule
(
"cat"
);
32
rule->
AddBinding
(
"command"
, command);
33
state.
AddRule
(rule);
34
35
Edge
* edge = state.
AddEdge
(rule);
36
state.
AddIn
(edge,
"in1"
);
37
state.
AddIn
(edge,
"in2"
);
38
state.
AddOut
(edge,
"out"
);
39
40
EXPECT_EQ(
"cat in1 in2 > out"
, edge->
EvaluateCommand
());
41
42
EXPECT_FALSE(state.
GetNode
(
"in1"
)->
dirty
());
43
EXPECT_FALSE(state.
GetNode
(
"in2"
)->
dirty
());
44
EXPECT_FALSE(state.
GetNode
(
"out"
)->
dirty
());
45
}
46
47
}
// namespace
Generated on Thu Jul 18 2013 08:11:45 for Ninja by
1.8.4