diff --git a/crates/nu-std/std/assert.nu b/crates/nu-std/std/assert.nu index b58a02f904..e8e11ce1ec 100644 --- a/crates/nu-std/std/assert.nu +++ b/crates/nu-std/std/assert.nu @@ -116,7 +116,10 @@ export def error [ main ($error_raised) $message --error-label { start: (metadata $code).span.start end: (metadata $code).span.end - text: $"There were no error during code execution: (view source $code)" + text: ( + "There were no error during code execution:\n" + + $" (view source $code)" + ) } } @@ -133,7 +136,11 @@ export def equal [left: any, right: any, message?: string] { main ($left == $right) $message --error-label { start: (metadata $left).span.start end: (metadata $right).span.end - text: $"They are not equal. Left = '($left)'. Right = '($right)'." + text: ( + "These are not equal.\n" + + $" Left : '($left | to nuon --raw)'\n" + + $" Right : '($right | to nuon --raw)'" + ) } } @@ -150,7 +157,7 @@ export def "not equal" [left: any, right: any, message?: string] { main ($left != $right) $message --error-label { start: (metadata $left).span.start end: (metadata $right).span.end - text: $"They both are '($left)'." + text: $"These are both '($left | to nuon --raw)'." } } @@ -167,7 +174,11 @@ export def "less or equal" [left: any, right: any, message?: string] { main ($left <= $right) $message --error-label { start: (metadata $left).span.start end: (metadata $right).span.end - text: $"Left: '($left)', Right: '($right)'" + text: ( + "The condition *left <= right* is not satisfied.\n" + + $" Left : '($left)'\n" + + $" Right : '($right)'" + ) } } @@ -183,7 +194,11 @@ export def less [left: any, right: any, message?: string] { main ($left < $right) $message --error-label { start: (metadata $left).span.start end: (metadata $right).span.end - text: $"Left: '($left)', Right: '($right)'" + text: ( + "The condition *left < right* is not satisfied.\n" + + $" Left : '($left)'\n" + + $" Right : '($right)'" + ) } } @@ -199,7 +214,11 @@ export def greater [left: any, right: any, message?: string] { main ($left > $right) $message --error-label { start: (metadata $left).span.start end: (metadata $right).span.end - text: $"Left: '($left)', Right: '($right)'" + text: ( + "The condition *left > right* is not satisfied.\n" + + $" Left : '($left)'\n" + + $" Right : '($right)'" + ) } } @@ -216,7 +235,11 @@ export def "greater or equal" [left: any, right: any, message?: string] { main ($left >= $right) $message --error-label { start: (metadata $left).span.start end: (metadata $right).span.end - text: $"Left: '($left)', Right: '($right)'" + text: ( + "The condition *left < right* is not satisfied.\n" + + $" Left : '($left)'\n" + + $" Right : '($right)'" + ) } } @@ -233,7 +256,12 @@ export def length [left: list, right: int, message?: string] { main (($left | core length) == $right) $message --error-label { start: (metadata $left).span.start end: (metadata $right).span.end - text: $"Length of ($left) is ($left | core length), not ($right)" + text: ( + "This does not have the correct length:\n" + + $" value : ($left | to nuon --raw)\n" + + $" length : ($left | core length)\n" + + $" expected : ($right)" + ) } } @@ -250,6 +278,9 @@ export def "str contains" [left: string, right: string, message?: string] { main ($left | core str contains $right) $message --error-label { start: (metadata $left).span.start end: (metadata $right).span.end - text: $"'($left)' does not contain '($right)'." + text: ( + $"This does not contain '($right)'.\n" + + $" value: ($left | to nuon --raw)" + ) } }