Mercurial > octave
changeset 22439:455bb5c0e03c
* null-assign.tst: Update subsasgn test (bug #48867)
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 06 Sep 2016 09:21:58 -0400 |
parents | 5a838a892adb |
children | 20e6de770ca4 |
files | test/null-assign.tst |
diffstat | 1 files changed, 14 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/test/null-assign.tst Mon Sep 05 09:49:33 2016 +0200 +++ b/test/null-assign.tst Tue Sep 06 09:21:58 2016 -0400 @@ -55,11 +55,22 @@ %!test %! a = ones (3); fail ("a(:,1:3) = double ([])"); -## subsasgn should work the same way +## for compatibility with Matlab, subsasgn allows any 0x0 double array +## but not other empty arrays (bug #48867) +%!test +%! a = ones (3); +%! a = subsasgn (a, substruct ('()', {':',1:2}), []); +%! assert (size (a), [3,1]); %!test -%! a = ones (3); a = subsasgn (a, substruct ('()', {':',1:2}), []); assert (size (a), [3,1]); +%! a = ones (3); b = zeros (0, 0); +%! a = subsasgn (a, substruct ('()', {':',1:2}), b); +%! assert (size (a), [3,1]); %!test -%! a = ones (3); b = []; fail ("subsasgn (a, substruct ('()', {':',1:2}), b)", "."); +%! a = ones (3); b = zeros (0, 0, 2); +%! fail ("subsasgn (a, substruct ('()', {':',1:2}), b)", "."); +%!test +%! a = ones (3); b = zeros (0, 0, "uint8"); +%! fail ("subsasgn (a, substruct ('()', {':',1:2}), b)", "."); %!test %! classes = {@int8, @int16, @int32, @int64, ...