Changeset - ab86188c7903
[Not reviewed]
0 2 0
Sergey Pashinin - 11 years ago 2014-08-26 16:38:49
sergey@pashinin.com
Serialization tests
2 files changed with 28 insertions and 24 deletions:
0 comments (0 inline, 0 general)
src/workgroups2.el
Show inline comments
 
@@ -1301,11 +1301,6 @@ If not - try to go to the parent dir and do the same."
 

	
 

	
 
;;; Objects
 

	
 
;; symbol
 
;; (wg-unpickel (wg-pickel 123))
 
;; (wg-unpickel (wg-pickel "table"))
 
;; (wg-unpickel (wg-pickel 'test))
 
(defun wg-pickel-symbol-serializer (symbol)
 
  "Return SYMBOL's serialization."
 
  (cond ((eq symbol t) t)
 
@@ -1318,8 +1313,6 @@ If not - try to go to the parent dir and do the same."
 

	
 

	
 
;; buffer
 
;; (wg-unpickel (wg-pickel (current-buffer)))
 
;; (wg-unpickel (wg-pickel (get-buffer org-agenda-buffer-name)))
 
(defun wg-pickel-buffer-serializer (buffer)
 
  "Return BUFFER's UID in workgroups buffer list."
 
  (list 'b (wg-add-buffer-to-buf-list buffer)))
 
@@ -1329,13 +1322,12 @@ If not - try to go to the parent dir and do the same."
 

	
 

	
 
;; marker
 
;; (wg-unpickel (wg-pickel (point-marker)))
 
(defun wg-pickel-marker-serializer (marker)
 
  "Return MARKERS's data."
 
  "Return MARKER's data."
 
  (list 'm (list (marker-position marker)
 
                 (wg-add-buffer-to-buf-list (marker-buffer marker)))))
 
(defun wg-pickel-deserialize-marker (data)
 
  "Return marker from it's data."
 
  "Return marker from it's DATA."
 
  (let ((m (make-marker)))
 
    (set-marker m (car data) (wg-pickel-deserialize-buffer (car (cdr data))))))
 

	
 
@@ -1415,16 +1407,12 @@ If not - try to go to the parent dir and do the same."
 
           (gethash table-id binds)))
 

	
 

	
 

	
 
;; TODO
 
(defun wg-pickel-window-configuration-serializer (wc)
 
  "Return Window configuration WC's serialization."
 
  (list 'wc 1))
 

	
 

	
 

	
 

	
 

	
 
(defun wg-pickel-serialize-objects (binds)
 
  "Return a list of serializations of the objects in BINDS."
 
  (let (result)
 
@@ -2613,7 +2601,7 @@ You can get these commands using `wg-get-org-agenda-view-commands'."
 
                                  (prog1 (term vars)
 
                                    (rename-buffer (wg-buf-name buffer) t)))))))
 

	
 
;; Python
 
;; `inferior-python-mode'
 
(wg-support 'inferior-python-mode 'python
 
            `((save . (python-shell-interpreter python-shell-interpreter-args))
 
              (deserialize . ,(lambda (buffer vars)
tests/workgroups2-tests.el
Show inline comments
 
@@ -14,6 +14,11 @@
 
;;  `(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")
 
@@ -86,20 +91,31 @@
 
    )
 
  )
 

	
 
(ert-deftest yyy-wg-save ()
 
  ;;(should-not (string-equal "initial_terminal" (terminal-name (selected-frame))))
 
  ;;(should-not (selected-frame))
 

	
 

	
 
  ;;(should-not (window-tree))
 
(ert-deftest 100-wg-save ()
 
  (should (= (length (frame-list)) 1))
 
  ;;(should (= (length (wg-all-buf-uids)) 2))
 
  ;; (length (wg-workgroup-list))
 
  ;; (wg-workgroup-name (wg-current-workgroup))
 
  (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
0 comments (0 inline, 0 general)