Mercurial > hg > xemacs-beta
comparison tests/automated/lisp-tests.el @ 444:576fb035e263 r21-2-37
Import from CVS: tag r21-2-37
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:36:19 +0200 |
parents | abe6d1db359e |
children | 1ccc32a20af4 |
comparison
equal
deleted
inserted
replaced
443:a8296e22da4e | 444:576fb035e263 |
---|---|
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 | 833 |
834 (Assert (not (string-match "\\(\\.\\=\\)" "."))) | 834 (Assert (not (string-match "\\(\\.\\=\\)" "."))) |
835 (Assert (string= "" (let ((str "test string")) | |
836 (if (string-match "^.*$" str) | |
837 (replace-match "\\U" t nil str))))) | |
838 (with-temp-buffer | |
839 (erase-buffer) | |
840 (insert "test string") | |
841 (re-search-backward "^.*$") | |
842 (replace-match "\\U" t) | |
843 (Assert (and (bobp) (eobp)))) | |
835 | 844 |
836 ;;----------------------------------------------------- | 845 ;;----------------------------------------------------- |
837 ;; Test near-text buffer functions. | 846 ;; Test near-text buffer functions. |
838 ;;----------------------------------------------------- | 847 ;;----------------------------------------------------- |
839 (with-temp-buffer | 848 (with-temp-buffer |
943 | 952 |
944 ;;----------------------------------------------------- | 953 ;;----------------------------------------------------- |
945 ;; Time-related tests | 954 ;; Time-related tests |
946 ;;----------------------------------------------------- | 955 ;;----------------------------------------------------- |
947 (Assert (= (length (current-time-string)) 24)) | 956 (Assert (= (length (current-time-string)) 24)) |
957 | |
958 ;;----------------------------------------------------- | |
959 ;; format test | |
960 ;;----------------------------------------------------- | |
961 (Assert (string= (format "%d" 10) "10")) | |
962 (Assert (string= (format "%o" 8) "10")) | |
963 (Assert (string= (format "%x" 31) "1f")) | |
964 (Assert (string= (format "%X" 31) "1F")) | |
965 (Assert (string= (format "%e" 100) "1.000000e+02")) | |
966 (Assert (string= (format "%E" 100) "1.000000E+02")) | |
967 (Assert (string= (format "%f" 100) "100.000000")) | |
968 (Assert (string= (format "%g" 100.0) "100")) | |
969 (Assert (string= (format "%g" 0.000001) "1e-06")) | |
970 (Assert (string= (format "%g" 0.0001) "0.0001")) | |
971 (Assert (string= (format "%G" 100.0) "100")) | |
972 (Assert (string= (format "%G" 0.000001) "1E-06")) | |
973 (Assert (string= (format "%G" 0.0001) "0.0001")) | |
974 | |
975 (Assert (string= (format "%2$d%1$d" 10 20) "2010")) | |
976 (Assert (string= (format "%-d" 10) "10")) | |
977 (Assert (string= (format "%-4d" 10) "10 ")) | |
978 (Assert (string= (format "%+d" 10) "+10")) | |
979 (Assert (string= (format "%+d" -10) "-10")) | |
980 (Assert (string= (format "%+4d" 10) " +10")) | |
981 (Assert (string= (format "%+4d" -10) " -10")) | |
982 (Assert (string= (format "% d" 10) " 10")) | |
983 (Assert (string= (format "% d" -10) "-10")) | |
984 (Assert (string= (format "% 4d" 10) " 10")) | |
985 (Assert (string= (format "% 4d" -10) " -10")) | |
986 (Assert (string= (format "%0d" 10) "10")) | |
987 (Assert (string= (format "%0d" -10) "-10")) | |
988 (Assert (string= (format "%04d" 10) "0010")) | |
989 (Assert (string= (format "%04d" -10) "-010")) | |
990 (Assert (string= (format "%*d" 4 10) " 10")) | |
991 (Assert (string= (format "%*d" 4 -10) " -10")) | |
992 (Assert (string= (format "%*d" -4 10) "10 ")) | |
993 (Assert (string= (format "%*d" -4 -10) "-10 ")) | |
994 (Assert (string= (format "%#d" 10) "10")) | |
995 (Assert (string= (format "%#o" 8) "010")) | |
996 (Assert (string= (format "%#x" 16) "0x10")) | |
997 (Assert (string= (format "%#e" 100) "1.000000e+02")) | |
998 (Assert (string= (format "%#E" 100) "1.000000E+02")) | |
999 (Assert (string= (format "%#f" 100) "100.000000")) | |
1000 (Assert (string= (format "%#g" 100.0) "100.000")) | |
1001 (Assert (string= (format "%#g" 0.000001) "1.00000e-06")) | |
1002 (Assert (string= (format "%#g" 0.0001) "0.000100000")) | |
1003 (Assert (string= (format "%#G" 100.0) "100.000")) | |
1004 (Assert (string= (format "%#G" 0.000001) "1.00000E-06")) | |
1005 (Assert (string= (format "%#G" 0.0001) "0.000100000")) | |
1006 (Assert (string= (format "%.1d" 10) "10")) | |
1007 (Assert (string= (format "%.4d" 10) "0010")) | |
1008 ;; Combination of `-', `+', ` ', `0', `#', `.', `*' | |
1009 (Assert (string= (format "%-04d" 10) "0010")) | |
1010 (Assert (string= (format "%-*d" 4 10) "10 ")) | |
1011 ;; #### Correctness of this behavior is questionable. | |
1012 ;; It might be better to signal error. | |
1013 (Assert (string= (format "%-*d" -4 10) "10 ")) | |
1014 ;; These behavior is not specified. | |
1015 ;; (format "%-+d" 10) | |
1016 ;; (format "%- d" 10) | |
1017 ;; (format "%-01d" 10) | |
1018 ;; (format "%-#4x" 10) | |
1019 ;; (format "%-.1d" 10) | |
1020 | |
1021 (Assert (string= (format "%01.1d" 10) "10")) | |
1022 (Assert (string= (format "%03.1d" 10) "010")) | |
1023 (Assert (string= (format "%01.3d" 10) "10")) | |
1024 (Assert (string= (format "%1.3d" 10) "10")) | |
1025 (Assert (string= (format "%3.1d" 10) " 10")) |