aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-06-27 20:13:49 +0100
committerAleksey Kladov <[email protected]>2020-06-27 20:14:25 +0100
commita9b4fb034bab194bef80c75f146288e55ae8aa2d (patch)
tree192b7e2e9032db82c1b29bcd3a0551023c470bd0 /crates
parent175e48e5be46faf6338d36907c6caf10c2d056f1 (diff)
Add colors
Diffstat (limited to 'crates')
-rw-r--r--crates/expect/Cargo.toml1
-rw-r--r--crates/expect/src/lib.rs18
2 files changed, 14 insertions, 5 deletions
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(()));