diff tests/automated/case-tests.el @ 4855:189fb67ca31a

Create Assert-eq, Assert-equal, etc. These are equivalent to (Assert (eq ...)) but display both the actual value and the expected value of the comparison. Use them throughout the test suite.
author Ben Wing <ben@xemacs.org>
date Thu, 14 Jan 2010 02:18:03 -0600
parents 1982c8c55632
children 1fbf8bffa545
line wrap: on
line diff
--- a/tests/automated/case-tests.el	Thu Jan 14 01:25:16 2010 -0600
+++ b/tests/automated/case-tests.el	Thu Jan 14 02:18:03 2010 -0600
@@ -95,10 +95,10 @@
 		"¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿àáâãäåæçèéêëìíîïðñòóôõö×øùúûüýþßÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ÷ØÙÚÛÜÝÞÿ"))
        (table (standard-case-table)))
   (dotimes (i 256)
-    (Assert (eq (get-case-table 'downcase (int-to-char i) table)
-		(aref downcase-string i)))
-    (Assert (eq (get-case-table 'upcase (int-to-char i) table)
-		(aref upcase-string i)))))
+    (Assert-eq (get-case-table 'downcase (int-to-char i) table)
+		(aref downcase-string i))
+    (Assert-eq (get-case-table 'upcase (int-to-char i) table)
+		(aref upcase-string i))))
 
 (Check-Error-Message error "Char case must be downcase or upcase"
 		     (get-case-table 'foo ?a (standard-case-table)))
@@ -165,11 +165,11 @@
   (insert "Test Buffer")
   (let ((case-fold-search t))
     (goto-char (point-min))
-    (Assert (eq (search-forward "test buffer" nil t) 12))
+    (Assert-eq (search-forward "test buffer" nil t) 12)
     (goto-char (point-min))
-    (Assert (eq (search-forward "Test buffer" nil t) 12))
+    (Assert-eq (search-forward "Test buffer" nil t) 12)
     (goto-char (point-min))
-    (Assert (eq (search-forward "Test Buffer" nil t) 12))
+    (Assert-eq (search-forward "Test Buffer" nil t) 12)
 
     (setq case-fold-search nil)
     (goto-char (point-min))
@@ -177,51 +177,51 @@
     (goto-char (point-min))
     (Assert (not (search-forward "Test buffer" nil t)))
     (goto-char (point-min))
-    (Assert (eq (search-forward "Test Buffer" nil t) 12))))
+    (Assert-eq (search-forward "Test Buffer" nil t) 12)))
 
 (with-temp-buffer
   (insert "abcdefghijklmnäopqrstuÄvwxyz")
   ;; case insensitive
   (Assert (not (search-forward "ö" nil t)))
   (goto-char (point-min))
-  (Assert (eq 16 (search-forward "ä" nil t)))
-  (Assert (eq 24 (search-forward "ä" nil t)))
+  (Assert-eq 16 (search-forward "ä" nil t))
+  (Assert-eq 24 (search-forward "ä" nil t))
   (goto-char (point-min))
-  (Assert (eq 16 (search-forward "Ä" nil t)))
-  (Assert (eq 24 (search-forward "Ä" nil t)))
+  (Assert-eq 16 (search-forward "Ä" nil t))
+  (Assert-eq 24 (search-forward "Ä" nil t))
   (goto-char (point-max))
-  (Assert (eq 23 (search-backward "ä" nil t)))
-  (Assert (eq 15 (search-backward "ä" nil t)))
+  (Assert-eq 23 (search-backward "ä" nil t))
+  (Assert-eq 15 (search-backward "ä" nil t))
   (goto-char (point-max))
-  (Assert (eq 23 (search-backward "Ä" nil t)))
-  (Assert (eq 15 (search-backward "Ä" nil t)))
+  (Assert-eq 23 (search-backward "Ä" nil t))
+  (Assert-eq 15 (search-backward "Ä" nil t))
   ;; case sensitive
   (setq case-fold-search nil)
   (goto-char (point-min))
   (Assert (not (search-forward "ö" nil t)))
   (goto-char (point-min))
-  (Assert (eq 16 (search-forward "ä" nil t)))
+  (Assert-eq 16 (search-forward "ä" nil t))
   (Assert (not (search-forward "ä" nil t)))
   (goto-char (point-min))
-  (Assert (eq 24 (search-forward "Ä" nil t)))
+  (Assert-eq 24 (search-forward "Ä" nil t))
   (goto-char 16)
-  (Assert (eq 24 (search-forward "Ä" nil t)))
+  (Assert-eq 24 (search-forward "Ä" nil t))
   (goto-char (point-max))
-  (Assert (eq 15 (search-backward "ä" nil t)))
+  (Assert-eq 15 (search-backward "ä" nil t))
   (goto-char 15)
   (Assert (not (search-backward "ä" nil t)))
   (goto-char (point-max))
-  (Assert (eq 23 (search-backward "Ä" nil t)))
+  (Assert-eq 23 (search-backward "Ä" nil t))
   (Assert (not (search-backward "Ä" nil t))))
 
 (with-temp-buffer
   (insert "aaaaäÄäÄäÄäÄäÄbbbb")
   (goto-char (point-min))
-  (Assert (eq 15 (search-forward "ää" nil t 5)))
+  (Assert-eq 15 (search-forward "ää" nil t 5))
   (goto-char (point-min))
   (Assert (not (search-forward "ää" nil t 6)))
   (goto-char (point-max))
-  (Assert (eq 5 (search-backward "ää" nil t 5)))
+  (Assert-eq 5 (search-backward "ää" nil t 5))
   (goto-char (point-max))
   (Assert (not (search-backward "ää" nil t 6))))
 
