[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #61511] test.m reports incorrect value of %!sh
From: |
John W. Eaton |
Subject: |
[Octave-bug-tracker] [bug #61511] test.m reports incorrect value of %!shared variables on test failure |
Date: |
Mon, 22 Nov 2021 13:28:53 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 |
Follow-up Comment #1, bug #61511 (project octave):
If I understand correctly, this happens because a function of the form
function __test__ (A, B)
## Test code here
endfunction
for the test code you show. Then this function is called inside a try/catch
block. If any errors happen, they are reported in the catch block. At that
point, any changes that are made inside the test code are lost because the
scope of those variables is local to the __test__ function.
I don't see a good way to fix this problem. Making the shared names global is
an obvious possibility but could just cause a lot of trouble if their names
conflict with other global variables.
It seems to me that the intent of the shared values was to allow constants to
be shared among multiple tests. So maybe we should just try to eliminate any
tests that modify shared values? Unfortunately, I don't see any way to check
that automatically or to prevent them from being modified as we don't have a
way to declare a constant value in Octave.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?61511>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/