mirror of
https://github.com/nushell/nushell
synced 2024-11-13 08:27:06 +00:00
Improve assertions in src/tests.rs
(#10449)
# Description Mention the expected substring in: - `fn run_test_contains()` - `fn test_ide_contains()` - `fn fail_test()` # Developer-Facing Changes You can read the test failure to figure out what is going on, don't necessarily have to look up the test New look of failure ``` failures: ---- tests::test_math::broken_math stdout ---- stdout: stderr: Error: nu::parser::incomplete_math_expression × Incomplete math expression. ╭─[/tmp/.tmpz0V8nC:1:1] 1 │ 3 + · ┬ · ╰── incomplete math expression ╰──── Expected error to contain: Incomplete universe thread 'tests::test_math::broken_math' panicked at 'assertion failed: !stderr.is_empty() && stderr.contains(expected)', src/tests.rs:181:5 ```
This commit is contained in:
parent
4aa9102523
commit
1072bd06c3
1 changed files with 3 additions and 0 deletions
|
@ -116,6 +116,7 @@ pub fn run_test_contains(input: &str, expected: &str) -> TestResult {
|
|||
println!("stdout: {stdout}");
|
||||
println!("stderr: {stderr}");
|
||||
|
||||
println!("Expected output to contain: {expected}");
|
||||
assert!(output.status.success());
|
||||
|
||||
assert!(stdout.contains(expected));
|
||||
|
@ -144,6 +145,7 @@ pub fn test_ide_contains(input: &str, ide_commands: &[&str], expected: &str) ->
|
|||
|
||||
println!("stdout: {stdout}");
|
||||
println!("stderr: {stderr}");
|
||||
println!("Expected output to contain: {expected}");
|
||||
|
||||
assert!(output.status.success());
|
||||
|
||||
|
@ -174,6 +176,7 @@ pub fn fail_test(input: &str, expected: &str) -> TestResult {
|
|||
|
||||
println!("stdout: {stdout}");
|
||||
println!("stderr: {stderr}");
|
||||
println!("Expected error to contain: {expected}");
|
||||
|
||||
assert!(!stderr.is_empty() && stderr.contains(expected));
|
||||
|
||||
|
|
Loading…
Reference in a new issue