Improved regressions error reporting.

This commit is contained in:
Garth Minette 2021-06-30 19:56:17 -07:00
parent 76a8ce50c1
commit 86fc7dc143
2 changed files with 2 additions and 1 deletions

View file

@ -577,6 +577,7 @@ module no_module() {
function _valstr(x) = function _valstr(x) =
is_string(x)? str("\"",str_replace_char(x, "\"", "\\\""),"\"") :
is_list(x)? str("[",str_join([for (xx=x) _valstr(xx)],","),"]") : is_list(x)? str("[",str_join([for (xx=x) _valstr(xx)],","),"]") :
is_num(x) && x==floor(x)? fmt_int(x) : is_num(x) && x==floor(x)? fmt_int(x) :
is_finite(x)? fmt_float(x,12) : x; is_finite(x)? fmt_float(x,12) : x;

View file

@ -734,7 +734,7 @@ function str_pad(str,length,char=" ",left=false) =
// can be any string. // can be any string.
function str_replace_char(str,char,replace) = function str_replace_char(str,char,replace) =
assert(is_str(str)) assert(is_str(str))
assert(is_str(char) && len(char)==1, "Search pattern 'char' must be a a single character string") assert(is_str(char) && len(char)==1, "Search pattern 'char' must be a single character string")
assert(is_str(replace)) assert(is_str(replace))
str_join([for(c=str) c==char ? replace : c]); str_join([for(c=str) c==char ? replace : c]);