changeset 33303:eeb900fb16fc

assert.m: Fix BIST failures accidentally introduced in 38860e27296b. * assert.m: Guarantee that 'fmt' variable for sprintf is not empty.
author Rik <rik@octave.org>
date Wed, 03 Apr 2024 08:31:10 -0700
parents 36918f99b189
children acef2a35ba7c
files scripts/testfun/assert.m
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/testfun/assert.m	Wed Apr 03 07:27:38 2024 -0400
+++ b/scripts/testfun/assert.m	Wed Apr 03 08:31:10 2024 -0700
@@ -771,7 +771,7 @@
   if (numel (matsize) == 2)
     subs = subs(:, matsize != 1);  # For vectors, use 1-D index
   endif
-  fmt = repmat ('%d,', 1, columns (subs));
+  fmt = repmat ('%d,', 1, max (columns (subs), 1));
   fmt(end) = [];   # delete final extra comma
   cout = ostrsplit (sprintf (['(' fmt ')', '$'], subs'), '$');
   cout(end) = [];  # delete extra cell from final '$'