18 #include <gtest/gtest.h>
53 void Create(
const string& path,
const string& contents);
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);
98 #endif // NINJA_TEST_H_
map< string, Entry > FileMap
An implementation of DiskInterface that uses an in-memory representation of disk state.
virtual TimeStamp Stat(const string &path)
stat() a file, returning the mtime, or 0 if missing and -1 on other errors.
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_
virtual bool WriteFile(const string &path, const string &contents)
Create a file, with the specified name and contents Returns true on success, false on failure...
Interface for accessing the disk.
int now_
A simple fake timestamp for file operations.
StateTestWithBuiltinRules()
void Create(const string &path, const string &contents)
"Create" a file with contents.
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.
virtual bool MakeDir(const string &path)
Create a directory, returning false on failure.
void Cleanup()
Clean up the temporary directory.
An entry for a single in-memory file.
void CreateAndEnter(const string &name)
Create a temporary directory and chdir into it.
virtual string ReadFile(const string &path, string *err)
Read a file to a string. Fill in |err| on error.
void AssertParse(State *state, const char *input)
Global state (file status, loaded rules) for a single run.
vector< string > files_read_
virtual int RemoveFile(const string &path)
Remove the file named path.
unsigned long long uint64_t
string temp_dir_name_
The subdirectory name for our dir, or empty if it hasn't been set up.