Mercurial > hg > xemacs-beta
comparison tests/automated/lisp-tests.el @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 8de8e3f6228a |
children | 576fb035e263 |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
828 (Assert (equal (split-string ",foo,,bar," ",") '("" "foo" "" "bar" ""))) | 828 (Assert (equal (split-string ",foo,,bar," ",") '("" "foo" "" "bar" ""))) |
829 (Assert (equal (split-string "foo,,,bar" ",") '("foo" "" "" "bar"))) | 829 (Assert (equal (split-string "foo,,,bar" ",") '("foo" "" "" "bar"))) |
830 (Assert (equal (split-string "foo,,bar,," ",") '("foo" "" "bar" "" ""))) | 830 (Assert (equal (split-string "foo,,bar,," ",") '("foo" "" "bar" "" ""))) |
831 (Assert (equal (split-string "foo,,bar" ",+") '("foo" "bar"))) | 831 (Assert (equal (split-string "foo,,bar" ",+") '("foo" "bar"))) |
832 (Assert (equal (split-string ",foo,,bar," ",+") '("" "foo" "bar" ""))) | 832 (Assert (equal (split-string ",foo,,bar," ",+") '("" "foo" "bar" ""))) |
833 | |
834 (Assert (not (string-match "\\(\\.\\=\\)" "."))) | |
833 | 835 |
834 ;;----------------------------------------------------- | 836 ;;----------------------------------------------------- |
835 ;; Test near-text buffer functions. | 837 ;; Test near-text buffer functions. |
836 ;;----------------------------------------------------- | 838 ;;----------------------------------------------------- |
837 (with-temp-buffer | 839 (with-temp-buffer |
873 (put sym 'bar 'baz) | 875 (put sym 'bar 'baz) |
874 (Assert (eq 'baz (get sym 'bar))) | 876 (Assert (eq 'baz (get sym 'bar))) |
875 (Assert (eq 'baz (getf '(bar baz) 'bar))) | 877 (Assert (eq 'baz (getf '(bar baz) 'bar))) |
876 (Assert (eq 'baz (getf (symbol-plist sym) 'bar))) | 878 (Assert (eq 'baz (getf (symbol-plist sym) 'bar))) |
877 (Assert (eq 2 (getf '(1 2) 1))) | 879 (Assert (eq 2 (getf '(1 2) 1))) |
880 (Assert (eq 4 (put sym 3 4))) | |
881 (Assert (eq 4 (get sym 3))) | |
882 (Assert (eq t (remprop sym 3))) | |
883 (Assert (eq nil (remprop sym 3))) | |
884 (Assert (eq 5 (get sym 3 5))) | |
878 ) | 885 ) |
886 | |
887 (loop for obj in | |
888 (list (make-symbol "test-symbol") | |
889 "test-string" | |
890 (make-extent nil nil nil) | |
891 (make-face 'test-face)) | |
892 do | |
893 (Assert (eq 2 (get obj ?1 2))) | |
894 (Assert (eq 4 (put obj ?3 4))) | |
895 (Assert (eq 4 (get obj ?3))) | |
896 (when (or (stringp obj) (symbolp obj)) | |
897 (Assert (equal '(?3 4) (object-plist obj)))) | |
898 (Assert (eq t (remprop obj ?3))) | |
899 (when (or (stringp obj) (symbolp obj)) | |
900 (Assert (eq '() (object-plist obj)))) | |
901 (Assert (eq nil (remprop obj ?3))) | |
902 (when (or (stringp obj) (symbolp obj)) | |
903 (Assert (eq '() (object-plist obj)))) | |
904 (Assert (eq 5 (get obj ?3 5))) | |
905 ) | |
906 | |
907 (Check-Error-Message | |
908 error "Object type has no properties" | |
909 (get 2 'property)) | |
910 | |
911 (Check-Error-Message | |
912 error "Object type has no settable properties" | |
913 (put (current-buffer) 'property 'value)) | |
914 | |
915 (Check-Error-Message | |
916 error "Object type has no removable properties" | |
917 (remprop ?3 'property)) | |
918 | |
919 (Check-Error-Message | |
920 error "Object type has no properties" | |
921 (object-plist (symbol-function 'car))) | |
922 | |
923 (Check-Error-Message | |
924 error "Can't remove property from object" | |
925 (remprop (make-extent nil nil nil) 'detachable)) | |
926 | |
927 ;;----------------------------------------------------- | |
928 ;; Test subseq | |
929 ;;----------------------------------------------------- | |
930 (Assert (equal (subseq nil 0) nil)) | |
931 (Assert (equal (subseq [1 2 3] 0) [1 2 3])) | |
932 (Assert (equal (subseq [1 2 3] 1 -1) [2])) | |
933 (Assert (equal (subseq "123" 0) "123")) | |
934 (Assert (equal (subseq "1234" -3 -1) "23")) | |
935 (Assert (equal (subseq #*0011 0) #*0011)) | |
936 (Assert (equal (subseq #*0011 -3 3) #*01)) | |
937 (Assert (equal (subseq '(1 2 3) 0) '(1 2 3))) | |
938 (Assert (equal (subseq '(1 2 3 4) -3 nil) '(2 3 4))) | |
939 | |
940 (Check-Error 'wrong-type-argument (subseq 3 2)) | |
941 (Check-Error 'args-out-of-range (subseq [1 2 3] -42)) | |
942 (Check-Error 'args-out-of-range (subseq [1 2 3] 0 42)) | |
943 | |
944 ;;----------------------------------------------------- | |
945 ;; Time-related tests | |
946 ;;----------------------------------------------------- | |
947 (Assert (= (length (current-time-string)) 24)) |