From 24f9fabbf5ecfaee0f8a1763528514d3a2f3aa7c Mon Sep 17 00:00:00 2001 From: Dylan Hurd Date: Mon, 5 Jan 2026 15:56:38 -0800 Subject: [PATCH] chore(apply-patch) additional scenarios (#8230) ## Summary More apply-patch scenarios ## Testing - [x] This pr only adds tests --- .../scenarios/020_delete_file_success/expected/keep.txt | 1 + .../scenarios/020_delete_file_success/input/keep.txt | 1 + .../scenarios/020_delete_file_success/input/obsolete.txt | 1 + .../fixtures/scenarios/020_delete_file_success/patch.txt | 3 +++ .../021_update_file_deletion_only/expected/lines.txt | 2 ++ .../021_update_file_deletion_only/input/lines.txt | 3 +++ .../scenarios/021_update_file_deletion_only/patch.txt | 7 +++++++ .../022_update_file_end_of_file_marker/expected/tail.txt | 2 ++ .../022_update_file_end_of_file_marker/input/tail.txt | 2 ++ .../022_update_file_end_of_file_marker/patch.txt | 8 ++++++++ 10 files changed, 30 insertions(+) create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/020_delete_file_success/expected/keep.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/020_delete_file_success/input/keep.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/020_delete_file_success/input/obsolete.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/020_delete_file_success/patch.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/021_update_file_deletion_only/expected/lines.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/021_update_file_deletion_only/input/lines.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/021_update_file_deletion_only/patch.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/022_update_file_end_of_file_marker/expected/tail.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/022_update_file_end_of_file_marker/input/tail.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/022_update_file_end_of_file_marker/patch.txt diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/020_delete_file_success/expected/keep.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/020_delete_file_success/expected/keep.txt new file mode 100644 index 0000000000..2fa992c0b8 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/020_delete_file_success/expected/keep.txt @@ -0,0 +1 @@ +keep diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/020_delete_file_success/input/keep.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/020_delete_file_success/input/keep.txt new file mode 100644 index 0000000000..2fa992c0b8 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/020_delete_file_success/input/keep.txt @@ -0,0 +1 @@ +keep diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/020_delete_file_success/input/obsolete.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/020_delete_file_success/input/obsolete.txt new file mode 100644 index 0000000000..6e263abce1 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/020_delete_file_success/input/obsolete.txt @@ -0,0 +1 @@ +obsolete diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/020_delete_file_success/patch.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/020_delete_file_success/patch.txt new file mode 100644 index 0000000000..5978f73889 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/020_delete_file_success/patch.txt @@ -0,0 +1,3 @@ +*** Begin Patch +*** Delete File: obsolete.txt +*** End Patch diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/021_update_file_deletion_only/expected/lines.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/021_update_file_deletion_only/expected/lines.txt new file mode 100644 index 0000000000..8129d305c8 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/021_update_file_deletion_only/expected/lines.txt @@ -0,0 +1,2 @@ +line1 +line3 diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/021_update_file_deletion_only/input/lines.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/021_update_file_deletion_only/input/lines.txt new file mode 100644 index 0000000000..83db48f84e --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/021_update_file_deletion_only/input/lines.txt @@ -0,0 +1,3 @@ +line1 +line2 +line3 diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/021_update_file_deletion_only/patch.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/021_update_file_deletion_only/patch.txt new file mode 100644 index 0000000000..860c6c9a99 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/021_update_file_deletion_only/patch.txt @@ -0,0 +1,7 @@ +*** Begin Patch +*** Update File: lines.txt +@@ + line1 +-line2 + line3 +*** End Patch diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/022_update_file_end_of_file_marker/expected/tail.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/022_update_file_end_of_file_marker/expected/tail.txt new file mode 100644 index 0000000000..87463f92d7 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/022_update_file_end_of_file_marker/expected/tail.txt @@ -0,0 +1,2 @@ +first +second updated diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/022_update_file_end_of_file_marker/input/tail.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/022_update_file_end_of_file_marker/input/tail.txt new file mode 100644 index 0000000000..66a52ee7a1 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/022_update_file_end_of_file_marker/input/tail.txt @@ -0,0 +1,2 @@ +first +second diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/022_update_file_end_of_file_marker/patch.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/022_update_file_end_of_file_marker/patch.txt new file mode 100644 index 0000000000..8b16b5bd9e --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/022_update_file_end_of_file_marker/patch.txt @@ -0,0 +1,8 @@ +*** Begin Patch +*** Update File: tail.txt +@@ + first +-second ++second updated +*** End of File +*** End Patch