diff options
Diffstat (limited to 'crates/expect')
-rw-r--r-- | crates/expect/src/lib.rs | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/crates/expect/src/lib.rs b/crates/expect/src/lib.rs index 92364bfa7..dc4a4223e 100644 --- a/crates/expect/src/lib.rs +++ b/crates/expect/src/lib.rs | |||
@@ -78,7 +78,8 @@ impl Expect { | |||
78 | line_start += line.len(); | 78 | line_start += line.len(); |
79 | } | 79 | } |
80 | let (literal_start, line_indent) = target_line.unwrap(); | 80 | let (literal_start, line_indent) = target_line.unwrap(); |
81 | let literal_length = file[literal_start..].find("]]").expect("Couldn't find matching `]]` for `expect![[`."); | 81 | let literal_length = |
82 | file[literal_start..].find("]]").expect("Couldn't find matching `]]` for `expect![[`."); | ||
82 | let literal_range = literal_start..literal_start + literal_length; | 83 | let literal_range = literal_start..literal_start + literal_length; |
83 | Location { line_indent, literal_range } | 84 | Location { line_indent, literal_range } |
84 | } | 85 | } |
@@ -239,34 +240,6 @@ mod tests { | |||
239 | use super::*; | 240 | use super::*; |
240 | 241 | ||
241 | #[test] | 242 | #[test] |
242 | fn test_expect_macro() { | ||
243 | let empty = expect![[]]; | ||
244 | expect![[r#" | ||
245 | Expect { | ||
246 | file: "crates/expect/src/lib.rs", | ||
247 | line: 241, | ||
248 | column: 21, | ||
249 | data: "", | ||
250 | } | ||
251 | "#]] | ||
252 | .assert_debug_eq(&empty); | ||
253 | |||
254 | let expect = expect![[" | ||
255 | hello | ||
256 | world | ||
257 | "]]; | ||
258 | expect![[r#" | ||
259 | Expect { | ||
260 | file: "crates/expect/src/lib.rs", | ||
261 | line: 252, | ||
262 | column: 22, | ||
263 | data: "\n hello\n world\n ", | ||
264 | } | ||
265 | "#]] | ||
266 | .assert_debug_eq(&expect); | ||
267 | } | ||
268 | |||
269 | #[test] | ||
270 | fn test_format_patch() { | 243 | fn test_format_patch() { |
271 | let patch = format_patch(0, "hello\nworld\n"); | 244 | let patch = format_patch(0, "hello\nworld\n"); |
272 | expect![[r##" | 245 | expect![[r##" |