From 3f272a5b7dec8fa2405311a5de913f506a4b0f8f Mon Sep 17 00:00:00 2001 From: Luc Grosheintz Date: Thu, 31 Oct 2024 15:08:55 +0100 Subject: [PATCH] Check top-level VERBATIM in `SUFFIX nothing`. --- src/codegen/codegen_neuron_cpp_visitor.cpp | 1 + test/usecases/verbatim/nothing.mod | 11 +++++++++++ test/usecases/verbatim/test_nothing.py | 9 +++++++++ 3 files changed, 21 insertions(+) create mode 100644 test/usecases/verbatim/nothing.mod create mode 100644 test/usecases/verbatim/test_nothing.py diff --git a/src/codegen/codegen_neuron_cpp_visitor.cpp b/src/codegen/codegen_neuron_cpp_visitor.cpp index a6fcce801..49f345367 100644 --- a/src/codegen/codegen_neuron_cpp_visitor.cpp +++ b/src/codegen/codegen_neuron_cpp_visitor.cpp @@ -2677,6 +2677,7 @@ void CodegenNeuronCppVisitor::print_codegen_routines_nothing() { print_headers_include(); print_namespace_start(); print_function_prototypes(); + print_top_verbatim_blocks(); print_global_variables_for_hoc(); print_function_definitions(); print_mechanism_register(); diff --git a/test/usecases/verbatim/nothing.mod b/test/usecases/verbatim/nothing.mod new file mode 100644 index 000000000..e100e9ddb --- /dev/null +++ b/test/usecases/verbatim/nothing.mod @@ -0,0 +1,11 @@ +NEURON { SUFFIX nothing } + +VERBATIM +double foo = 42.0; +ENDVERBATIM + +FUNCTION get_foo() { +VERBATIM + return foo; +ENDVERBATIM +} diff --git a/test/usecases/verbatim/test_nothing.py b/test/usecases/verbatim/test_nothing.py new file mode 100644 index 000000000..207d38cbd --- /dev/null +++ b/test/usecases/verbatim/test_nothing.py @@ -0,0 +1,9 @@ +from neuron import h, gui + + +def test_nothing(): + assert h.get_foo() == 42.0 + + +if __name__ == "__main__": + test_nothing()