aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock1
-rw-r--r--crates/expect/Cargo.toml1
-rw-r--r--crates/expect/src/lib.rs18
3 files changed, 15 insertions, 5 deletions
diff --git a/Cargo.lock b/Cargo.lock
index de7337be1..3e6bd9bb3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -351,6 +351,7 @@ dependencies = [
351name = "expect" 351name = "expect"
352version = "0.1.0" 352version = "0.1.0"
353dependencies = [ 353dependencies = [
354 "difference",
354 "once_cell", 355 "once_cell",
355 "stdx", 356 "stdx",
356] 357]
diff --git a/crates/expect/Cargo.toml b/crates/expect/Cargo.toml
index 09eb57a43..caee43106 100644
--- a/crates/expect/Cargo.toml
+++ b/crates/expect/Cargo.toml
@@ -6,4 +6,5 @@ edition = "2018"
6 6
7[dependencies] 7[dependencies]
8once_cell = "1" 8once_cell = "1"
9difference = "2"
9stdx = { path = "../stdx" } 10stdx = { path = "../stdx" }
diff --git a/crates/expect/src/lib.rs b/crates/expect/src/lib.rs
index dc4a4223e..18f361ec2 100644
--- a/crates/expect/src/lib.rs
+++ b/crates/expect/src/lib.rs
@@ -107,22 +107,30 @@ impl Runtime {
107 rt.help_printed = true; 107 rt.help_printed = true;
108 108
109 let help = if print_help { HELP } else { "" }; 109 let help = if print_help { HELP } else { "" };
110
111 let diff = difference::Changeset::new(actual, expected, "\n");
112
110 println!( 113 println!(
111 "\n 114 "\n
112error: expect test failed{} 115\x1b[1m\x1b[91merror\x1b[97m: expect test failed\x1b[0m{}
113 --> {}:{}:{} 116 \x1b[1m\x1b[34m-->\x1b[0m {}:{}:{}
117{}
118\x1b[1mExpect\x1b[0m:
119----
114{} 120{}
115Expect: 121----
122
123\x1b[1mActual\x1b[0m:
116---- 124----
117{} 125{}
118---- 126----
119 127
120Actual: 128\x1b[1mDiff\x1b[0m:
121---- 129----
122{} 130{}
123---- 131----
124", 132",
125 updated, expect.file, expect.line, expect.column, help, expected, actual 133 updated, expect.file, expect.line, expect.column, help, expected, actual, diff
126 ); 134 );
127 // Use resume_unwind instead of panic!() to prevent a backtrace, which is unnecessary noise. 135 // Use resume_unwind instead of panic!() to prevent a backtrace, which is unnecessary noise.
128 std::panic::resume_unwind(Box::new(())); 136 std::panic::resume_unwind(Box::new(()));