changeset 31959:90f21a2c471f

assert.m: Fix 2D character matrix equality (bug #63988) * assert.m: Previously, padding with single quotes was working only for individual strings, not for character matrices. This edit allows 2D character matrices in assert statements.
author Arun Giridhar <arungiridhar@gmail.com>
date Sat, 01 Apr 2023 15:58:29 -0400
parents 1634ab59e8ac
children 3df2579631b5
files scripts/testfun/assert.m
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/testfun/assert.m	Sat Apr 01 11:48:26 2023 -0400
+++ b/scripts/testfun/assert.m	Sat Apr 01 15:58:29 2023 -0400
@@ -138,8 +138,10 @@
           endif
         elseif (! strcmp (cond, expected))
           err.index{end+1} = "[]";
-          err.observed{end+1} = ["'" cond "'"];
-          err.expected{end+1} = ["'" expected "'"];
+          rr = repmat ("'", rows (cond), 1);
+          err.observed{end+1} = [rr cond rr];
+          rr = repmat ("'", rows (expected), 1);
+          err.expected{end+1} = [rr expected rr];
           err.reason{end+1} = "Strings don't match";
         endif