Author: koutou
Date: Sat Mar 21 21:01:58 2009
New Revision: 5908

Modified:
   trunk/test/uim-assertions.scm
   trunk/test/uim-test-utils-new.scm
   trunk/test/util/test-string.scm

Log:
* test/uim-assertions.scm, test/uim-test-utils-new.scm:
  support CES converted uim-sh communication.
* test/util/test-string.scm: resolve EUC-JP related TODO.


Modified: trunk/test/uim-assertions.scm
==============================================================================
--- trunk/test/uim-assertions.scm       (original)
+++ trunk/test/uim-assertions.scm       Sat Mar 21 21:01:58 2009
@@ -51,6 +51,12 @@
 (define (assert-uim-raw-false uim-expression-string)
   (assert-false (uim-raw uim-expression-string)))

+(define (assert-uim-equal-ces expected uim-expression ces)
+  (assert-equal expected (uim-ces uim-expression ces)))
+
+(define (assert-uim-equal-euc-jp expected uim-expression)
+  (assert-uim-equal-ces expected uim-expression "euc-jp"))
+
 (define (assert-uim-error uim-expression)
   (assert-error (lambda () (uim uim-expression))))


Modified: trunk/test/uim-test-utils-new.scm
==============================================================================
--- trunk/test/uim-test-utils-new.scm   (original)
+++ trunk/test/uim-test-utils-new.scm   Sat Mar 21 21:01:58 2009
@@ -30,6 +30,7 @@
 (define-module test.uim-test-utils-new
   (use gauche.process)
   (use gauche.selector)
+  (use gauche.charconv)
   (use gauche.version)
   (use srfi-1)
   (use srfi-13)
@@ -109,6 +110,19 @@

 (define (uim-raw string)
   (uim-read-from-string (uim-eval-raw string)))
+
+(define (uim-eval-ces sexp uim-sh-ces)
+  (call-with-output-conversion (process-input *uim-sh-process*)
+    (lambda (uim-sh-input)
+      (uim-sh-write sexp uim-sh-input))
+    :encoding uim-sh-ces)
+  (call-with-input-conversion (process-output *uim-sh-process*)
+    (lambda (uim-sh-output)
+      (uim-sh-read-block uim-sh-output))
+    :encoding uim-sh-ces))
+
+(define (uim-ces sexp ces)
+  (uim-read-from-string (uim-eval-ces sexp ces)))

 (define (uim-bool sexp)
   (not (not (uim sexp))))

Modified: trunk/test/util/test-string.scm
==============================================================================
--- trunk/test/util/test-string.scm     (original)
+++ trunk/test/util/test-string.scm     Sat Mar 21 21:01:58 2009
@@ -164,17 +164,17 @@
                     '(string-to-list "st"))
   (assert-uim-equal '("g" "n" "i" "r" "t" "s")
                     '(string-to-list "string"))
-  ;; TODO: activate following EUC-JP string test
-;;   (assert-uim-equal '("あ")
-;;                     '(string-to-list "あ"))
-;;   (assert-uim-equal '("あ" "a")
-;;                     '(string-to-list "aあ"))
-;;   (assert-uim-equal '("a" "あ")
-;;                     '(string-to-list "あa"))
-;;   (assert-uim-equal '("語" "本" "日")
-;;                     '(string-to-list "日本語"))
-;;   (assert-uim-equal '("c" "語" "本" "b" "日" "a")
-;;                     '(string-to-list "a日b本語c"))
+
+  (assert-uim-equal-euc-jp '("あ")
+                           '(string-to-list "あ"))
+  (assert-uim-equal-euc-jp '("あ" "a")
+                           '(string-to-list "aあ"))
+  (assert-uim-equal-euc-jp '("a" "あ")
+                           '(string-to-list "あa"))
+  (assert-uim-equal-euc-jp '("語" "本" "日")
+                           '(string-to-list "日本語"))
+  (assert-uim-equal-euc-jp '("c" "語" "本" "b" "日" "a")
+                           '(string-to-list "a日b本語c"))
   #f)

 (define (test-string-contains)

Reply via email to