Mercurial > hg > octave-lyh
changeset 9130:67fa54583fe8
Add test to prevent regression of empty struct assignment bug
author | Thorsten Meyer <thorsten.meyier@gmx.de> |
---|---|
date | Fri, 17 Apr 2009 21:43:05 +0200 |
parents | 17a3df1d992b |
children | 6340043000c0 |
files | test/ChangeLog test/test_struct.m |
diffstat | 2 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2009-04-17 Thorsten Meyer <thorsten.meyier@gmx.de> + + * test_struct.m: Add tests to prevent regression of bug with + indexed assignment into empty struct array. + 2009-04-15 Thorsten Meyer <thorsten.meyier@gmx.de> * test_struct.m: Add tests for lazy copying in nested assignments
--- a/test/test_struct.m +++ b/test/test_struct.m @@ -251,3 +251,14 @@ %! a.m = b; %! a.m.c.b = a; %! assert (a.m.c.b.m.i.j.k.l, struct ("b", 1)); + +## test indexed assignment into empty struct array +%!test +%! s = resize(struct(),3,2); +%! s(3).foo = 42; +%! assert (s(3), struct ("foo", 42)); + +%!error <Index exceeds matrix dimension> +%! s = resize(struct(),3,2); +%! s(3).foo = 42; +%! s(7); \ No newline at end of file