diff options
author | Andreas Gruenbacher <agruen@suse.de> | 2009-03-28 00:15:19 +0100 |
---|---|---|
committer | Andreas Gruenbacher <agruen@suse.de> | 2009-03-28 16:51:25 +0100 |
commit | 5a0fbfa88deeaea439976eead188f422057c1886 (patch) | |
tree | 1540736c70d6541675a83c195ec7ebb4f8d457ac | |
parent | 8a3f4d70e4093a649574cc7705161b36184ce898 (diff) | |
download | patch-5a0fbfa88deeaea439976eead188f422057c1886.tar.gz |
Add a test case for munged contex format diffs
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | Makefile.in | 3 | ||||
-rw-r--r-- | tests/munged-context-format | 37 |
3 files changed, 42 insertions, 1 deletions
@@ -26,6 +26,9 @@ * tests/backup-prefix-suffix: New test case. * Makefile.in (TESTS): Add test case. + * tests/munged-context-format: New test case. + * Makefile.in (TESTS): Add test case. + 2009-03-25 Andreas Gruenbacher <agruen@suse.de> * patch.c (main): Avoid replacing files when nothing has changed. diff --git a/Makefile.in b/Makefile.in index 4719448..37ac817 100644 --- a/Makefile.in +++ b/Makefile.in @@ -91,7 +91,8 @@ MISC = AUTHORS COPYING ChangeLog INSTALL Makefile.in NEWS README VERSION \ mkinstalldirs patch.man stdbool_.h tests/test-lib.sh \ update-version.sh TESTS = tests/backup-prefix-suffix tests/corrupt-reject-files \ - tests/crlf-handling tests/global-reject-files tests/need-filename \ + tests/crlf-handling tests/global-reject-files \ + tests/munged-context-format tests/need-filename \ tests/no-newline-triggers-assert tests/preserve-c-function-names \ tests/preserve-mode-and-timestamp tests/reject-format \ tests/remember-backup-files tests/remember-reject-files \ diff --git a/tests/munged-context-format b/tests/munged-context-format new file mode 100644 index 0000000..209ff80 --- /dev/null +++ b/tests/munged-context-format @@ -0,0 +1,37 @@ +# Copyright (C) 2009 Free Software Foundation, Inc. +# +# Copying and distribution of this file, with or without modification, +# in any medium, are permitted without royalty provided the copyright +# notice and this notice are preserved. + +# Be tolerant about munged whitespace in context format + +. $srcdir/test-lib.sh + +require_cat +use_local_patch +use_tmpdir + +# ============================================================== + +cat > ab.diff <<EOF +*** a 2009-03-27 23:32:33.000000000 +0100 +--- b 2009-03-27 23:32:40.000000000 +0100 +*************** +*** 1 **** +--- 1,2 ---- + one ++ two +EOF + +echo one > a +check 'patch < ab.diff' <<EOF +patching file a +EOF + +sed -e 's/^ / /' ab.diff > c.diff + +echo one > a +check 'patch < c.diff' <<EOF +patching file a +EOF |