* test-elmo-util.el (test-elmo-number-set-delete-1): New testcase.
authorhmurata <hmurata>
Mon, 11 Oct 2004 11:56:30 +0000 (11:56 +0000)
committerhmurata <hmurata>
Mon, 11 Oct 2004 11:56:30 +0000 (11:56 +0000)
(test-elmo-number-set-delete-2): Ditto.
(test-elmo-number-set-delete-3): Ditto.
(test-elmo-number-set-delete-4): Ditto.
(test-elmo-number-set-delete-5): Ditto.
(test-elmo-number-set-delete-6): Ditto.
(test-elmo-number-set-delete-7): Ditto.
(test-elmo-number-set-delete-8): Ditto.
(test-elmo-number-set-delete-list-1): Ditto.

* elmo.el (elmo-folder-delete-messages-internal): New API (for
internal use only).
(elmo-generic-folder-commit): Save `killed-list' even if msgdb is
not modified.
(elmo-folder-delete-messages): Define.
(elmo-folder-move-messages): Don't call
`elmo-folder-detach-messages'.
(elmo-folder-synchronize): Rewrite.
(elmo-folder-detach-messages): Delete numbers from `killed-list'.

* elmo-util.el (elmo-last): New function.
(elmo-set-list): Ditto.
(elmo-number-set-delete-list): Ditto.
(elmo-number-set-delete): Ditto.

* elmo-shimbun.el (elmo-folder-delete-messages): Define.

* elmo-map.el (elmo-folder-delete-messages-internal): Renamed from
`elmo-folder-delete-messages' and don't delete location map.
(elmo-folder-detach-messages): Define.

* elmo-imap4.el (elmo-folder-delete): Use
`elmo-folder-delete-messages-internal' instead of
`elmo-folder-delete-messages'.

* elmo-filter.el (elmo-folder-delete-messages): Call
`elmo-folder-detach-messages'.
(elmo-folder-detach-messages): Don't call
`elmo-folder-detach-messages' for target folder.

* elmo-cache.el (elmo-map-folder-delete-messages): Return t when
message deletion is succeeded.

* elmo-maildir.el (elmo-map-folder-delete-messages): Ditto.

* elmo-archive.el (elmo-folder-delete-messages-internal): Renamed
from `elmo-folder-delete-messages'.

* elmo-flag.el (elmo-folder-delete-messages-internal): Ditto.

* elmo-localdir.el (elmo-folder-delete-messages-internal): Ditto.

* elmo-net.el (elmo-folder-delete-messages-internal): Ditto.

15 files changed:
elmo/ChangeLog
elmo/elmo-archive.el
elmo/elmo-cache.el
elmo/elmo-filter.el
elmo/elmo-flag.el
elmo/elmo-imap4.el
elmo/elmo-localdir.el
elmo/elmo-maildir.el
elmo/elmo-map.el
elmo/elmo-net.el
elmo/elmo-shimbun.el
elmo/elmo-util.el
elmo/elmo.el
tests/ChangeLog
tests/test-elmo-util.el

index e4ba9cb..3f858c6 100644 (file)
@@ -1,5 +1,49 @@
 2004-10-11  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
 
+       * elmo.el (elmo-folder-delete-messages-internal): New API (for
+       internal use only).
+       (elmo-generic-folder-commit): Save `killed-list' even if msgdb is
+       not modified.
+       (elmo-folder-delete-messages): Define.
+       (elmo-folder-move-messages): Don't call
+       `elmo-folder-detach-messages'.
+       (elmo-folder-synchronize): Rewrite.
+       (elmo-folder-detach-messages): Delete numbers from `killed-list'.
+
+       * elmo-util.el (elmo-last): New function.
+       (elmo-set-list): Ditto.
+       (elmo-number-set-delete-list): Ditto.
+       (elmo-number-set-delete): Ditto.
+
+       * elmo-shimbun.el (elmo-folder-delete-messages): Define.
+
+       * elmo-map.el (elmo-folder-delete-messages-internal): Renamed from
+       `elmo-folder-delete-messages' and don't delete location map.
+       (elmo-folder-detach-messages): Define.
+
+       * elmo-imap4.el (elmo-folder-delete): Use
+       `elmo-folder-delete-messages-internal' instead of
+       `elmo-folder-delete-messages'.
+
+       * elmo-filter.el (elmo-folder-delete-messages): Call
+       `elmo-folder-detach-messages'.
+       (elmo-folder-detach-messages): Don't call
+       `elmo-folder-detach-messages' for target folder.
+
+       * elmo-cache.el (elmo-map-folder-delete-messages): Return t when
+       message deletion is succeeded.
+
+       * elmo-maildir.el (elmo-map-folder-delete-messages): Ditto.
+
+       * elmo-archive.el (elmo-folder-delete-messages-internal): Renamed
+       from `elmo-folder-delete-messages'.
+
+       * elmo-flag.el (elmo-folder-delete-messages-internal): Ditto.
+
+       * elmo-localdir.el (elmo-folder-delete-messages-internal): Ditto.
+
+       * elmo-net.el (elmo-folder-delete-messages-internal): Ditto.
+
        * elmo-version.el (elmo-version): Up to 2.11.32.
 
 2004-10-10  Yuuichi Teranishi  <teranisi@gohome.org>
index b7e7b44..d18cae1 100644 (file)
@@ -766,8 +766,9 @@ TYPE specifies the archiver's symbol."
           (elmo-archive-exec-msgs-subr2
            n-prog (append n-prog-arg (list arc)) files (length arc)))))))))
 
-(luna-define-method elmo-folder-delete-messages ((folder elmo-archive-folder)
-                                                numbers)
+(luna-define-method elmo-folder-delete-messages-internal ((folder
+                                                          elmo-archive-folder)
+                                                         numbers)
   (let* ((type (elmo-archive-folder-archive-type-internal folder))
         (prefix (elmo-archive-folder-archive-prefix-internal folder))
         (arc (elmo-archive-get-archive-name folder))
index 01df925..ce178a5 100644 (file)
   (dolist (location locations)
     (elmo-file-cache-delete
      (expand-file-name location
-                      (elmo-cache-folder-directory-internal folder)))))
+                      (elmo-cache-folder-directory-internal folder))))
+  t)
 
 (luna-define-method elmo-message-fetch-with-cache-process
   ((folder elmo-cache-folder) number strategy &optional section unseen)
index 52ce271..7570e5f 100644 (file)
 
 (luna-define-method elmo-folder-delete-messages ((folder elmo-filter-folder)
                                                 numbers)
-  (elmo-folder-delete-messages
-   (elmo-filter-folder-target-internal folder) numbers))
+  (and (elmo-folder-delete-messages
+       (elmo-filter-folder-target-internal folder) numbers)
+       (elmo-folder-detach-messages folder numbers)))
 
 (luna-define-method elmo-folder-list-messages ((folder elmo-filter-folder)
                                               &optional visible-only in-msgdb)
 (luna-define-method elmo-folder-detach-messages ((folder elmo-filter-folder)
                                                 numbers)
   (elmo-filter-folder-countup-message-flags folder numbers -1)
-  (elmo-list-delete numbers (elmo-filter-folder-number-list folder) #'delq)
-  (elmo-folder-detach-messages
-   (elmo-filter-folder-target-internal folder) numbers))
+  (elmo-list-delete numbers (elmo-filter-folder-number-list folder) #'delq))
 
 (luna-define-method elmo-folder-length ((folder elmo-filter-folder))
   (length (elmo-filter-folder-number-list-internal folder)))
index 6e21309..23344bb 100644 (file)
      (delq elem (elmo-flag-folder-minfo-internal folder))))
   t)
 
-(luna-define-method elmo-folder-delete-messages ((folder
-                                                 elmo-flag-folder)
-                                                numbers)
+(luna-define-method elmo-folder-delete-messages-internal ((folder
+                                                          elmo-flag-folder)
+                                                         numbers)
   (dolist (number numbers)
     (elmo-flag-folder-delete-message folder number)
     (elmo-localdir-delete-message folder number))
index cd9afec..8146bd9 100644 (file)
@@ -2079,7 +2079,7 @@ Return nil if no complete line has arrived."
                               (elmo-folder-name-internal folder)))
       (let ((session (elmo-imap4-get-session folder)))
        (when (elmo-imap4-folder-mailbox-internal folder)
-         (when msgs (elmo-folder-delete-messages folder msgs))
+         (when msgs (elmo-folder-delete-messages-internal folder msgs))
          (elmo-imap4-send-command-wait session "close")
          (elmo-imap4-send-command-wait
           session
index fe83718..82eeb4d 100644 (file)
        succeeds)
     (luna-call-next-method)))
 
-(luna-define-method elmo-folder-delete-messages ((folder elmo-localdir-folder)
-                                                numbers)
+(luna-define-method elmo-folder-delete-messages-internal
+  ((folder elmo-localdir-folder) numbers)
   (dolist (number numbers)
     (elmo-localdir-delete-message folder number))
   t)
index 6372aed..26e9ab4 100644 (file)
@@ -484,7 +484,8 @@ file name for maildir directories."
       (if (and file
               (file-writable-p file)
               (not (file-directory-p file)))
-         (delete-file file)))))
+         (delete-file file))))
+  t)
 
 (luna-define-method elmo-map-message-fetch ((folder elmo-maildir-folder)
                                            location strategy
index 6d87bb0..08f23df 100644 (file)
@@ -283,23 +283,29 @@ Return t if the message list is not available.")
                                                  flag)
   t)
 
-(luna-define-method elmo-folder-delete-messages ((folder elmo-map-folder)
-                                                numbers)
+(luna-define-method elmo-folder-delete-messages-internal ((folder
+                                                          elmo-map-folder)
+                                                         numbers)
   (elmo-map-folder-delete-messages
    folder
-   (elmo-map-folder-numbers-to-locations folder numbers))
-  (dolist (number numbers)
-    (elmo-map-folder-set-location-alist-internal
-     folder
-     (delq (elmo-get-hash-val
-           (concat "#" (int-to-string number))
-           (elmo-map-folder-location-hash-internal
-            folder))
-          (elmo-map-folder-location-alist-internal folder)))
-    (elmo-clear-hash-val (concat "#" (int-to-string number))
-                        (elmo-map-folder-location-hash-internal
-                         folder)))
-  t) ; success
+   (elmo-map-folder-numbers-to-locations folder numbers)))
+
+(luna-define-method elmo-folder-detach-messages :around ((folder
+                                                         elmo-map-folder)
+                                                        numbers)
+  (when (luna-call-next-method)
+    (dolist (number numbers)
+      (elmo-map-folder-set-location-alist-internal
+       folder
+       (delq (elmo-get-hash-val
+             (concat "#" (int-to-string number))
+             (elmo-map-folder-location-hash-internal
+              folder))
+            (elmo-map-folder-location-alist-internal folder)))
+      (elmo-clear-hash-val (concat "#" (int-to-string number))
+                          (elmo-map-folder-location-hash-internal
+                           folder)))
+    t)) ; success
 
 (require 'product)
 (product-provide (provide 'elmo-map) (require 'elmo-version))
index dbda705..480fa7a 100644 (file)
@@ -414,11 +414,12 @@ Returned value is searched from `elmo-network-stream-type-alist'."
                                                      flag)
   t)
 
-(luna-define-method elmo-folder-delete-messages ((folder elmo-net-folder)
-                                                numbers)
-  (if (elmo-folder-plugged-p folder)
-      (elmo-folder-send folder 'elmo-folder-delete-messages-plugged numbers)
-    (elmo-folder-send folder 'elmo-folder-delete-messages-unplugged numbers)))
+(luna-define-method elmo-folder-delete-messages-internal ((folder
+                                                          elmo-net-folder)
+                                                         numbers)
+   (if (elmo-folder-plugged-p folder)
+       (elmo-folder-send folder 'elmo-folder-delete-messages-plugged numbers)
+     (elmo-folder-send folder 'elmo-folder-delete-messages-unplugged numbers)))
 
 (luna-define-method elmo-folder-delete-messages-unplugged ((folder
                                                            elmo-net-folder)
index def90da..0fb3f24 100644 (file)
@@ -527,6 +527,11 @@ If it is the symbol `all', update overview for all shimbun folders."
                          folder))))
     t))
 
+(luna-define-method elmo-folder-delete-messages ((folder elmo-shimbun-folder)
+                                                numbers)
+  (elmo-folder-kill-messages folder numbers)
+  t)
+
 (require 'product)
 (product-provide (provide 'elmo-shimbun) (require 'elmo-version))
 
index b88573e..fb9d44f 100644 (file)
@@ -332,6 +332,16 @@ Return value is a cons cell of (STRUCTURE . REST)"
        (replace-match "\n"))
      (buffer-string))))
 
+(defun elmo-last (list)
+  (and list (nth (1- (length list)) list)))
+
+(defun elmo-set-list (vars vals)
+  (while vars
+    (when (car vars)
+      (set (car vars) (car vals)))
+    (setq vars (cdr vars)
+         vals (cdr vals))))
+
 (defun elmo-uniq-list (lst &optional delete-function)
   "Distractively uniqfy elements of LST."
   (setq delete-function (or delete-function #'delete))
@@ -1553,6 +1563,59 @@ NUMBER-SET is altered."
        (setq number-set-1 (nconc number-set-1 (list number))))
     number-set-1))
 
+(defun elmo-number-set-delete-list (number-set list)
+  "Delete LIST of numbers from the NUMBER-SET.
+NUMBER-SET is altered."
+  (let ((deleted number-set))
+    (dolist (number list)
+      (setq deleted (elmo-number-set-delete deleted number)))
+    deleted))
+
+(defun elmo-number-set-delete (number-set number)
+  "Delete NUMBER from the NUMBER-SET.
+NUMBER-SET is altered."
+  (let* ((curr number-set)
+        (top (cons 'dummy number-set))
+        (prev top)
+        elem found)
+    (while (and curr (not found))
+      (setq elem (car curr))
+      (if (consp elem)
+         (cond
+          ((eq (car elem) number)
+           (if (eq (cdr elem) (1+ number))
+               (setcar curr (cdr elem))
+             (setcar elem (1+ number)))
+           (setq found t))
+          ((eq (cdr elem) number)
+           (if (eq (car elem) (1- number))
+               (setcar curr (car elem))
+             (setcdr elem (1- number)))
+           (setq found t))
+          ((and (> number (car elem))
+                (< number (cdr elem)))
+           (setcdr
+            prev
+            (nconc
+             (list
+              ;; (beg . (1- number))
+              (let ((new (cons (car elem) (1- number))))
+                (if (eq (car new) (cdr new))
+                    (car new)
+                  new))
+              ;; ((1+ number) . end)
+              (let ((new (cons (1+ number) (cdr elem))))
+                (if (eq (car new) (cdr new))
+                    (car new)
+                  new)))
+             (cdr curr)))))
+       (when (eq elem number)
+         (setcdr prev (cdr curr))
+         (setq found t)))
+      (setq prev curr
+           curr (cdr curr)))
+    (cdr top)))
+
 (defun elmo-make-number-list (beg end)
   (let (number-list i)
     (setq i end)
index 47d6a07..b111675 100644 (file)
@@ -315,12 +315,18 @@ Otherwise, all descendent folders are returned.")
   "Rename FOLDER to NEW-NAME (string).")
 
 (luna-define-generic elmo-folder-delete-messages (folder numbers)
-  "Delete messages.
+  "Delete messages with msgdb entity.
 FOLDER is the ELMO folder structure.
 NUMBERS is a list of message numbers to be deleted.
 It is not recommended to use this function other than internal use.
 Use `elmo-folder-move-messages' with dst-folder 'null instead.")
 
+(luna-define-generic elmo-folder-delete-messages-internal (folder numbers)
+  "Delete messages, but no delete msgdb entity.
+FOLDER is the ELMO folder structure.
+NUMBERS is a list of message numbers to be deleted.
+Override this method by each implement of `elmo-folder'.")
+
 (luna-define-generic elmo-folder-search (folder condition &optional numbers)
   "Search and return list of message numbers.
 FOLDER is the ELMO folder structure.
@@ -696,16 +702,17 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-FLAG-ALIST).")
   (elmo-generic-folder-commit folder))
 
 (defun elmo-generic-folder-commit (folder)
-  (let ((msgdb (elmo-folder-msgdb-internal folder)))
-    (when (and msgdb (elmo-folder-persistent-p folder))
-      (when (elmo-msgdb-message-modified-p msgdb)
-       (elmo-folder-set-info-max-by-numdb
-        folder
-        (elmo-folder-list-messages folder nil 'in-msgdb))
-       (elmo-msgdb-killed-list-save
-        (elmo-folder-msgdb-path folder)
-        (elmo-folder-killed-list-internal folder)))
-      (elmo-msgdb-save msgdb))))
+  (when (elmo-folder-persistent-p folder)
+    (let ((msgdb (elmo-folder-msgdb-internal folder)))
+      (when msgdb
+       (when (elmo-msgdb-message-modified-p msgdb)
+         (elmo-folder-set-info-max-by-numdb
+          folder
+          (elmo-folder-list-messages folder nil 'in-msgdb))
+       (elmo-msgdb-save msgdb))))
+    (elmo-msgdb-killed-list-save
+     (elmo-folder-msgdb-path folder)
+     (elmo-folder-killed-list-internal folder))))
 
 (luna-define-method elmo-folder-close-internal ((folder elmo-folder))
   ;; do nothing.
@@ -756,6 +763,11 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-FLAG-ALIST).")
     (elmo-folder-send folder 'elmo-folder-rename-internal new-folder)
     (elmo-msgdb-rename-path folder new-folder)))
 
+(luna-define-method elmo-folder-delete-messages ((folder elmo-folder)
+                                                numbers)
+  (and (elmo-folder-delete-messages-internal folder numbers)
+       (elmo-folder-detach-messages folder numbers)))
+
 (luna-define-method elmo-folder-search ((folder elmo-folder)
                                        condition
                                        &optional numbers)
@@ -1096,8 +1108,7 @@ If optional argument IF-EXISTS is nil, load on demand.
          (elmo-folder-close dst-folder)))
       (if (and (not no-delete) succeeds)
          (progn
-           (if (and (elmo-folder-delete-messages src-folder succeeds)
-                    (elmo-folder-detach-messages src-folder succeeds))
+           (if (elmo-folder-delete-messages src-folder succeeds)
                (progn
                  (elmo-global-flag-detach-messages
                   src-folder succeeds (eq dst-folder 'null))
@@ -1480,48 +1491,45 @@ If update process is interrupted, return nil.")
                                             ignore-msgdb
                                             no-check
                                             mask)
-  (let ((killed-list (elmo-folder-killed-list-internal folder))
-       (before-append t)
-       old-msgdb diff diff-2 delete-list new-list new-msgdb flag
-       flag-table crossed after-append)
-    (setq old-msgdb (elmo-folder-msgdb folder))
-    (setq flag-table (elmo-flag-table-load (elmo-folder-msgdb-path folder)))
+  (let ((old-msgdb (elmo-folder-msgdb folder))
+       (killed-list (elmo-folder-killed-list-internal folder))
+       (flag-table (elmo-flag-table-load (elmo-folder-msgdb-path folder)))
+       (before-append t))
     (when ignore-msgdb
       (elmo-msgdb-flag-table (elmo-folder-msgdb folder) flag-table)
       (elmo-folder-clear folder (not disable-killed)))
     (unless no-check (elmo-folder-check folder))
     (condition-case nil
-       (progn
+       (let ((killed-list (elmo-folder-killed-list-internal folder))
+             diff-new diff-del
+             delete-list new-list new-msgdb crossed)
          (message "Checking folder diff...")
-         (setq diff (elmo-list-diff (elmo-folder-list-messages
-                                     folder
-                                     (not disable-killed))
-                                    (elmo-folder-list-messages
-                                     folder
-                                     (not disable-killed)
-                                     'in-msgdb)))
-         (when (and mask (car diff))
-           (setcar diff (elmo-list-filter mask (car diff))))
+         (elmo-set-list
+          '(diff-new diff-del)
+          (elmo-list-diff (elmo-folder-list-messages folder)
+                          (elmo-folder-list-messages folder nil 'in-msgdb)))
+         (when diff-new
+           (unless disable-killed
+             (setq diff-new (elmo-living-messages diff-new killed-list)))
+           (when mask
+             (setq diff-new (elmo-list-filter mask diff-new))))
          (message "Checking folder diff...done")
-         (setq new-list (elmo-folder-confirm-appends (car diff)))
-         ;; Set killed list as ((1 . MAX-OF-DISAPPEARED))
-         (when (and (not (eq (length (car diff))
-                             (length new-list)))
-                    (setq diff-2 (elmo-list-diff (car diff) new-list)))
-           (elmo-folder-kill-messages-range
-            folder
-            (car (car diff-2))
-            (nth (- (length (car diff-2)) 1) (car diff-2))))
-         (setq delete-list (cadr diff))
-         (if (or (equal diff '(nil nil))
-                 (equal diff '(nil))
-                 (and (eq (length (car diff)) 0)
-                      (eq (length (cadr diff)) 0)))
+         (setq new-list (elmo-folder-confirm-appends diff-new))
+         ;; Append to killed list as (MIN-OF-DISAPPEARED . MAX-OF-DISAPPEARED)
+         (when (not (eq (length diff-new)
+                        (length new-list)))
+           (let* ((diff (elmo-list-diff diff-new new-list))
+                  (disappeared (car diff)))
+             (when disappeared
+               (elmo-folder-kill-messages-range folder
+                                                (car disappeared)
+                                                (elmo-last disappeared)))))
+         (setq delete-list diff-del)
+         (if (and (null diff-new) (null diff-del))
              (progn
                (elmo-folder-update-number folder)
                (elmo-folder-process-crosspost folder)
-               0 ; no updates.
-               )
+               0)                      ; `0' means no updates.
            (when delete-list
              (elmo-folder-detach-messages folder delete-list))
            (when new-list
@@ -1550,7 +1558,14 @@ If update process is interrupted, return nil.")
 
 (luna-define-method elmo-folder-detach-messages ((folder elmo-folder)
                                                 numbers)
-  (elmo-msgdb-delete-messages (elmo-folder-msgdb folder) numbers))
+  (when (elmo-msgdb-delete-messages (elmo-folder-msgdb folder) numbers)
+    ;; Remove NUMBERS from killed message list.
+    (elmo-folder-set-killed-list-internal
+     folder
+     (elmo-number-set-delete-list
+      (elmo-folder-killed-list-internal folder)
+      numbers))
+    t))
 
 (luna-define-generic elmo-folder-length (folder)
   "Return number of messages in the FOLDER.")
index 0b715e7..014c925 100644 (file)
@@ -1,3 +1,15 @@
+2004-10-11  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
+
+       * test-elmo-util.el (test-elmo-number-set-delete-1): New testcase.
+       (test-elmo-number-set-delete-2): Ditto.
+       (test-elmo-number-set-delete-3): Ditto.
+       (test-elmo-number-set-delete-4): Ditto.
+       (test-elmo-number-set-delete-5): Ditto.
+       (test-elmo-number-set-delete-6): Ditto.
+       (test-elmo-number-set-delete-7): Ditto.
+       (test-elmo-number-set-delete-8): Ditto.
+       (test-elmo-number-set-delete-list-1): Ditto.
+
 2004-10-04  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * test-utf7.el (toplevel): Enable utf-translate-cjk-mode explicitly.
index 81f30f9..457a011 100644 (file)
    (equal '((1 . 100))
          (elmo-number-set-append '((1 . 99)) 100))))
 
+(luna-define-method test-elmo-number-set-delete-1 ((case test-elmo-util))
+  "Check edge."
+  (lunit-assert
+   (equal '(2 3)
+         (elmo-number-set-delete '(1 2 3) 1))))
+
+(luna-define-method test-elmo-number-set-delete-2 ((case test-elmo-util))
+  "Normal case."
+  (lunit-assert
+   (equal '(1 3)
+         (elmo-number-set-delete '(1 2 3) 2))))
+
+(luna-define-method test-elmo-number-set-delete-3 ((case test-elmo-util))
+  "Check edge."
+  (lunit-assert
+   (equal '(1 2)
+         (elmo-number-set-delete '(1 2 3) 3))))
+
+(luna-define-method test-elmo-number-set-delete-4 ((case test-elmo-util))
+  "Check edge."
+  (lunit-assert
+   (equal '((2 . 100))
+         (elmo-number-set-delete '((1 . 100)) 1))))
+
+(luna-define-method test-elmo-number-set-delete-5 ((case test-elmo-util))
+  "Check edge."
+  (lunit-assert
+   (equal '(1 (3 . 100))
+         (elmo-number-set-delete '((1 . 100)) 2))))
+
+(luna-define-method test-elmo-number-set-delete-6 ((case test-elmo-util))
+  "Normal case."
+  (lunit-assert
+   (equal '((1 . 49) (51 . 100))
+         (elmo-number-set-delete '((1 . 100)) 50))))
+
+(luna-define-method test-elmo-number-set-delete-7 ((case test-elmo-util))
+  "Check edge."
+  (lunit-assert
+   (equal '((1 . 98) 100)
+         (elmo-number-set-delete '((1 . 100)) 99))))
+
+(luna-define-method test-elmo-number-set-delete-8 ((case test-elmo-util))
+  "Check edge."
+  (lunit-assert
+   (equal '((1 . 99))
+         (elmo-number-set-delete '((1 . 100)) 100))))
+
+(luna-define-method test-elmo-number-set-delete-list-1 ((case test-elmo-util))
+  "Simple testcase."
+  (lunit-assert
+   (equal '((1 . 99))
+         (elmo-number-set-delete-list '((1 . 100)) '(100)))))
+
 (luna-define-method test-elmo-number-set-to-number-list-1 ((case test-elmo-util))
   "Simple testcase."
   (lunit-assert