diff options
Diffstat (limited to 'tests/dumptest.cc')
-rw-r--r-- | tests/dumptest.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/dumptest.cc b/tests/dumptest.cc index 4ddefe2..e0d2776 100644 --- a/tests/dumptest.cc +++ b/tests/dumptest.cc @@ -29,7 +29,7 @@ #include "parsersettings.h" #include "node.h" #include "module.h" -#include "context.h" +#include "modcontext.h" #include "value.h" #include "export.h" #include "builtin.h" @@ -86,11 +86,11 @@ int main(int argc, char **argv) parser_init(boosty::stringy(fs::path(argv[0]).branch_path())); add_librarydir(boosty::stringy(fs::path(argv[0]).branch_path() / "../libraries")); - Context root_ctx; - register_builtin(root_ctx); + ModuleContext root_ctx; + root_ctx.registerBuiltin(); AbstractModule *root_module; - ModuleInstantiation root_inst; + ModuleInstantiation root_inst("group"); AbstractNode *root_node; root_module = parsefile(filename); @@ -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"); |