summaryrefslogtreecommitdiff
path: root/tests/dumptest.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2013-04-05 05:30:09 (GMT)
committerMarius Kintel <marius@kintel.net>2013-04-05 05:30:09 (GMT)
commit1b8b7aa5faa167af2687970f195e19439dab5a30 (patch)
tree5a01a4f97c91bbfeb8a975975da5c31232d7b921 /tests/dumptest.cc
parentc7f83aa3e35baf8a517c40a367ec247a7061b225 (diff)
I think this should fix issue #217
Diffstat (limited to 'tests/dumptest.cc')
-rw-r--r--tests/dumptest.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/dumptest.cc b/tests/dumptest.cc
index b75a2e2..3627608 100644
--- a/tests/dumptest.cc
+++ b/tests/dumptest.cc
@@ -118,7 +118,6 @@ int main(int argc, char **argv)
exit(1);
}
- fs::current_path(original_path);
std::ofstream outfile;
outfile.open(outfilename);
outfile << dumpstdstr << "\n";
@@ -127,21 +126,22 @@ int main(int argc, char **argv)
delete root_node;
delete root_module;
+ fs::current_path(original_path);
root_module = parsefile(outfilename);
if (!root_module) {
fprintf(stderr, "Error: Unable to read back dumped file\n");
exit(1);
}
- if (fs::path(filename).has_parent_path()) {
- fs::current_path(fs::path(filename).parent_path());
- }
-
AbstractNode::resetIndexCounter();
root_node = root_module->evaluate(&root_ctx, &root_inst);
tree.setRoot(root_node);
+ if (fs::path(outfilename).has_parent_path()) {
+ fs::current_path(fs::path(outfilename).parent_path());
+ }
+
string readbackstr = dumptree(tree, *root_node);
if (dumpstdstr != readbackstr) {
fprintf(stderr, "Error: Readback is different from original dump:\n");
contact: Jan Huwald // Impressum