support pretty printing of StringInterLiteral in asserts too
parent
e077cce103
commit
45fdbc4df7
|
@ -77,6 +77,27 @@ pub fn (x Expr) str() string {
|
|||
StringLiteral {
|
||||
return '"$it.val"'
|
||||
}
|
||||
StringInterLiteral {
|
||||
res := []string
|
||||
res << "'"
|
||||
for i, val in it.vals {
|
||||
res << val
|
||||
if i>=it.exprs.len {
|
||||
continue
|
||||
}
|
||||
res << '$'
|
||||
if it.expr_fmts[i].len > 0 {
|
||||
res << '{'
|
||||
res << it.exprs[i].str()
|
||||
res << it.expr_fmts[i]
|
||||
res << '}'
|
||||
}else{
|
||||
res << it.exprs[i].str()
|
||||
}
|
||||
}
|
||||
res << "'"
|
||||
return res.join('')
|
||||
}
|
||||
BoolLiteral {
|
||||
return it.val.str()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue