aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lisp/makesum-tests.el58
1 files changed, 58 insertions, 0 deletions
diff --git a/test/lisp/makesum-tests.el b/test/lisp/makesum-tests.el
new file mode 100644
index 00000000000..09661593c62
--- /dev/null
+++ b/test/lisp/makesum-tests.el
@@ -0,0 +1,58 @@
1;;; makesum-tests.el --- Tests for makesum.el -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2019 Free Software Foundation, Inc.
4
5;; Author: Simen Heggestøyl <simenheg@gmail.com>
6;; Keywords:
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
22
23;;; Commentary:
24
25;;
26
27;;; Code:
28
29(require 'ert)
30(require 'makesum)
31
32(ert-deftest makesum-tests-double-column-even-lines ()
33 (with-temp-buffer
34 (insert "a\nb\nc\nd\ne\nf")
35 (double-column (point-min) (point-max))
36 (should (string-match-p "a[ \t]+d\nb[ \t]+e\nc[ \t]+f" (buffer-string)))))
37
38(ert-deftest makesum-tests-double-column-odd-lines ()
39 (with-temp-buffer
40 (insert "a\nb\nc\nd\ne")
41 (double-column (point-min) (point-max))
42 (should (string-match-p "a[ \t]+d\nb[ \t]+e\nc" (buffer-string)))))
43
44(ert-deftest makesum-tests-double-column-noop ()
45 (with-temp-buffer
46 (insert "foo")
47 (let ((prev-buffer-string (buffer-string)))
48 (double-column (point-min) (point-max))
49 (should (equal prev-buffer-string (buffer-string))))))
50
51(ert-deftest makesum-tests-double-column-partial ()
52 (with-temp-buffer
53 (insert "a\nb\nc\nd\ne\nf")
54 (double-column 3 10)
55 (should (string-match-p "a\nb[ \t]+d\nc[ \t]+e\nf" (buffer-string)))))
56
57(provide 'makesum-tests)
58;;; makesum-tests.el ends here