Re: ending function in tests

"John W. Eaton" <[email protected]>
Newsgroups gmane.comp.gnu.octave.maintainers
Message-ID <[email protected]>
On 5/21/20 4:24 PM, Marco Atzeri wrote:
> Controlling the test results of odepkg
> 
> https://bitbucket.org/odepkg/odepkg/src/default/
> 
> with octave 5.2 on Cygwin I hit a strange error
> 
> ***** end
> !!!!! unknown test type!
> 
> the error is caused by ending functions with just "end"
> 
> %!function [ydot] = pendulum (vt, vy)
> %!  ydot = [0.5*vy(length(vy)/2+1:end); 
> -(2*5*9.806)*[zeros(length(vy)/4);ones(length(vy)/4)]];
> %!end
> 
> of course replacing
> 
>     %!end
> with
>     %!endfunction
> 
> works, but also declaring a normal function with "end" works
> 
> function [ydot] = pendulum (vt, vy)
>     ydot = [0.5*vy(length(vy)/2+1:end); 
> -(2*5*9.806)*[zeros(length(vy)/4);ones(length(vy)/4)]];
> end
> 
> as this maintain compatibility with Matlab.
> Is this by design or should I open a bug ?

I think it is by design, to simplify the code that breaks the test 
chunks into parts.  It's reasonable to expect "%!endfunction" to have 
only one purpose.  But %!end could be the end of any block.

jwe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.