X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=tests%2Fautomated%2Flisp-tests.el;h=b2b6077858a3d64840530adef390fc419165fb14;hb=d932e3896bf2fad271d5c793935898a63717af92;hp=7d6f321db299c3377ac924dc54f03ed33549e7cb;hpb=82f6d62ee211b1d36e8f45fed3ee3edde82b6916;p=chise%2Fxemacs-chise.git.1 diff --git a/tests/automated/lisp-tests.el b/tests/automated/lisp-tests.el index 7d6f321..b2b6077 100644 --- a/tests/automated/lisp-tests.el +++ b/tests/automated/lisp-tests.el @@ -243,6 +243,8 @@ (Assert (= (- one) -1)) (Assert (= (- one one) 0)) (Assert (= (- one one one) -1)) + (Assert (= (- 0 one) -1)) + (Assert (= (- 0 one one) -2)) (Assert (= (+ one 1) 2)) (dolist (zero '(0 0.0 ?\0)) (Assert (= (+ 1 zero) 1)) @@ -998,6 +1000,10 @@ (Assert (string= (format "%e" 100) "1.000000e+02")) (Assert (string= (format "%E" 100) "1.000000E+02")) (Assert (string= (format "%f" 100) "100.000000")) +(Assert (string= (format "%7.3f" 12.12345) " 12.123")) +(Assert (string= (format "%07.3f" 12.12345) "012.123")) +(Assert (string= (format "%-7.3f" 12.12345) "12.123 ")) +(Assert (string= (format "%-07.3f" 12.12345) "12.123 ")) (Assert (string= (format "%g" 100.0) "100")) (Assert (string= (format "%g" 0.000001) "1e-06")) (Assert (string= (format "%g" 0.0001) "0.0001")) @@ -1039,7 +1045,7 @@ (Assert (string= (format "%.1d" 10) "10")) (Assert (string= (format "%.4d" 10) "0010")) ;; Combination of `-', `+', ` ', `0', `#', `.', `*' -(Assert (string= (format "%-04d" 10) "0010")) +(Assert (string= (format "%-04d" 10) "10 ")) (Assert (string= (format "%-*d" 4 10) "10 ")) ;; #### Correctness of this behavior is questionable. ;; It might be better to signal error. @@ -1052,11 +1058,16 @@ ;; (format "%-.1d" 10) (Assert (string= (format "%01.1d" 10) "10")) -(Assert (string= (format "%03.1d" 10) "010")) -(Assert (string= (format "%01.3d" 10) "10")) -(Assert (string= (format "%1.3d" 10) "10")) +(Assert (string= (format "%03.1d" 10) " 10")) +(Assert (string= (format "%01.3d" 10) "010")) +(Assert (string= (format "%1.3d" 10) "010")) (Assert (string= (format "%3.1d" 10) " 10")) +;;; The following two tests used to use 1000 instead of 100, +;;; but that merely found buffer overflow bugs in Solaris sprintf(). +(Assert (= 102 (length (format "%.100f" 3.14)))) +(Assert (= 100 (length (format "%100f" 3.14)))) + ;;; Check for 64-bit cleanness on LP64 platforms. (Assert (= (read (format "%d" most-positive-fixnum)) most-positive-fixnum)) (Assert (= (read (format "%ld" most-positive-fixnum)) most-positive-fixnum)) @@ -1071,3 +1082,7 @@ ;;; The printed value might be useful to a human, if not to Emacs Lisp. (Check-Error invalid-read-syntax (read (format "%u" most-negative-fixnum))) (Check-Error invalid-read-syntax (read (format "%u" -1))) + +;; Check all-completions ignore element start with space. +(Assert (not (all-completions "" '((" hidden" . "object"))))) +(Assert (all-completions " " '((" hidden" . "object"))))