Skip to content

diff: order EOF-newline deletions before insertions - #411

Open
Gorkem-Taha wants to merge 1 commit into
uutils:mainfrom
Gorkem-Taha:fix/unified-no-newline-order
Open

Gorkem-Taha wants to merge 1 commit into
uutils:mainfrom
Gorkem-Taha:fix/unified-no-newline-order

Conversation

@Gorkem-Taha

Copy link
Copy Markdown

Unified diffs could place additions before deletions when an EOF newline mismatch was discovered after earlier additions. Keep the deletions first and add regression cases for both newline directions. Fixes #405.

.stdout_str_check(|s| s.ends_with(hunk));
}

#[test]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please use #[rstest] with two #[case]s like trailing_context_without_final_newlines just above? the loop with the index file names wouldn't be needed then

}

#[test]
fn unified_missing_newline_deletions_first() -> Result<(), Box<dyn std::error::Error>> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing returns an error here, so the Result and the Ok(()) can go, no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

diff - -u prints a - line after + lines when the last line differs only by its newline

2 participants