Skip to content

Commit 15e7534

Browse files
committed
feat: do not show the computed real value if it's equal to its representation
1 parent cbb3127 commit 15e7534

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

Testing.ark

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,20 +96,27 @@
9696
(let _lhs_align (len _lhs_repr))
9797
(let _rhs_align (len _rhs_repr))
9898
(let _show_expected (!= _lhs_repr (toString _lhs)))
99-
100-
(append! _failures
101-
(str:format
102-
(+ "{}{: <" (toString (len "expected ")) "}" "{: <" (toString _rhs_start) "}{:~<" (toString _rhs_align) "} {}")
103-
_indent
104-
# to position one char before the first ' surrounding the expected value
105-
""
106-
# writes the | right under the first ' surrounding the expected value
107-
(if _show_expected "|" "")
108-
# begins the \~~~~ under the real value
109-
"\\"
110-
_rhs))
99+
(let _show_real (!= _rhs_repr (toString _rhs)))
100+
101+
(if _show_real
102+
(append! _failures
103+
(str:format
104+
(+ "{}{: <" (toString (len "expected ")) "}" "{: <" (toString _rhs_start) "}{:~<" (toString _rhs_align) "} {}")
105+
_indent
106+
# to position one char before the first ' surrounding the expected value
107+
""
108+
# writes the | right under the first ' surrounding the expected value
109+
(if _show_expected "|" "")
110+
# begins the \~~~~ under the real value
111+
(if _show_real "\\" "")
112+
(if _show_real _rhs ""))))
111113
(if _show_expected
112-
(append! _failures (str:format (+ "{}{: <9}{:~<" (toString _lhs_align) "} {}") _indent "" "\\" _lhs)))}))
114+
(append! _failures
115+
(str:format
116+
(+ "{}{: <" (toString (len "expected ")) "}\\ {}")
117+
_indent
118+
""
119+
_lhs)))}))
113120

114121
# internal, do not use
115122
# This can only be used within a (nested or not) call to test:suite

0 commit comments

Comments
 (0)