summaryrefslogtreecommitdiff
path: root/tests/dumptest.cc
diff options
context:
space:
mode:
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 4ddefe2..32c9842 100644
--- a/tests/dumptest.cc
+++ b/tests/dumptest.cc
@@ -115,7 +115,6 @@ int main(int argc, char **argv)
exit(1);
}
- fs::current_path(original_path);
std::ofstream outfile;
outfile.open(outfilename);
outfile << dumpstdstr << "\n";
@@ -124,21 +123,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