18 #include <gtest/gtest.h> 53 void Create(
const string& path,
const string& contents);
62 virtual TimeStamp Stat(
const string& path)
const;
63 virtual bool WriteFile(
const string& path,
const string& contents);
64 virtual bool MakeDir(
const string& path);
65 virtual string ReadFile(
const string& path,
string* err);
66 virtual int RemoveFile(
const string& path);
87 void CreateAndEnter(
const string& name);
98 #endif // NINJA_TEST_H_ map< string, Entry > FileMap
An implementation of DiskInterface that uses an in-memory representation of disk state.
Node * GetNode(const string &path)
Short way to get a Node by its path from state_.
int Tick()
Tick "time" forwards; subsequent file operations will be newer than previous ones.
Information about a node in the dependency graph: the file, whether it's dirty, mtime, etc.
set< string > files_removed_
Interface for accessing the disk.
int now_
A simple fake timestamp for file operations.
StateTestWithBuiltinRules()
set< string > files_created_
vector< string > directories_made_
A base test fixture that includes a State object with a builtin "cat" rule.
void AssertHash(const char *expected, uint64_t actual)
void AddCatRule(State *state)
Add a "cat" rule to state.
string start_dir_
The temp directory containing our dir.
int ReadFile(const string &path, string *contents, string *err)
Read a file to a string (in text mode: with CRLF conversion on Windows).
An entry for a single in-memory file.
void AssertParse(State *state, const char *input)
Global state (file status, loaded rules) for a single run.
vector< string > files_read_
unsigned long long uint64_t
string temp_dir_name_
The subdirectory name for our dir, or empty if it hasn't been set up.