-
Notifications
You must be signed in to change notification settings - Fork 45
Fix line number 0 unaligned display #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -905,3 +905,25 @@ error: unused optional dependency | |
let renderer = Renderer::plain(); | ||
assert_data_eq!(renderer.render(input).to_string(), expected); | ||
} | ||
|
||
// for issue 57 | ||
#[test] | ||
fn test_line_number_0() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you change up the commits so this test case is the first commit, with it passing ie showing the bad behavior? Benefits
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. got it! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This means the commit that changes behavior should also include test updates. Every commit should pass tests There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As reminder, every commit should pass tests There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ae4694f is said to be a fix and changes behavior but there is no test update in that commit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry I did not see the comment and please check out the update. Thanks. |
||
let input = Level::Error.title("dummy").snippet( | ||
Snippet::source("foo") | ||
.origin("file/path") | ||
.line_start(0) | ||
.annotation(Level::Error.span(2..3)), // bar\nbaz | ||
); | ||
|
||
let expected = str![[r#" | ||
error: dummy | ||
--> file/path:0:3 | ||
| | ||
0 | foo | ||
| ^ | ||
| | ||
"#]]; | ||
let renderer = Renderer::plain(); | ||
assert_data_eq!(renderer.render(input).to_string(), expected); | ||
} |