Author: ek.kato
Date: Sat Oct 25 01:12:29 2008
New Revision: 5609

Modified:
   trunk/test/Makefile.am
   trunk/test/run-test.scm
   trunk/test/test-util.scm
   trunk/test/uim-test-utils.scm

Log:
* test/uim-test-utils.scm
* test/run-test.scm
* test/Makefile.am
* test/test-util.scm
  - Apply patch from Kouhei Sutou ([uim-ja 99]
    http://www.mail-archive.com/[EMAIL PROTECTED]/msg00082.html).


Modified: trunk/test/Makefile.am
==============================================================================
--- trunk/test/Makefile.am      (original)
+++ trunk/test/Makefile.am      Sat Oct 25 01:12:29 2008
@@ -5,3 +5,5 @@
         test-uim-test-utils.scm test-uim-util.scm test-ustr.scm \
         test-util.scm test-example.scm \
        test-anthy.scm test-ng-key.scm
+
+TESTS = run-test.scm

Modified: trunk/test/run-test.scm
==============================================================================
--- trunk/test/run-test.scm     (original)
+++ trunk/test/run-test.scm     Sat Oct 25 01:12:29 2008
@@ -33,20 +33,19 @@
 (use file.util)
 (use test.unit)

-(add-load-path ".")
+(define (uim-test-build-path . components)
+  (let* ((test-dir (sys-dirname *program-name*))
+         (top-dir (sys-realpath (build-path test-dir ".."))))
+    (apply build-path top-dir components)))

-(if (symbol-bound? 'main)
-    (define _main main))
+(define-macro (%add-top-path-to-load-path)
+  `(add-load-path ,(uim-test-build-path)))
+(%add-top-path-to-load-path)

+(define gaunit-main main)
 (define (main args)
-  (let ((dir (sys-dirname (car args))))
-    (for-each (lambda (test-script)
-                (load (string-join (list dir test-script) "/")))
-              (directory-list dir
-                              :filter (lambda (x)
-                                        (and (rxmatch #/^test-.+\.scm$/ x)
-                                            (not (string=? "test-example.scm"
-                                                           x))))))
-    (if (symbol-bound? '_main)
-        (_main `(,(car args) "-vp" ,@(cdr args)))
-        (run-all-test))))
+  (gaunit-main
+   (append args
+           (if (symbol-bound? 'glob)
+             (glob (uim-test-build-path "test" "**" "test-*.scm"))
+             (sys-glob (uim-test-build-path "test" "test-*.scm"))))))

Modified: trunk/test/test-util.scm
==============================================================================
--- trunk/test/test-util.scm    (original)
+++ trunk/test/test-util.scm    Sat Oct 25 01:12:29 2008
@@ -1095,7 +1095,7 @@
                 (uim '(string-escape "\a\B")))
    ;; complex
    (assert-equal "\"\\\"a string\\\" in two-line\\nstring\\n\""
-                (uim '(string-escape "\"a\ string\" in two-line\nstring\n"))))
+                (uim '(string-escape "\"a string\" in two-line\nstring\n"))))

   ("test compose"
    (uim '(define test-list '(0 1 2 3 4 5)))

Modified: trunk/test/uim-test-utils.scm
==============================================================================
--- trunk/test/uim-test-utils.scm       (original)
+++ trunk/test/uim-test-utils.scm       Sat Oct 25 01:12:29 2008
@@ -41,12 +41,10 @@
 (if (version<? *gaunit-version* "0.1.1")
     (error "GaUnit 0.1.1 is required"))

-(sys-putenv "LIBUIM_SYSTEM_SCM_FILES" (string-append (sys-realpath ".")
-                                                    "/sigscheme/lib"))
-(sys-putenv "LIBUIM_SCM_FILES" (string-append (sys-realpath ".") "/scm"))
+(sys-putenv "LIBUIM_SYSTEM_SCM_FILES" (uim-test-build-path "sigscheme" "lib"))
+(sys-putenv "LIBUIM_SCM_FILES" (uim-test-build-path "scm"))
 ;; FIXME: '.libs' is hardcoded
-(sys-putenv "LIBUIM_PLUGIN_LIB_DIR"
-           (string-append (sys-realpath ".") "/uim/.libs"))
+(sys-putenv "LIBUIM_PLUGIN_LIB_DIR" (uim-test-build-path "uim" ".libs"))
 (sys-putenv "LIBUIM_VERBOSE" "2")  ;; must be 1 or 2 (2 enables backtrace)
 (sys-putenv "LIBUIM_VANILLA" "1")

@@ -124,9 +122,9 @@
       #t)))

 (eval
-   '(begin
+   `(begin
       (define (*uim-sh-setup-proc*)
-        (set! *uim-sh-process* (run-process "uim/uim-sh"
+ (set! *uim-sh-process* (run-process ,(uim-test-build-path "uim" "uim-sh")
                                             "-b"
                                             :input :pipe
                                             :output :pipe))

Reply via email to