diff options
author | Marius Kintel <marius@kintel.net> | 2013-05-09 10:18:51 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-05-09 10:18:51 (GMT) |
commit | f46118da22f806d05b410cced0f9b06ea00ac02c (patch) | |
tree | e42fece860be6d224744ba5401bf35e783dddd62 /tests/tests-common.cc | |
parent | f8ad66c8bbb3c78548c2e4b3b930f82d4a57b345 (diff) | |
parent | ad8ba77a15efd745fe7845e085b3daefd3f58e81 (diff) |
Merge branch 'master' into issue352
Diffstat (limited to 'tests/tests-common.cc')
-rw-r--r-- | tests/tests-common.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/tests-common.cc b/tests/tests-common.cc index ac85e37..3c66e1b 100644 --- a/tests/tests-common.cc +++ b/tests/tests-common.cc @@ -7,7 +7,12 @@ #include <sstream> #include <fstream> -FileModule *parsefile(const char *filename) +/*! + fakepath is used to force the parser to believe that the file is + read from this location, in order to ensure that filepaths are + eavluated relative to this path (for testing purposes). +*/ +FileModule *parsefile(const char *filename, const char *fakepath) { FileModule *root_module = NULL; @@ -19,7 +24,9 @@ FileModule *parsefile(const char *filename) else { std::string text((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>()); text += "\n" + commandline_commands; - std::string pathname = boosty::stringy(fs::path(filename).parent_path()); + std::string pathname; + if (fakepath) pathname = fakepath; + else pathname = boosty::stringy(fs::path(filename).parent_path()); root_module = parse(text.c_str(), pathname.c_str(), false); if (root_module) { root_module->handleDependencies(); |