From ae3793eb5d83ec5d3bef6c329bfb117ac8d9ab34 Mon Sep 17 00:00:00 2001 From: Dylan Hurd Date: Tue, 16 Dec 2025 22:40:22 -0800 Subject: [PATCH] chore(apply-patch) unicode scenario (#8141) ## Summary Adds a unicode scenario, and fills in files on failing scenarios to ensure directory state is unchanged, for completeness ## Testing - [x] only changes tests --- .../scenarios/005_rejects_empty_patch/expected/foo.txt | 1 + .../scenarios/005_rejects_empty_patch/input/foo.txt | 1 + .../007_rejects_missing_file_delete/expected/foo.txt | 1 + .../007_rejects_missing_file_delete/input/foo.txt | 1 + .../008_rejects_empty_update_hunk/expected/foo.txt | 1 + .../scenarios/008_rejects_empty_update_hunk/input/foo.txt | 1 + .../009_requires_existing_file_for_update/expected/foo.txt | 1 + .../009_requires_existing_file_for_update/input/foo.txt | 1 + .../012_delete_directory_fails/expected/dir/foo.txt | 1 + .../scenarios/012_delete_directory_fails/input/dir/foo.txt | 1 + .../013_rejects_invalid_hunk_header/expected/foo.txt | 1 + .../013_rejects_invalid_hunk_header/input/foo.txt | 1 + .../fixtures/scenarios/019_unicode_simple/expected/foo.txt | 3 +++ .../fixtures/scenarios/019_unicode_simple/input/foo.txt | 3 +++ .../tests/fixtures/scenarios/019_unicode_simple/patch.txt | 7 +++++++ 15 files changed, 25 insertions(+) create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/005_rejects_empty_patch/expected/foo.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/005_rejects_empty_patch/input/foo.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/007_rejects_missing_file_delete/expected/foo.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/007_rejects_missing_file_delete/input/foo.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/008_rejects_empty_update_hunk/expected/foo.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/008_rejects_empty_update_hunk/input/foo.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/009_requires_existing_file_for_update/expected/foo.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/009_requires_existing_file_for_update/input/foo.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/012_delete_directory_fails/expected/dir/foo.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/012_delete_directory_fails/input/dir/foo.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/013_rejects_invalid_hunk_header/expected/foo.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/013_rejects_invalid_hunk_header/input/foo.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/019_unicode_simple/expected/foo.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/019_unicode_simple/input/foo.txt create mode 100644 codex-rs/apply-patch/tests/fixtures/scenarios/019_unicode_simple/patch.txt diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/005_rejects_empty_patch/expected/foo.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/005_rejects_empty_patch/expected/foo.txt new file mode 100644 index 000000000..2bf5ad044 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/005_rejects_empty_patch/expected/foo.txt @@ -0,0 +1 @@ +stable diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/005_rejects_empty_patch/input/foo.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/005_rejects_empty_patch/input/foo.txt new file mode 100644 index 000000000..2bf5ad044 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/005_rejects_empty_patch/input/foo.txt @@ -0,0 +1 @@ +stable diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/007_rejects_missing_file_delete/expected/foo.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/007_rejects_missing_file_delete/expected/foo.txt new file mode 100644 index 000000000..2bf5ad044 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/007_rejects_missing_file_delete/expected/foo.txt @@ -0,0 +1 @@ +stable diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/007_rejects_missing_file_delete/input/foo.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/007_rejects_missing_file_delete/input/foo.txt new file mode 100644 index 000000000..2bf5ad044 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/007_rejects_missing_file_delete/input/foo.txt @@ -0,0 +1 @@ +stable diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/008_rejects_empty_update_hunk/expected/foo.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/008_rejects_empty_update_hunk/expected/foo.txt new file mode 100644 index 000000000..2bf5ad044 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/008_rejects_empty_update_hunk/expected/foo.txt @@ -0,0 +1 @@ +stable diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/008_rejects_empty_update_hunk/input/foo.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/008_rejects_empty_update_hunk/input/foo.txt new file mode 100644 index 000000000..2bf5ad044 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/008_rejects_empty_update_hunk/input/foo.txt @@ -0,0 +1 @@ +stable diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/009_requires_existing_file_for_update/expected/foo.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/009_requires_existing_file_for_update/expected/foo.txt new file mode 100644 index 000000000..2bf5ad044 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/009_requires_existing_file_for_update/expected/foo.txt @@ -0,0 +1 @@ +stable diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/009_requires_existing_file_for_update/input/foo.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/009_requires_existing_file_for_update/input/foo.txt new file mode 100644 index 000000000..2bf5ad044 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/009_requires_existing_file_for_update/input/foo.txt @@ -0,0 +1 @@ +stable diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/012_delete_directory_fails/expected/dir/foo.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/012_delete_directory_fails/expected/dir/foo.txt new file mode 100644 index 000000000..2bf5ad044 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/012_delete_directory_fails/expected/dir/foo.txt @@ -0,0 +1 @@ +stable diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/012_delete_directory_fails/input/dir/foo.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/012_delete_directory_fails/input/dir/foo.txt new file mode 100644 index 000000000..2bf5ad044 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/012_delete_directory_fails/input/dir/foo.txt @@ -0,0 +1 @@ +stable diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/013_rejects_invalid_hunk_header/expected/foo.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/013_rejects_invalid_hunk_header/expected/foo.txt new file mode 100644 index 000000000..2bf5ad044 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/013_rejects_invalid_hunk_header/expected/foo.txt @@ -0,0 +1 @@ +stable diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/013_rejects_invalid_hunk_header/input/foo.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/013_rejects_invalid_hunk_header/input/foo.txt new file mode 100644 index 000000000..2bf5ad044 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/013_rejects_invalid_hunk_header/input/foo.txt @@ -0,0 +1 @@ +stable diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/019_unicode_simple/expected/foo.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/019_unicode_simple/expected/foo.txt new file mode 100644 index 000000000..99d5a6e9c --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/019_unicode_simple/expected/foo.txt @@ -0,0 +1,3 @@ +line1 +naïve café ✅ +line3 diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/019_unicode_simple/input/foo.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/019_unicode_simple/input/foo.txt new file mode 100644 index 000000000..b17094871 --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/019_unicode_simple/input/foo.txt @@ -0,0 +1,3 @@ +line1 +naïve café +line3 diff --git a/codex-rs/apply-patch/tests/fixtures/scenarios/019_unicode_simple/patch.txt b/codex-rs/apply-patch/tests/fixtures/scenarios/019_unicode_simple/patch.txt new file mode 100644 index 000000000..9514207fd --- /dev/null +++ b/codex-rs/apply-patch/tests/fixtures/scenarios/019_unicode_simple/patch.txt @@ -0,0 +1,7 @@ +*** Begin Patch +*** Update File: foo.txt +@@ + line1 +-naïve café ++naïve café ✅ +*** End Patch