Skip to content

Commit

Permalink
Merge pull request #308 from Alexendoo/diff-missing-lines
Browse files Browse the repository at this point in the history
Fix missing lines in diff output
  • Loading branch information
oli-obk authored Mar 3, 2025
2 parents d637120 + 27d7aa3 commit ef35ab9
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

* missing lines in diff output

### Changed

### Removed
Expand Down
13 changes: 11 additions & 2 deletions src/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,17 @@ fn row(row: DiffOp<'_, &str>) {
skip(l);
}
Replace(l, r) => {
for (l, r) in l.iter().zip(r) {
print_line_diff(l, r);
if l.len() == r.len() {
for (l, r) in l.iter().zip(r) {
print_line_diff(l, r);
}
} else {
for l in l {
println!("{}{}", "-".red(), l.red());
}
for r in r {
println!("{}{}", "+".green(), r.green());
}
}
}
Insert(r) => {
Expand Down
38 changes: 34 additions & 4 deletions tests/integrations/basic-fail/Cargo.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -1229,8 +1229,16 @@ Execute `DO NOT BLESS. These are meant to fail` to update `tests/actual_tests/ba
+ --> tests/actual_tests/bad_pattern.rs:1:5
|
-4 | add("42", 3);
+1 | use basic_fail::add;
- | --- ^^^^ expected `usize`, found `&str`
- | |
- | arguments to this function are incorrect
- |
-note: function defined here
- --> $DIR/tests/integrations/basic-fail/src/lib.rs:LL:CC
- |
-1 | pub fn add(left: usize, right: usize) -> usize {
- | ^^^
+1 | use basic_fail::add;
+ | ^^^^^^^^^^ use of undeclared crate or module `basic_fail`

-error: aborting due to previous error
Expand Down Expand Up @@ -1350,8 +1358,14 @@ Execute `DO NOT BLESS. These are meant to fail` to update `tests/actual_tests/fo
+ --> tests/actual_tests/foomp.rs:1:5
|
-4 | add("42", 3);
+1 | use basic_fail::add;
- | --- ^^^^ expected `usize`, found `&str`
- |
-note: function defined here
- --> $DIR/tests/integrations/basic/src/lib.rs:LL:CC
- |
-1 | pub fn add(left: usize, right: usize) -> usize {
- | ^^^ some expected text that isn't in the actual message
+1 | use basic_fail::add;
+ | ^^^^^^^^^^ use of undeclared crate or module `basic_fail`

-error: aborting doo to previous error
Expand Down Expand Up @@ -1400,8 +1414,16 @@ Execute `DO NOT BLESS. These are meant to fail` to update `tests/actual_tests/fo
+ --> tests/actual_tests/foomp2.rs:1:5
|
-4 | add("42", 3);
+1 | use basic_fail::add;
- | --- ^^^^ expected `usize`, found `&str`
- | |
- | arguments to this function are incorrect
- |
-note: function defined here
- --> $DIR/tests/integrations/basic-fail/src/lib.rs:LL:CC
- |
-1 | pub fn add(left: usize, right: usize) -> usize {
- | ^^^
+1 | use basic_fail::add;
+ | ^^^^^^^^^^ use of undeclared crate or module `basic_fail`

-error: aborting due to previous error
Expand Down Expand Up @@ -1515,8 +1537,16 @@ Execute `DO NOT BLESS. These are meant to fail` to update `tests/actual_tests/ru
+ --> tests/actual_tests/rustc_ice.rs:5:5
|
-8 | add("42", 3);
+5 | use basic_fail::add;
- | --- ^^^^ expected `usize`, found `&str`
- | |
- | arguments to this function are incorrect
- |
-note: function defined here
- --> $DIR/tests/integrations/basic-fail/src/lib.rs:LL:CC
- |
-1 | pub fn add(left: usize, right: usize) -> usize {
- | ^^^
+5 | use basic_fail::add;
+ | ^^^^^^^^^^ use of undeclared crate or module `basic_fail`

thread 'rustc' panicked
Expand Down

0 comments on commit ef35ab9

Please sign in to comment.