improve assertion error messages in std assert
(#10551)
should close #10549
# Description
this PR is twofold
- uses `to nuon --raw` in the error messages to make sure #10549 is
solved and makes a difference between `"1"` and `1`
- tries to introduce slightly better errors, i.e. by putting left /
right on new lines => this should hopefully help when the values become
a bit big 😋
# User-Facing Changes
the original issue:
```nushell
> assert equal {one:1 two:2} {one:"1" two:"2"}
Error: × Assertion failed.
╭─[entry #3:1:1]
1 │ assert equal {one:1 two:2} {one:"1" two:"2"}
· ───────────────┬───────────────
· ╰── These are not equal.
Left : '{one: 1, two: 2}'
Right : '{one: "1", two: "2"}'
╰────
```
a sample for all the assertions and their new messages
```nushell
> assert equal {one:1 two:2} {one:"1" two:"2"}
Error: × Assertion failed.
╭─[entry #3:1:1]
1 │ assert equal {one:1 two:2} {one:"1" two:"2"}
· ───────────────┬───────────────
· ╰── These are not equal.
Left : '{one: 1, two: 2}'
Right : '{one: "1", two: "2"}'
╰────
```
```nushell
> assert equal 1 2
Error: × Assertion failed.
╭─[entry #4:1:1]
1 │ assert equal 1 2
· ─┬─
· ╰── These are not equal.
Left : '1'
Right : '2'
╰────
```
```nushell
> assert less 3 1
Error: × Assertion failed.
╭─[entry #6:1:1]
1 │ assert less 3 1
· ─┬─
· ╰── The condition *left < right* is not satisfied.
Left : '3'
Right : '1'
╰────
```
```nushell
> assert less or equal 3 1
Error: × Assertion failed.
╭─[entry #7:1:1]
1 │ assert less or equal 3 1
· ─┬─
· ╰── The condition *left <= right* is not satisfied.
Left : '3'
Right : '1'
╰────
```
```nushell
> assert greater 1 3
Error: × Assertion failed.
╭─[entry #8:1:1]
1 │ assert greater 1 3
· ─┬─
· ╰── The condition *left > right* is not satisfied.
Left : '1'
Right : '3'
╰────
```
```nushell
> assert greater or equal 1 3
Error: × Assertion failed.
╭─[entry #9:1:1]
1 │ assert greater or equal 1 3
· ─┬─
· ╰── The condition *left < right* is not satisfied.
Left : '1'
Right : '3'
╰────
```
```nushell
> assert length [1 2 3] 2
Error: × Assertion failed.
╭─[entry #10:1:1]
1 │ assert length [1 2 3] 2
· ────┬────
· ╰── This does not have the correct length:
value : [1, 2, 3]
length : 3
expected : 2
╰────
```
```nushell
> assert length [1 "2" 3] 2
Error: × Assertion failed.
╭─[entry #11:1:1]
1 │ assert length [1 "2" 3] 2
· ─────┬─────
· ╰── This does not have the correct length:
value : [1, "2", 3]
length : 3
expected : 2
╰────
```
```nushell
> assert str contains "foo" "bar"
Error: × Assertion failed.
╭─[entry #13:1:1]
1 │ assert str contains "foo" "bar"
· ─────┬─────
· ╰── This does not contain '($right)'.
value: "foo"
╰────
```
# Tests + Formatting
# After Submitting