summaryrefslogtreecommitdiff
path: root/tests/test-clear-blank-lines.el.disabled
blob: 2190aba005def05849ef619c9cbb976e517d62f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
;;; test-clear-blank-lines.el ---  -*- lexical-binding: t; -*-

;;; Commentary:
;;

;;; Code:

(require 'ert)
(add-to-list 'load-path (concat user-emacs-directory "modules"))
(require 'custom-functions)

(ert-deftest test-cj/clear-blank-lines-region ()
  (let ((testdata "Some\n\n\n\nText")
		(expected  "Some\nText")
		(actual))
	(with-temp-buffer
	  (insert testdata)
	  (cj/clear-blank-lines (point-min) (point-max))
	  (setq actual (buffer-string))
	  (message "buffer is:\n'%s'" actual)
	  (should (string= actual expected)))))

(ert-deftest test-cj/clear-blank-lines-region-multiple-lines ()
  (let ((testdata "Some\n\n\n\nText")
		(expected "Some\n\n\n\nText")
		(midpoint)
		(actual))
	(with-temp-buffer
	  (insert testdata)
	  (insert "\n")
	  (setq midpoint (point))
	  (insert testdata)
      (cj/clear-blank-lines (point-min) midpoint)
      (setq actual (buffer-substring (- (point-max)
                                        (length testdata)) (point-max)))
      (message "buffer is:\n'%s'" (buffer-string))
	  (should (string= actual expected)))))

(ert-deftest test-cj/clear-blank-lines-negative ()
  (with-temp-buffer
	(insert "Some\nText")
	(cj/clear-blank-lines (point-min) (point-max))
	(should (equal (buffer-string) "Some\nText"))))


(provide 'test-clear-blank-lines)
;;; test-clear-blank-lines.el ends here.