@@ -240,26 +240,26 @@
       (goto-char (point-min))
       (Assert (not (search-forward "ö" nil t)))
       (goto-char (point-min))
-      (Assert (eq 2 (search-forward str-hiragana-a nil t)))
+      (Assert-eq 2 (search-forward str-hiragana-a nil t))
       (goto-char (point-min))
-      (Assert (eq 2 (search-forward str-a-diaeresis nil t)))
+      (Assert-eq 2 (search-forward str-a-diaeresis nil t))
       (goto-char (1+ (point-min)))
-      (Assert (eq (point-max)
-		  (search-forward str-hiragana-a nil t)))
+      (Assert-eq (point-max)
+		  (search-forward str-hiragana-a nil t))
       (goto-char (1+ (point-min)))
-      (Assert (eq (point-max)
-		  (search-forward str-a-diaeresis nil t)))
+      (Assert-eq (point-max)
+		  (search-forward str-a-diaeresis nil t))
       ;; backward
       (goto-char (point-max))
       (Assert (not (search-backward "ö" nil t)))
       (goto-char (point-max))
-      (Assert (eq (1- (point-max)) (search-backward str-hiragana-a nil t)))
+      (Assert-eq (1- (point-max)) (search-backward str-hiragana-a nil t))
       (goto-char (point-max))
-      (Assert (eq (1- (point-max)) (search-backward str-a-diaeresis nil t)))
+      (Assert-eq (1- (point-max)) (search-backward str-a-diaeresis nil t))
       (goto-char (1- (point-max)))
-      (Assert (eq 1 (search-backward str-hiragana-a nil t)))
+      (Assert-eq 1 (search-backward str-hiragana-a nil t))
       (goto-char (1- (point-max)))
-      (Assert (eq 1 (search-backward str-a-diaeresis nil t)))
+      (Assert-eq 1 (search-backward str-a-diaeresis nil t))
       (replace-match "a")
       (Assert (looking-at (format "abcdefg%c" a-diaeresis))))
     (with-temp-buffer
@@ -270,11 +270,11 @@
       (insert string)
       (insert string)
       (goto-char (point-min))
-      (Assert (eq 11 (search-forward string nil t 5)))
+      (Assert-eq 11 (search-forward string nil t 5))
       (goto-char (point-min))
       (Assert (not (search-forward string nil t 6)))
       (goto-char (point-max))
-      (Assert (eq 1 (search-backward string nil t 5)))
+      (Assert-eq 1 (search-backward string nil t 5))
       (goto-char (point-max))
       (Assert (not (search-backward string nil t 6))))))
 
@@ -297,7 +297,7 @@
     ;; But searches for ASCII strings in buffers with nothing above ?\xFF
     ;; use Boyer Moore with the current implementation, which is the
     ;; important thing for the Gnus use case.
-    (Assert (= (1+ (length target)) (search-forward target nil t)))))
+    (Assert= (1+ (length target)) (search-forward target nil t))))
 
 (Skip-Test-Unless
  (boundp 'debug-xemacs-searches) ; normal when we have DEBUG_XEMACS
@@ -313,7 +313,7 @@
      (insert "\n\nDer beruhmte deutsche Flei\xdf\n\n")
      (goto-char (point-min))
      (Assert (search-forward "Flei\xdf"))
-     (Assert (eq 'boyer-moore search-algorithm-used))
+     (Assert-eq 'boyer-moore search-algorithm-used)
      (delete-region (point-min) (point-max))
      (when (featurep 'mule)
        (insert "\n\nDer beruhmte deutsche Flei\xdf\n\n")
@@ -321,13 +321,13 @@
        (Assert 
         (search-forward (format "Fle%c\xdf"
                                 (make-char 'latin-iso8859-9 #xfd))))
-       (Assert (eq 'boyer-moore search-algorithm-used))
+       (Assert-eq 'boyer-moore search-algorithm-used)
        (insert (make-char 'latin-iso8859-9 #xfd))
        (goto-char (point-min))
        (Assert (search-forward "Flei\xdf"))
-       (Assert (eq 'simple-search search-algorithm-used)) 
+       (Assert-eq 'simple-search search-algorithm-used) 
        (goto-char (point-min))
        (Assert (search-forward (format "Fle%c\xdf"
                                        (make-char 'latin-iso8859-9 #xfd))))
-       (Assert (eq 'simple-search search-algorithm-used))))))
+       (Assert-eq 'simple-search search-algorithm-used)))))