pub fn generate_patch(original: &str, modified: &str, label: &str) -> StringExpand description
Generate a unified diff of original → modified. Empty string if identical.
All output lines are guaranteed to end with ‘\n’.
Format: --- a/{label} / +++ b/{label}, 3 lines of context.
use skillfile_core::patch::generate_patch;
// Identical content produces no patch
assert_eq!(generate_patch("hello\n", "hello\n", "test.md"), "");
// Different content produces a unified diff
let patch = generate_patch("old\n", "new\n", "test.md");
assert!(patch.contains("--- a/test.md"));
assert!(patch.contains("+++ b/test.md"));