diff options
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/editfns-tests.el | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index 3073e371933..a3ea8ab60b5 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el | |||
| @@ -208,4 +208,35 @@ | |||
| 208 | '(error "Invalid format operation %$"))) | 208 | '(error "Invalid format operation %$"))) |
| 209 | (should (equal (format "%1$c %1$s" ?±) "± 177"))) | 209 | (should (equal (format "%1$c %1$s" ?±) "± 177"))) |
| 210 | 210 | ||
| 211 | (ert-deftest replace-buffer-contents-1 () | ||
| 212 | (with-temp-buffer | ||
| 213 | (insert #("source" 2 4 (prop 7))) | ||
| 214 | (let ((source (current-buffer))) | ||
| 215 | (with-temp-buffer | ||
| 216 | (insert "before dest after") | ||
| 217 | (let ((marker (set-marker (make-marker) 14))) | ||
| 218 | (save-restriction | ||
| 219 | (narrow-to-region 8 12) | ||
| 220 | (replace-buffer-contents source)) | ||
| 221 | (should (equal (marker-buffer marker) (current-buffer))) | ||
| 222 | (should (equal (marker-position marker) 16))) | ||
| 223 | (should (equal-including-properties | ||
| 224 | (buffer-string) | ||
| 225 | #("before source after" 9 11 (prop 7)))) | ||
| 226 | (should (equal (point) 9)))) | ||
| 227 | (should (equal-including-properties | ||
| 228 | (buffer-string) | ||
| 229 | #("source" 2 4 (prop 7)))))) | ||
| 230 | |||
| 231 | (ert-deftest replace-buffer-contents-2 () | ||
| 232 | (with-temp-buffer | ||
| 233 | (insert "foo bar baz qux") | ||
| 234 | (let ((source (current-buffer))) | ||
| 235 | (with-temp-buffer | ||
| 236 | (insert "foo BAR baz qux") | ||
| 237 | (replace-buffer-contents source) | ||
| 238 | (should (equal-including-properties | ||
| 239 | (buffer-string) | ||
| 240 | "foo bar baz qux")))))) | ||
| 241 | |||
| 211 | ;;; editfns-tests.el ends here | 242 | ;;; editfns-tests.el ends here |