[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #51997] Missing documentation of return value
From: |
Markus Mützel |
Subject: |
[Octave-bug-tracker] [bug #51997] Missing documentation of return value of warning() |
Date: |
Wed, 13 Sep 2017 12:15:58 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0 |
Follow-up Comment #3, bug #51997 (project octave):
Below the results in Matlab R2016a:
>> % Does ML report the special 'all' identifier in warnstruct
s = warning ();
any (strcmp ({s.identifier}, 'all')) %true in Octave
ans =
1
>> % Does ML return a warnstruct when setting the state all warnings
% and if so is it the previous state
try
s2 = warning ('off');
if (~ isequal (s, s2))
disp ('Warnstruct returned when setting all different from previous all')
disp (s2)
else %Octave has this behavior
disp ('Warnstruct returned when setting all')
end
warning (s)
catch
error ('No warnstruct returned when setting all and equal to previous all')
warning (s)
end
Warnstruct returned when setting all
>> % Does ML return a warnstruct when setting the state of a given
% warning and if so is it all warnings or only the one related to id
try
loglog (-1:10) % I expect some warning here
[~, id] = lastwarn ();
s2 = warning ('off', id);
if (~ isequal (s, s2))
disp ('Warnstruct returned when setting id different from previous all')
disp (s2)
else %Octave has this behavior
disp ('Warnstruct returned when setting id and equal to previous all')
end
warning (s)
catch
error ('No warnstruct returned when setting id')
warning (s)
end
Warnstruct returned when setting id different from previous all
identifier: 'MATLAB:Axes:NegativeDataInLogAxis'
state: 'on'
Warning: Negative data ignored
"loglog (0:10)" does not issue a warning in Matlab, "loglog (-1:10)" does.
Thus, I used that in the test.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?51997>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/