Mercurial > hg > xemacs-beta
comparison tests/automated/lisp-tests.el @ 434:9d177e8d4150 r21-2-25
Import from CVS: tag r21-2-25
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:30:53 +0200 |
parents | 3ecd8885ac67 |
children | 8de8e3f6228a |
comparison
equal
deleted
inserted
replaced
433:892ca416f0fb | 434:9d177e8d4150 |
---|---|
753 | 753 |
754 (Check-Error wrong-type-argument (mapconcat #'identity (current-buffer) "foo")) | 754 (Check-Error wrong-type-argument (mapconcat #'identity (current-buffer) "foo")) |
755 (Assert (equal (mapconcat #'identity '("1" "2" "3") "|") "1|2|3")) | 755 (Assert (equal (mapconcat #'identity '("1" "2" "3") "|") "1|2|3")) |
756 (Assert (equal (mapconcat #'identity ["1" "2" "3"] "|") "1|2|3")) | 756 (Assert (equal (mapconcat #'identity ["1" "2" "3"] "|") "1|2|3")) |
757 | 757 |
758 ;; The following 2 functions used to crash XEmacs via mapcar1(). | |
759 ;; We don't test the actual values of the mapcar, since they're undefined. | |
760 (Assert | |
761 (let ((x (list (cons 1 1) (cons 2 2) (cons 3 3)))) | |
762 (mapcar | |
763 (lambda (y) | |
764 "Devious evil mapping function" | |
765 (when (eq (car y) 2) ; go out onto a limb | |
766 (setcdr x nil) ; cut it off behind us | |
767 (garbage-collect)) ; are we riding a magic broomstick? | |
768 (car y)) ; sorry, hard landing | |
769 x))) | |
770 | |
771 (Assert | |
772 (let ((x (list (cons 1 1) (cons 2 2) (cons 3 3)))) | |
773 (mapcar | |
774 (lambda (y) | |
775 "Devious evil mapping function" | |
776 (when (eq (car y) 1) | |
777 (setcdr (cdr x) 42)) ; drop a brick wall onto the freeway | |
778 (car y)) | |
779 x))) | |
780 | |
758 ;;----------------------------------------------------- | 781 ;;----------------------------------------------------- |
759 ;; Test vector functions | 782 ;; Test vector functions |
760 ;;----------------------------------------------------- | 783 ;;----------------------------------------------------- |
761 (Assert (equal [1 2 3] [1 2 3])) | 784 (Assert (equal [1 2 3] [1 2 3])) |
762 (Assert (equal [] [])) | 785 (Assert (equal [] [])) |
805 (Assert (equal (split-string ",foo,,bar," ",") '("" "foo" "" "bar" ""))) | 828 (Assert (equal (split-string ",foo,,bar," ",") '("" "foo" "" "bar" ""))) |
806 (Assert (equal (split-string "foo,,,bar" ",") '("foo" "" "" "bar"))) | 829 (Assert (equal (split-string "foo,,,bar" ",") '("foo" "" "" "bar"))) |
807 (Assert (equal (split-string "foo,,bar,," ",") '("foo" "" "bar" "" ""))) | 830 (Assert (equal (split-string "foo,,bar,," ",") '("foo" "" "bar" "" ""))) |
808 (Assert (equal (split-string "foo,,bar" ",+") '("foo" "bar"))) | 831 (Assert (equal (split-string "foo,,bar" ",+") '("foo" "bar"))) |
809 (Assert (equal (split-string ",foo,,bar," ",+") '("" "foo" "bar" ""))) | 832 (Assert (equal (split-string ",foo,,bar," ",+") '("" "foo" "bar" ""))) |
833 | |
834 ;;----------------------------------------------------- | |
835 ;; Test near-text buffer functions. | |
836 ;;----------------------------------------------------- | |
837 (with-temp-buffer | |
838 (erase-buffer) | |
839 (Assert (eq (char-before) nil)) | |
840 (Assert (eq (char-before (point)) nil)) | |
841 (Assert (eq (char-before (point-marker)) nil)) | |
842 (Assert (eq (char-before (point) (current-buffer)) nil)) | |
843 (Assert (eq (char-before (point-marker) (current-buffer)) nil)) | |
844 (Assert (eq (char-after) nil)) | |
845 (Assert (eq (char-after (point)) nil)) | |
846 (Assert (eq (char-after (point-marker)) nil)) | |
847 (Assert (eq (char-after (point) (current-buffer)) nil)) | |
848 (Assert (eq (char-after (point-marker) (current-buffer)) nil)) | |
849 (Assert (eq (preceding-char) 0)) | |
850 (Assert (eq (preceding-char (current-buffer)) 0)) | |
851 (Assert (eq (following-char) 0)) | |
852 (Assert (eq (following-char (current-buffer)) 0)) | |
853 (insert "foobar") | |
854 (Assert (eq (char-before) ?r)) | |
855 (Assert (eq (char-after) nil)) | |
856 (Assert (eq (preceding-char) ?r)) | |
857 (Assert (eq (following-char) 0)) | |
858 (goto-char (point-min)) | |
859 (Assert (eq (char-before) nil)) | |
860 (Assert (eq (char-after) ?f)) | |
861 (Assert (eq (preceding-char) 0)) | |
862 (Assert (eq (following-char) ?f)) | |
863 ) |