
Does PureUnit work with modules?
Does PureUnit work with modules?
I always get an error "Can't define a procedure inside another procedure" when I want to test a procedure from a module. 

"I have never let my schooling interfere with my education." - Mark Twain
Re: Does PureUnit work with modules?
I must say I did not test this yet, but it should work as long as you keep the test procedures outside of the module (in the main scope). The test procedure should be able to call module code without problems.
Do you have some example code to show your problem?
Do you have some example code to show your problem?
quidquid Latine dictum sit altum videtur
-
- Addict
- Posts: 4789
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Does PureUnit work with modules?
I have written several programs for testing modules with PureUnit in this way, and they all work fine.freak wrote:I must say I did not test this yet, but it should work as long as you keep the test procedures outside of the module (in the main scope).
Re: Does PureUnit work with modules?
Yes, indeed it works! Sorry, my mistake. Freak pointed me in the right direction.
Instead of this:
I wrote that somewhere in a larger test suite:
which explains the error message. The include has to be outside the test procedure.
Instead of this:
Code: Select all
XIncludeFile "module_unittest1.pb"
ProcedureUnitStartup start_test()
Code: Select all
ProcedureUnitStartup start_test()
XIncludeFile "module_unittest1.pb"
"I have never let my schooling interfere with my education." - Mark Twain
-
- Addict
- Posts: 4789
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Does PureUnit work with modules?
Yes.Erich wrote:The include has to be outside the test procedure.
Including one or more procedures in another procedure will never work with PB,
regardless of whether the included procedures are inside a module or not.