mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:04 +00:00
Fix diff (old and new were reversed) (#7855)
## Summary Fixes #7853. The old and new source files were reversed in the call to `TextDiff::from_lines`, so the diff output of the CLI was also reversed. ## Test Plan Two snapshots were updated in the process, so any reversal should be caught :)
This commit is contained in:
parent
2d6557a51b
commit
38f512d588
2 changed files with 7 additions and 7 deletions
|
@ -1111,8 +1111,8 @@ fn diff_shows_safe_fixes_by_default() {
|
|||
----- stdout -----
|
||||
@@ -1,2 +1,2 @@
|
||||
x = {'a': 1, 'a': 1}
|
||||
-print('foo')
|
||||
+print(('foo'))
|
||||
-print(('foo'))
|
||||
+print('foo')
|
||||
|
||||
|
||||
----- stderr -----
|
||||
|
@ -1142,10 +1142,10 @@ fn diff_shows_unsafe_fixes_with_opt_in() {
|
|||
exit_code: 1
|
||||
----- stdout -----
|
||||
@@ -1,2 +1,2 @@
|
||||
-x = {'a': 1}
|
||||
-print('foo')
|
||||
+x = {'a': 1, 'a': 1}
|
||||
+print(('foo'))
|
||||
-x = {'a': 1, 'a': 1}
|
||||
-print(('foo'))
|
||||
+x = {'a': 1}
|
||||
+print('foo')
|
||||
|
||||
|
||||
----- stderr -----
|
||||
|
|
|
@ -91,7 +91,7 @@ impl SourceKind {
|
|||
pub fn diff(&self, other: &Self, path: Option<&Path>, writer: &mut dyn Write) -> Result<()> {
|
||||
match (self, other) {
|
||||
(SourceKind::Python(src), SourceKind::Python(dst)) => {
|
||||
let text_diff = TextDiff::from_lines(dst, src);
|
||||
let text_diff = TextDiff::from_lines(src, dst);
|
||||
let mut unified_diff = text_diff.unified_diff();
|
||||
|
||||
if let Some(path) = path {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue