Files
@ ab86188c7903
Branch filter:
Location: workgroups2/tests/workgroups2-tests.el
ab86188c7903
3.4 KiB
text/x-elisp
Serialization tests
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | ;;; workgroups2-tests.el --- Try something here
;;; Commentary:
;;; Code:
(require 'cl)
(require 'ert)
(require 'f)
(load-file (concat (file-name-directory load-file-name) "ert-my-utils.el"))
(require 'workgroups2)
;;(defmacro w-all-buf-uids (value)
;; "Test `wg-all-buf-uids'."
;; (declare (indent 2))
;; `(progn
;; (defface ,face ,spec ,doc ,@args)))
(defmacro test-pickel (value)
"Test `wg-pickel' `wg-unpickel' on VALUE."
`(progn
(wg-unpickel (wg-pickel ,value))))
(ert-deftest 000-initial ()
;;(make-frame)
(if (file-exists-p "/tmp/wg-tests.log")
(delete-file "/tmp/wg-tests.log"))
(if (file-exists-p "/tmp/wg-test")
(delete-file "/tmp/wg-test"))
;;(should-not (string-equal "initial_terminal" (terminal-name (selected-frame))))
(should (boundp workgroups-mode))
(should-not workgroups-mode)
(should wg-session-load-on-start))
(ert-deftest 010-activate ()
;;(if (file-exists-p "/tmp/wg-test")
;; (delete-file "/tmp/wg-test"))
(setq wg-session-file "/tmp/wg-test")
;;(setq wg-session-load-on-start nil)
(workgroups-mode 1)
(should workgroups-mode)
(should (string= (wg-get-session-file) "/tmp/wg-test")))
(ert-deftest 020-modeline-string ()
(should (string= (wg-mode-line-string) " (First workgroup:--)"))
(setq wg-mode-line-decor-left-brace "["
wg-mode-line-decor-right-brace "]")
(should (string= (wg-mode-line-string) " [First workgroup:--]"))
(setq wg-flag-modified nil)
(should (string= (wg-mode-line-string) " [First workgroup]"))
(setq wg-flag-modified t)
)
(ert-deftest 030-wg-utils ()
(should (= (length (wg-all-buf-uids)) 1))
(should (wg-frame-to-wconfig))
)
(ert-deftest 040-wg-still-active ()
(should workgroups-mode))
(ert-deftest 050-modify ()
(split-window-vertically)
(switch-to-buffer "*Messages*")
;; Check 2 buffers
;;(should-not (window-tree))
;;(should-not (wg-window-tree-to-wtree))
;;(should (= (length (wg-all-buf-uids)) 2))
;;(should-not (wg-current-workgroup))
(unless (string-equal "initial_terminal" (terminal-name (selected-frame)))
(should (wg-session-modified (wg-current-session))))
)
(ert-deftest 055-structs ()
(let* ((s (wg-current-session))
(wgs (wg-session-workgroup-list s))
(wg1 (car wgs))
(bufs (wg-session-buf-list s)))
(should s)
;;(should (wg-session-modified s))
(should wgs)
(should (string= "First workgroup" (wg-workgroup-name wg1)))
(should bufs)
)
;;(should-not (wg-current-wconfig))
;; wtree
(let ((wtree (wg-window-tree-to-wtree)))
(should wtree)
(should-not (boundp 'window-tree))
;;(should (string= (wg-wtree-dir wtree) "a"))
;;(should-not (wg-wtree-wlist wtree))
)
)
(ert-deftest 100-wg-save ()
(should (= (length (frame-list)) 1))
(wg-save-session)
(should-not (wg-session-modified (wg-current-session)))
(unless (string-equal "initial_terminal" (terminal-name (selected-frame)))
(unless (file-exists-p "/tmp/wg-test")
(error "WG session file wasn't created"))))
(ert-deftest 110-wg-pickel ()
(test-pickel 123)
(test-pickel "str")
(test-pickel 'symbol)
(test-pickel (current-buffer))
;; (get-buffer org-agenda-buffer-name)
(test-pickel (point-marker))
;; TODO:
;;(test-pickel (current-window-configuration))
)
;;(ert-deftest 300-inferior-python-mode ()
;; (delete-other-windows)
;; (switch-to-buffer wg-default-buffer)
;; )
(provide 'workgroups2-tests)
;;; workgroups2-tests.el ends here
|