diff --git a/src/codegen/codegen_cpp_visitor.cpp b/src/codegen/codegen_cpp_visitor.cpp index c65408fc0..03ac81884 100644 --- a/src/codegen/codegen_cpp_visitor.cpp +++ b/src/codegen/codegen_cpp_visitor.cpp @@ -974,6 +974,7 @@ void CodegenCppVisitor::visit_function_call(const FunctionCall& node) { void CodegenCppVisitor::visit_verbatim(const Verbatim& node) { const auto& text = node.get_statement()->eval(); + printer->add_line("// VERBATIM"); const auto& result = process_verbatim_text(text); const auto& statements = stringutils::split_string(result, '\n'); @@ -983,6 +984,7 @@ void CodegenCppVisitor::visit_verbatim(const Verbatim& node) { printer->add_line(trimed_stmt); } } + printer->add_line("// ENDVERBATIM"); } diff --git a/test/unit/codegen/codegen_coreneuron_cpp_visitor.cpp b/test/unit/codegen/codegen_coreneuron_cpp_visitor.cpp index f04911927..365ddf708 100644 --- a/test/unit/codegen/codegen_coreneuron_cpp_visitor.cpp +++ b/test/unit/codegen/codegen_coreneuron_cpp_visitor.cpp @@ -775,11 +775,14 @@ SCENARIO("Check that top verbatim blocks are well generated", "[codegen][top ver ENDVERBATIM )"; - THEN("Correct code is generated") { + THEN("A using namespace is generated") { auto const generated = get_coreneuron_cpp_code(nmodl_text); - std::string expected_code = R"(using namespace coreneuron; - - + std::string expected_code = "using namespace coreneuron;"; + REQUIRE_THAT(generated, ContainsSubstring(expected_code)); + } + THEN("Selected identifiers are expanded") { + auto const generated = get_coreneuron_cpp_code(nmodl_text); + std::string expected_code = R"( double a = 2.; foo_temp(nt); &tqitem;