[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #56419] Implementation of newline

From: Rik
Subject: [Octave-bug-tracker] [bug #56419] Implementation of newline
Date: Tue, 4 Jun 2019 16:36:34 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Follow-up Comment #8, bug #56419 (project octave):

For %!assert statements the convention is to remove the semicolon because it
is unnecessary.  For %!warning and %!error it is occasionally necessary to
have a semicolon in order to suppress output.

There are some good examples directly from the newline implementation.

For example, at the command line

[a, b] = newline ()
a = 

error: element number 2 undefined in return list

Now make this a BIST test in a file tst_err.m

%!error [a, b] = newline ()

When running the tests I get extraneous output

test tst_err.m
a = 

PASSES 1 out of 1 test

Now, add the semicolon

%!error [a, b] = newline ();

and re-run

test tst_err.m
PASSES 1 out of 1 test

It isn't always necessary though.  The newline function, for example, throws
an error immediately if there are any arguments to the function.  This happens
before any return value is assigned.  So for the BIST test below, no semicolon
is required

%!error [a,b] = newline (1)

test tst_err.m
PASSES 1 out of 1 test

At the end of the day, I try not to use semicolons, but occasionally am forced
in to it by circumstances.


Reply to this item at:


  Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]