Skip to content

Commit 90fa23d

Browse files
committed
test: Add a test case for issue 57
thread 'test_line_number_0' panicked at tests/formatter.rs:928:5: ---- expected: tests/formatter.rs:919:20 ++++ actual: In-memory 1 1 | error: dummy 2 - --> file/path:0:3 3 - | 4 - 0 | foo 5 - | ^ 6 - |∅ 2 + --> file/path:0:3 3 + | 4 + 0 |foo 5 + | ^ 6 + |∅
1 parent 43a10aa commit 90fa23d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/formatter.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,3 +905,25 @@ error: unused optional dependency
905905
let renderer = Renderer::plain();
906906
assert_data_eq!(renderer.render(input).to_string(), expected);
907907
}
908+
909+
// for issue 57
910+
#[test]
911+
fn test_line_number_0() {
912+
let input = Level::Error.title("dummy").snippet(
913+
Snippet::source("foo")
914+
.origin("file/path")
915+
.line_start(0)
916+
.annotation(Level::Error.span(2..3)), // bar\nbaz
917+
);
918+
919+
let expected = str![[r#"
920+
error: dummy
921+
--> file/path:0:3
922+
|
923+
0 | foo
924+
| ^
925+
|
926+
"#]];
927+
let renderer = Renderer::plain();
928+
assert_data_eq!(renderer.render(input).to_string(), expected);
929+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy