Revision: 6685 Author: ek.kato Date: Thu Aug 5 04:24:34 2010 Log: * Merge r6684 from trunk.
http://code.google.com/p/uim/source/detail?r=6685 Modified: /branches/1.6/scm/util.scm /branches/1.6/test/util/test-misc.scm ======================================= --- /branches/1.6/scm/util.scm Wed Aug 4 23:43:10 2010 +++ /branches/1.6/scm/util.scm Thu Aug 5 04:24:34 2010 @@ -255,7 +255,6 @@ (let ((paths (string-split (load-path) ":"))) (map (lambda (x) (string-append x "/" file)) paths))))) -;; TODO: write test ;; returns succeeded or not (define try-load (lambda (file) @@ -266,12 +265,13 @@ (rest (cdr paths))) ;; to suppress error message, check file existence first (if (file-readable? path) - (load path) + (begin + (load path) + #t) (if (not (null? rest)) (loop (car rest) (cdr rest)) #f))))))) -;; TODO: write test ;; returns succeeded or not (define try-require (lambda (file) ======================================= --- /branches/1.6/test/util/test-misc.scm Tue Jul 27 22:42:55 2010 +++ /branches/1.6/test/util/test-misc.scm Thu Aug 5 04:24:34 2010 @@ -262,4 +262,16 @@ (assert-uim-equal 5 '(clamp 10 -5 5)) #f) +(define (test-try-load) + (assert-uim-true-value '(try-load "anthy.scm")) + (assert-uim-false '(try-load "nonexistent.scm")) + (assert-uim-false '(try-load "scim.scm")) ;; try broken scim.scm + #f) + +(define (test-try-require) + (assert-uim-true-value '(try-require "anthy.scm")) + (assert-uim-false '(try-require "nonexistent.scm")) + (assert-uim-false '(try-require "scim.scm")) ;; try broken scim.scm + #f) + (provide "test/util/test-misc")
