[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master fd6ec8e 25/57: Test that both buffers are correct by defau
From: |
Justin Burkett |
Subject: |
[elpa] master fd6ec8e 25/57: Test that both buffers are correct by default |
Date: |
Tue, 3 Nov 2020 14:32:21 -0500 (EST) |
branch: master
commit fd6ec8e00bdad86e3ead4116da1ce2617346e333
Author: Justin Burkett <justin@burkett.cc>
Commit: Justin Burkett <justin@burkett.cc>
Test that both buffers are correct by default
---
vdiff-test.el | 35 ++++++++++++++++++-----------------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/vdiff-test.el b/vdiff-test.el
index 9bb4a41..fa03a3f 100644
--- a/vdiff-test.el
+++ b/vdiff-test.el
@@ -23,10 +23,8 @@
(require 'ert)
(require 'vdiff)
-(defun vdiff-test-buffer-string ()
- (replace-regexp-in-string "\n" "|" (buffer-string)))
-
-(defmacro vdiff-test-with-buffers (a-string b-string &rest body)
+(defmacro vdiff-test-with-buffers
+ (a-string b-string operation final-a-string final-b-string)
`(let ((buffer-a (get-buffer-create "vdiff-tests-buffer-a"))
(buffer-b (get-buffer-create "vdiff-tests-buffer-b"))
(vdiff--testing-mode t))
@@ -39,7 +37,13 @@
(erase-buffer)
(insert ,(replace-regexp-in-string "|" "\n" b-string)))
(vdiff-buffers buffer-a buffer-b nil nil nil t)
- ,@body)
+ ,operation
+ (with-current-buffer buffer-a
+ (should (string= (buffer-string)
+ ,(replace-regexp-in-string "|" "\n"
final-a-string))))
+ (with-current-buffer buffer-b
+ (should (string= (buffer-string)
+ ,(replace-regexp-in-string "|" "\n"
final-b-string)))))
(with-current-buffer buffer-a
(vdiff-quit)))))
@@ -89,18 +93,16 @@
(goto-char (point-min))
(call-interactively 'vdiff-next-hunk)
(call-interactively 'vdiff-send-changes))
- (with-current-buffer buffer-b
- (should (string= (vdiff-test-buffer-string)
- "1|2|3|4|5|6|8|8|9|10|"))))
+ "1|2|3|4|5|6|7|8|9|10|"
+ "1|2|3|4|5|6|8|8|9|10|")
;; Test sending everything
(vdiff-test-with-buffers
"1|2|3|4|5|6|7|8|9|10|"
"1|2|4|4|5|6|8|8|9|10|"
(with-current-buffer buffer-a
(vdiff-send-changes (point-min) (point-max)))
- (with-current-buffer buffer-b
- (should (string= (vdiff-test-buffer-string)
- "1|2|3|4|5|6|7|8|9|10|")))))
+ "1|2|3|4|5|6|7|8|9|10|"
+ "1|2|3|4|5|6|7|8|9|10|"))
(ert-deftest vdiff-test-receiving ()
"Test receiving changes."
@@ -111,18 +113,17 @@
(with-current-buffer buffer-b
(goto-char (point-min))
(call-interactively 'vdiff-next-hunk)
- (call-interactively 'vdiff-receive-changes)
- (should (string= (vdiff-test-buffer-string)
- "1|2|3|4|5|6|8|8|9|10|"))))
+ (call-interactively 'vdiff-receive-changes))
+ "1|2|3|4|5|6|7|8|9|10|"
+ "1|2|3|4|5|6|8|8|9|10|")
;; Test receiving everything
(vdiff-test-with-buffers
"1|2|3|4|5|6|7|8|9|10|"
"1|2|4|4|5|6|8|8|9|10|"
(with-current-buffer buffer-b
(vdiff-receive-changes (point-min) (point-max)))
- (with-current-buffer buffer-b
- (should (string= (vdiff-test-buffer-string)
- "1|2|3|4|5|6|7|8|9|10|")))))
+ "1|2|3|4|5|6|7|8|9|10|"
+ "1|2|3|4|5|6|7|8|9|10|"))
(provide 'vdiff-test)
- [elpa] master c1525a8 05/57: Fix problems with diff -u parser at beg and end of file, (continued)
- [elpa] master c1525a8 05/57: Fix problems with diff -u parser at beg and end of file, Justin Burkett, 2020/11/03
- [elpa] master 0312ac8 06/57: Update copyright years, Justin Burkett, 2020/11/03
- [elpa] master bc5e1a7 07/57: Remove debugging message, Justin Burkett, 2020/11/03
- [elpa] master b15b020 10/57: Add diff --minimal as algorithm and fix case args for git, Justin Burkett, 2020/11/03
- [elpa] master 992d07b 14/57: Add travis support, Justin Burkett, 2020/11/03
- [elpa] master 0bfb259 11/57: Add vdiff-debug flag, Justin Burkett, 2020/11/03
- [elpa] master 106a69f 20/57: Fix previous tests for Travis, Justin Burkett, 2020/11/03
- [elpa] master c803bd6 17/57: Add warnings for obsolete variables, Justin Burkett, 2020/11/03
- [elpa] master 5f7d3fd 22/57: Add Travis badge, Justin Burkett, 2020/11/03
- [elpa] master 348d1a7 27/57: Add after-quit arg to vdiff-test-with-buffers, Justin Burkett, 2020/11/03
- [elpa] master fd6ec8e 25/57: Test that both buffers are correct by default,
Justin Burkett <=
- [elpa] master 45666cc 30/57: README: evil-collection adds vimdiff-like bindings, Justin Burkett, 2020/11/03
- [elpa] master 6878093 33/57: Add vdiff-toggle-fold and vdiff-toggle-all-folds, Justin Burkett, 2020/11/03
- [elpa] master ccc773b 39/57: Add optional to-buffer arg to vdiff--translate line, Justin Burkett, 2020/11/03
- [elpa] master 58d530b 53/57: Add vdiff-temp-files, Justin Burkett, 2020/11/03
- [elpa] master c732247 45/57: Reset truncate-lines on cleanup, Justin Burkett, 2020/11/03
- [elpa] master 61d29bb 54/57: Travis -> github workflow, Justin Burkett, 2020/11/03
- [elpa] master eb553fa 09/57: Add support for different diff algorithms, Justin Burkett, 2020/11/03
- [elpa] master 8f3fa10 15/57: Fix Makefile typo, Justin Burkett, 2020/11/03
- [elpa] master 5667bc6 16/57: Ensure input files to diff end in newline, Justin Burkett, 2020/11/03
- [elpa] master 110d672 12/57: Cleanup diff parsing function, Justin Burkett, 2020/11/03