Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions fuzz/fuzz_targets/fuzz_patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ fuzz_target!(|x: (Vec<u8>, Vec<u8>, u8)| {
return
}*/
fs::create_dir_all("target").unwrap();
let patched = "target/fuzz.file";
let diff = unified_diff::diff(
&from,
&to,
&Params {
from: "a/fuzz.file".into(),
to: "target/fuzz.file".into(),
from: patched.into(),
to: patched.into(),
context_count: context as usize,
..Default::default()
}
},
);
File::create("target/fuzz.file.original")
.unwrap()
Expand Down
20 changes: 12 additions & 8 deletions src/context_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,12 +429,13 @@ mod tests {
}
// This test diff is intentionally reversed.
// We want it to turn the alef into bet.
let patched = &format!("{target}/alef");
let diff = diff(
&alef,
&bet,
&Params {
from: "a/alef".into(),
to: (&format!("{target}/alef")).into(),
from: patched.into(),
to: patched.into(),
context_count: 2,
..Default::default()
},
Expand Down Expand Up @@ -510,12 +511,13 @@ mod tests {
}
// This test diff is intentionally reversed.
// We want it to turn the alef into bet.
let patched = &format!("{target}/alef_");
let diff = diff(
&alef,
&bet,
&Params {
from: "a/alef_".into(),
to: (&format!("{target}/alef_")).into(),
from: patched.into(),
to: patched.into(),
context_count: 2,
..Default::default()
},
Expand Down Expand Up @@ -594,12 +596,13 @@ mod tests {
};
// This test diff is intentionally reversed.
// We want it to turn the alef into bet.
let patched = &format!("{target}/alefx");
let diff = diff(
&alef,
&bet,
&Params {
from: "a/alefx".into(),
to: (&format!("{target}/alefx")).into(),
from: patched.into(),
to: patched.into(),
context_count: 2,
..Default::default()
},
Expand Down Expand Up @@ -681,12 +684,13 @@ mod tests {
}
// This test diff is intentionally reversed.
// We want it to turn the alef into bet.
let alefr_path = &format!("{target}/alefr");
let diff = diff(
&alef,
&bet,
&Params {
from: "a/alefr".into(),
to: (&format!("{target}/alefr")).into(),
from: alefr_path.into(),
to: alefr_path.into(),
context_count: 2,
..Default::default()
},
Expand Down
25 changes: 15 additions & 10 deletions src/unified_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,12 +456,13 @@ mod tests {
}
// This test diff is intentionally reversed.
// We want it to turn the alef into bet.
let patched = &format!("{target}/alef");
let diff = diff(
&alef,
&bet,
&Params {
from: "a/alef".into(),
to: (&format!("{target}/alef")).into(),
from: patched.into(),
to: patched.into(),
context_count: 2,
..Default::default()
},
Expand Down Expand Up @@ -572,12 +573,13 @@ mod tests {
}
// This test diff is intentionally reversed.
// We want it to turn the alef into bet.
let patched = &format!("{target}/alefn");
let diff = diff(
&alef,
&bet,
&Params {
from: "a/alefn".into(),
to: (&format!("{target}/alefn")).into(),
from: patched.into(),
to: patched.into(),
context_count: 2,
..Default::default()
},
Expand Down Expand Up @@ -668,12 +670,13 @@ mod tests {
}
// This test diff is intentionally reversed.
// We want it to turn the alef into bet.
let patched = &format!("{target}/alef_");
let diff = diff(
&alef,
&bet,
&Params {
from: "a/alef_".into(),
to: (&format!("{target}/alef_")).into(),
from: patched.into(),
to: patched.into(),
context_count: 2,
..Default::default()
},
Expand Down Expand Up @@ -749,12 +752,13 @@ mod tests {
}
// This test diff is intentionally reversed.
// We want it to turn the alef into bet.
let patched = &format!("{target}/alefx");
let diff = diff(
&alef,
&bet,
&Params {
from: "a/alefx".into(),
to: (&format!("{target}/alefx")).into(),
from: patched.into(),
to: patched.into(),
context_count: 2,
..Default::default()
},
Expand Down Expand Up @@ -835,12 +839,13 @@ mod tests {
}
// This test diff is intentionally reversed.
// We want it to turn the alef into bet.
let patched = &format!("{target}/alefr");
let diff = diff(
&alef,
&bet,
&Params {
from: "a/alefr".into(),
to: (&format!("{target}/alefr")).into(),
from: patched.into(),
to: patched.into(),
context_count: 2,
..Default::default()
},
Expand Down
Loading