summaryrefslogtreecommitdiff
path: root/usr.bin/patch/tests
Commit message (Collapse)AuthorAgeFilesLines
* patch(1): give /dev/null patches special treatmentKyle Evans2019-11-041-8/+9
| | | | | | | | | | | | | | | | We have a bad habit of duplicating contents of files that are sourced from /dev/null and applied more than once... take the more sane (in most ways) GNU route and complain if the file exists and offer reversal options. This still falls short a little bit as selecting "don't reverse, apply anyway" will still give you duplicated file contents. There's probably other issues as well, but awareness is the first step to happiness. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D21535 Notes: svn path=/head/; revision=354328
* patch(1): fix the file removal test, strengthen it a bitKyle Evans2019-09-051-2/+13
| | | | | | | | | | | To remain compatible with GNU patch, we should ensure that once we're removing empty files after a reversed /dev/null patch we don't remove files that have been modified. GNU patch leaves these intact and just reverses the hunk that created the file, effectively implying --remove-empty-files for reversed /dev/null patches. Notes: svn path=/head/; revision=351866
* patch(1): add some basic testsKyle Evans2019-09-056-0/+178
Summary: - basic: test application of patches created by diff -u at the beginning/middle/end of file, which have differing amounts of context before and after chunks being added - limited_ctx: stems from PR 74127 in which a rogue line was getting added when the patch should have been rejected. Similar behavior was reproducible with larger contexts near the beginning/end of a file. See r326084 for details - file_creation: patch sourced from /dev/null should create the file - file_nodupe: said patch sourced from /dev/null shouldn't dupe the contents when re-applied (personal vendetta, WIP, see comment) - file_removal: this follows from nodupe; the reverse of a patch sourced from /dev/null is most naturally deleting the file, as is expected based on GNU patch behavior (WIP) Notes: svn path=/head/; revision=351836