-
Notifications
You must be signed in to change notification settings - Fork 36
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
Fix line number 0 unaligned display #142
base: master
Are you sure you want to change the base?
Conversation
|
||
// for issue 57 | ||
#[test] | ||
fn test_line_number_0() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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
- For someone viewing the commit with the behavior change, it makes it obvious what the intended behavior change is
- It shows to you and reviewers that the test tests the intended case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
For someone viewing the commit with the behavior change, it makes it obvious what the intended behavior change is
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 comment
The 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 comment
The 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 comment
The 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.
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 + |∅
BTW, I was thinking to add unit tests for eg. the |
FYI |
@epage |
For myself, I don't think its needed. btw I've not been looking too deeply at this until the commits get cleaned up |
11f6daf
to
f758ef6
Compare
Please clean up the commits to be how you want them reviewed and merged. I would recommend
|
I feel it is a little difficult to put refactor commits in advance. So I I put them at the end instead. |
- Line number width is 1 if max line number is 0 - Line number witdh is 0 if max line number is None - Update test_line_number_0 in tests/formatter.rs to reflect new behavior - Fix issue rust-lang#57
The fold chaining is to find max line number rather than line number width
@epage I know this PR isn't a very necessary fix, but I'm curious if we can continue with it or if you'd prefer to close it? |
Looks like the commits aren't atomic. The "fix" commit doesn't include any test changes. Note when i asked for a test commit, I asked that it show the existing behavior (it should pass) and that the fix commit then makes the test to work with the fix. This makes it very clear what the change in behavior is. |
fix #57