History

Account for "\ No newline at end of file"

Christoph Rüßler committed 11 months ago

Commit cb66d191 parent 3e404381 file · +14 −1Browse files

Unified · Split

gix-diff/tests/diff/blob/slider.rs+14−1
@@ -213,7 +213,20 @@ mod baseline { · 212 unmodified lines
213213 hunk_lines.extend_from_slice(line);
214214 hunk_lines.push(b'\n');
215215 }
216− _ => unreachable!("BUG: expecting unified diff format"),
216+ b'\\' => {
217+ if line == "\\ No newline at end of file".as_bytes() {
218+ // Do nothing.
219+ } else {
220+ unreachable!(
221+ "BUG: expecting unified diff format, found line: `{}`",
222+ line.to_str_lossy()
223+ )
224+ }
225+ }
226+ _ => unreachable!(
227+ "BUG: expecting unified diff format, found line: `{}`",
228+ line.to_str_lossy()
229+ ),
217230 }
218231
219232 match self.lines.peek() {