Trim whitespace when validating '*** Begin Patch'/'*** End Patch' markers in codex-apply-patch so padded marker lines parse as intended, and add regression coverage (unit + fixture scenario); this avoids apply_patch failures when models include extra spacing. Tested with cargo test -p codex-apply-patch. |
||
|---|---|---|
| .. | ||
| 001_add_file | ||
| 002_multiple_operations | ||
| 003_multiple_chunks | ||
| 004_move_to_new_directory | ||
| 005_rejects_empty_patch | ||
| 006_rejects_missing_context | ||
| 007_rejects_missing_file_delete | ||
| 008_rejects_empty_update_hunk | ||
| 009_requires_existing_file_for_update | ||
| 010_move_overwrites_existing_destination | ||
| 011_add_overwrites_existing_file | ||
| 012_delete_directory_fails | ||
| 013_rejects_invalid_hunk_header | ||
| 014_update_file_appends_trailing_newline | ||
| 015_failure_after_partial_success_leaves_changes | ||
| 016_pure_addition_update_chunk | ||
| 017_whitespace_padded_hunk_header | ||
| 018_whitespace_padded_patch_markers | ||
| 019_unicode_simple | ||
| 020_delete_file_success | ||
| 020_whitespace_padded_patch_marker_lines | ||
| 021_update_file_deletion_only | ||
| 022_update_file_end_of_file_marker | ||
| .gitattributes | ||
| README.md | ||
Overview
This directory is a collection of end to end tests for the apply-patch specification, meant to be easily portable to other languages or platforms.
Specification
Each test case is one directory, composed of input state (input/), the patch operation (patch.txt), and the expected final state (expected/). This structure is designed to keep tests simple (i.e. test exactly one patch at a time) while still providing enough flexibility to test any given operation across files.
Here's what this would look like for a simple test apply-patch test case to create a new file:
001_add/
input/
foo.md
expected/
foo.md
bar.md
patch.txt