aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNickolas Lloyd2017-02-01 22:31:55 -0500
committerNickolas Lloyd2017-02-01 22:31:55 -0500
commit9a15b5509abb49a11c97c1101ad216f4ef258368 (patch)
tree7311337d92833cb8f233eaa696a967a15a306a80 /test
parent5d8f2548ceaa5a0b33c08a39f1d6c11071ec63aa (diff)
parent70d36dda26465b43c1a63e8e13153e070af86456 (diff)
downloademacs-nick.lloyd-bytecode-jit.tar.gz
emacs-nick.lloyd-bytecode-jit.zip
Merge branch 'master' into nick.lloyd-bytecode-jitnick.lloyd-bytecode-jit
Diffstat (limited to 'test')
-rw-r--r--test/lisp/vc/diff-mode-tests.el203
1 files changed, 203 insertions, 0 deletions
diff --git a/test/lisp/vc/diff-mode-tests.el b/test/lisp/vc/diff-mode-tests.el
new file mode 100644
index 00000000000..807a411fa5d
--- /dev/null
+++ b/test/lisp/vc/diff-mode-tests.el
@@ -0,0 +1,203 @@
1;; Copyright (C) 2017 Free Software Foundation, Inc
2
3;; Author: Dima Kogan <dima@secretsauce.net>
4;; Maintainer: emacs-devel@gnu.org
5
6;; This file is part of GNU Emacs.
7
8;; GNU Emacs is free software: you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation, either version 3 of the License, or
11;; (at your option) any later version.
12
13;; GNU Emacs is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;; GNU General Public License for more details.
17
18;; You should have received a copy of the GNU General Public License
19;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
20
21;;; Code:
22
23(require 'diff-mode)
24
25
26(ert-deftest diff-mode-test-ignore-trailing-dashes ()
27 "Check to make sure we successfully ignore trailing -- made by
28'git format-patch'. This is bug #9597"
29
30 ;; I made a test repo, put some files in it, made arbitrary changes
31 ;; and invoked 'git format-patch' to get a patch out of it. The
32 ;; patch and the before and after versions of the files appear here.
33 ;; The test simply tries to apply the patch. The patch contains
34 ;; trailing --, which confused diff-mode previously
35 (let ((patch "From 18ed35640be496647e0a02fc155b4ee4a0490eca Mon Sep 17 00:00:00 2001
36From: Dima Kogan <dima@secretsauce.net>
37Date: Mon, 30 Jan 2017 22:24:13 -0800
38Subject: [PATCH] test commit
39
40---
41 fil | 3 ---
42 fil2 | 4 ----
43 2 files changed, 7 deletions(-)
44
45diff --git a/fil b/fil
46index 10344f1..2a56245 100644
47--- a/fil
48+++ b/fil
49@@ -2,10 +2,8 @@ Afrocentrism
50 Americanisms
51 Americanization
52 Americanizations
53-Americanized
54 Americanizes
55 Americanizing
56-Andrianampoinimerina
57 Anglicanisms
58 Antananarivo
59 Apalachicola
60@@ -15,6 +13,5 @@ Aristophanes
61 Aristotelian
62 Ashurbanipal
63 Australopithecus
64-Austronesian
65 Bangladeshis
66 Barquisimeto
67diff --git a/fil2 b/fil2
68index 8858f0d..86e8ea5 100644
69--- a/fil2
70+++ b/fil2
71@@ -1,20 +1,16 @@
72 whippoorwills
73 whitewashing
74 wholehearted
75-wholeheartedly
76 wholesomeness
77 wildernesses
78 windbreakers
79 wisecracking
80 withstanding
81-woodcarvings
82 woolgathering
83 workstations
84 worthlessness
85 wretchedness
86 wristwatches
87-wrongfulness
88 wrongheadedly
89 wrongheadedness
90-xylophonists
91 youthfulness
92--
932.11.0
94
95")
96 (fil_before "Afrocentrism
97Americanisms
98Americanization
99Americanizations
100Americanized
101Americanizes
102Americanizing
103Andrianampoinimerina
104Anglicanisms
105Antananarivo
106Apalachicola
107Appalachians
108Argentinians
109Aristophanes
110Aristotelian
111Ashurbanipal
112Australopithecus
113Austronesian
114Bangladeshis
115Barquisimeto
116")
117 (fil_after "Afrocentrism
118Americanisms
119Americanization
120Americanizations
121Americanizes
122Americanizing
123Anglicanisms
124Antananarivo
125Apalachicola
126Appalachians
127Argentinians
128Aristophanes
129Aristotelian
130Ashurbanipal
131Australopithecus
132Bangladeshis
133Barquisimeto
134")
135 (fil2_before "whippoorwills
136whitewashing
137wholehearted
138wholeheartedly
139wholesomeness
140wildernesses
141windbreakers
142wisecracking
143withstanding
144woodcarvings
145woolgathering
146workstations
147worthlessness
148wretchedness
149wristwatches
150wrongfulness
151wrongheadedly
152wrongheadedness
153xylophonists
154youthfulness
155")
156 (fil2_after "whippoorwills
157whitewashing
158wholehearted
159wholesomeness
160wildernesses
161windbreakers
162wisecracking
163withstanding
164woolgathering
165workstations
166worthlessness
167wretchedness
168wristwatches
169wrongheadedly
170wrongheadedness
171youthfulness
172")
173 (temp-dir (make-temp-file "diff-mode-test" 'dir)))
174
175 (let ((buf (find-file-noselect (format "%s/%s" temp-dir "fil" )))
176 (buf2 (find-file-noselect (format "%s/%s" temp-dir "fil2"))))
177 (unwind-protect
178 (progn
179 (with-current-buffer buf (insert fil_before) (save-buffer))
180 (with-current-buffer buf2 (insert fil2_before) (save-buffer))
181
182 (with-temp-buffer
183 (cd temp-dir)
184 (insert patch)
185 (beginning-of-buffer)
186 (diff-apply-hunk)
187 (diff-apply-hunk)
188 (diff-apply-hunk))
189
190 (should (equal (with-current-buffer buf (buffer-string))
191 fil_after))
192 (should (equal (with-current-buffer buf2 (buffer-string))
193 fil2_after)))
194
195 (ignore-errors
196 (with-current-buffer buf (set-buffer-modified-p nil))
197 (kill-buffer buf)
198 (with-current-buffer buf2 (set-buffer-modified-p nil))
199 (kill-buffer buf2)
200 (delete-directory temp-dir 'recursive))))))
201
202
203(provide 'diff-mode-tests)