# HG changeset patch # User Thorsten Meyer # Date 1239997385 -7200 # Node ID 67fa54583fe84b77e28f70a9b5298c86da59d49c # Parent 17a3df1d992bf75285c8005805400e66913fabd7 Add test to prevent regression of empty struct assignment bug diff --git a/test/ChangeLog b/test/ChangeLog --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2009-04-17 Thorsten Meyer + + * test_struct.m: Add tests to prevent regression of bug with + indexed assignment into empty struct array. + 2009-04-15 Thorsten Meyer * test_struct.m: Add tests for lazy copying in nested assignments diff --git a/test/test_struct.m b/test/test_struct.m --- 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 +%! s = resize(struct(),3,2); +%! s(3).foo = 42; +%! s(7); \ No newline at end of file