Changeset - fe983eb1b1d2
[Not reviewed]
0 2 0
Sergey Pashinin - 11 years ago 2014-08-31 20:17:19
sergey@pashinin.com
1 more test
2 files changed with 52 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/workgroups2.el
Show inline comments
 
@@ -4199,10 +4199,11 @@ nil otherwise."
 
            (wg-workgroup-selected-frame-wconfig workgroup) nil)))
 

	
 
  ;; Garbage collection
 
  (let ((all-buf-uids (wg-all-buf-uids)))
 
    (wg-asetf (wg-buf-list)
 
              (cl-remove-if-not (lambda (uid) (member uid all-buf-uids)) it
 
                                :key 'wg-buf-uid)))
 
  ;; https://github.com/pashinin/workgroups2/issues/48
 
  ;;(let ((all-buf-uids (wg-all-buf-uids)))
 
  ;;  (wg-asetf (wg-buf-list)
 
  ;;            (cl-remove-if-not (lambda (uid) (member uid all-buf-uids)) it
 
  ;;                              :key 'wg-buf-uid)))
 
  (mapc 'wg-workgroup-gc-buf-uids (wg-workgroup-list))  ; Remove buf uids that have no referent in `wg-buf-list'
 
  (mapc 'wg-update-buffer-in-buf-list (wg-buffer-list-emacs)))
 

	
tests/workgroups2-tests.el
Show inline comments
 
@@ -154,18 +154,25 @@
 
  )
 

	
 
(ert-deftest 310-frames ()
 
  ;; Create some frames
 
  (should wg-control-frames)
 
  (make-frame)
 
  (make-frame)
 
  (should (wg-modified-p))
 
  (should (= (length (frame-list)) 3))
 
  (should workgroups-mode)
 

	
 
  ;; Save
 
  (let (message-log-max)
 
    (wg-save-session))
 

	
 
  ;; Reset to 1 frame
 
  (should-not (wg-session-modified (wg-current-session)))
 
  (should (= (length (wg-session-parameter 'frame-list)) 2))
 
  (delete-other-frames)
 
  (should (= (length (frame-list)) 1))
 

	
 
  ;; Restore frames
 
  (wg-reload-session)
 
  ;;(should (= (length (wg-session-parameter 'frame-list)) 2))
 
  (should (= (length (frame-list)) 3))
 
@@ -173,5 +180,45 @@
 
  (let (message-log-max)
 
    (wg-save-session)))
 

	
 

	
 

	
 
;; Bugs
 

	
 
;; https://github.com/pashinin/workgroups2/issues/48
 
(ert-deftest 500-bug-48 ()
 
  ;; Create a bunch of files for 2 workgroups
 
  (make-directory "/tmp/wg1" t)
 
  (make-directory "/tmp/wg2" t)
 
  (dotimes (i 20)
 
    (let ((file (format "/tmp/wg1/file_%.2d.\n" (1+ i))))
 
      (unless (file-exists-p file)
 
        (write-file file))
 
      (find-file file)))
 
  (wg-create-workgroup "wg2" t)
 
  (dotimes (i 20)
 
    (let ((file (format "/tmp/wg2/file_%.2d.\n" (+ i 41))))
 
      (unless (file-exists-p file)
 
        (write-file file))
 
      (find-file file)))
 

	
 
  ;; Reopen, resave
 
  (workgroups-mode 0)
 
  (workgroups-mode 1)
 
  (wg-save-session)     ;; this removes BUF objects, I think garbage collection
 

	
 
  ;;(should (= (length (wg-session-buf-list (wg-current-session))) 3))
 
  (let* ((bufs (wg-session-buf-list (wg-current-session)))
 
         (bufs-len (length bufs))
 
         (wg1 (wg-get-workgroup "First workgroup"))
 
         (wg2 (wg-get-workgroup "wg2"))
 
         (bufs1 (wg-workgroup-associated-bufs wg1))
 
         (bufs2 (wg-workgroup-associated-bufs wg2))
 
         (len1 (length bufs1))
 
         (len2 (length bufs2)))
 
    ;;(wg-workgroup-associated-bufs)
 
    (should (>= bufs-len 40))
 
    (should (>= len1 20))
 
    (should (>= len2 20))))
 

	
 
(provide 'workgroups2-tests)
 
;;; workgroups2-tests.el ends here
0 comments (0 inline, 0 general)