Mercurial > octave
changeset 32421:bac9c48047cd
Silence output to stdout in test suite (bug #64786)
* test/compile/bytecode_anon_handles.m: Add ';'
* test/compile/bytecode_leaks.m: Wrap test in evalc
author | Petter T. <petter.vilhelm@gmail.com> |
---|---|
date | Wed, 18 Oct 2023 00:02:56 +0200 |
parents | cdea5878d55a |
children | 251a5be9a564 |
files | test/compile/bytecode_anon_handles.m test/compile/bytecode_leaks.m |
diffstat | 2 files changed, 21 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/test/compile/bytecode_anon_handles.m Tue Oct 17 13:23:19 2023 +0200 +++ b/test/compile/bytecode_anon_handles.m Wed Oct 18 00:02:56 2023 +0200 @@ -96,9 +96,9 @@ % The optim package exposed a bug with EXPAND_CS_LIST during development h1 = @ (p) - (p(1)^2 + 1 - p(2)); h2 = @ (p) {[], h1(p)}{:}; - [~, a] = h2 ([-2 5]) + [~, a] = h2 ([-2 5]); assert (a == 0) - [~, a] = h2 ([-2 5]) + [~, a] = h2 ([-2 5]); assert (a == 0) % Nested anon functions
--- a/test/compile/bytecode_leaks.m Tue Oct 17 13:23:19 2023 +0200 +++ b/test/compile/bytecode_leaks.m Wed Oct 18 00:02:56 2023 +0200 @@ -62,15 +62,10 @@ m = 0; assert (refs_e, __ref_count__ (e)) - % "command call" with disp - disp ("The disp of e and pi underneath is on purpose. There should be a 'e = 2' and 'ans = 3.14...'") - e % Should print "e = 2" - assert (refs_e + 1, __ref_count__ (e)) % in ans - ans = 0; - assert (refs_e, __ref_count__ (e)) - - % This will be a function call and should print "ans = 3.14..." - pi + % "command call" with disp. Do it in an evalc () to not clutter stdout + s_ans = evalc ("silent_disp_test ()"); + assert (strfind (s_ans, "e = 2")) + assert (strfind (s_ans, "ans = 3.14")) % no disp e; @@ -111,6 +106,21 @@ assert (refs_e, __ref_count__ (e)) end +function silent_disp_test () + assert (__vm_is_executing__); + + e = 2; + refs_e = __ref_count__ (e); + + e % Should print "e = 2" + assert (refs_e + 1, __ref_count__ (e)) % in ans + ans = 0; + assert (refs_e, __ref_count__ (e)) + + % This will be a function call and should print "ans = 3.14..." + pi +end + function suby1 (a) aa = 1 + a; bb = a;