Mercurial > octave
changeset 21297:e0523c40a802
maint: Merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 18 Feb 2016 15:10:36 -0500 |
parents | 29a0e9e70879 (current diff) 596e19e7e571 (diff) |
children | 31cd45258fc6 |
files | libinterp/corefcn/oct-stream.cc |
diffstat | 2 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/oct-stream.cc Thu Feb 18 11:57:24 2016 -0500 +++ b/libinterp/corefcn/oct-stream.cc Thu Feb 18 15:10:36 2016 -0500 @@ -2256,7 +2256,10 @@ { if (curr_val.is_string ()) { - std::string sval = curr_val.string_value (); + dim_vector dv (1, curr_val.numel ()); + octave_value tmp = curr_val.reshape (dv); + + std::string sval = tmp.string_value (); retval = sval.substr (elt_idx);
--- a/test/io.tst Thu Feb 18 11:57:24 2016 -0500 +++ b/test/io.tst Thu Feb 18 15:10:36 2016 -0500 @@ -673,3 +673,7 @@ %!assert (sprintf ("|%X|", "Octave"), "|4F||63||74||61||76||65|"); %!assert (sprintf ("|%o|", "Octave"), "|117||143||164||141||166||145|"); +## bug #47192 +%!assert (sprintf ("%s", repmat ("blah", 2, 1)), "bbllaahh") +%!assert (sprintf ("%c", repmat ("blah", 2, 1)), "bbllaahh") +%!assert (sprintf ("%c %c %s", repmat ("blah", 2, 1)), "b b llaahh")