[Gauche-devel-jp] Re: Cygwin(Unix)上でのport-current-line

Back to archive index

HIRAUCHI Hideyuki hira****@verys*****
2004年 2月 14日 (土) 13:14:32 JST


平内です。

read-char以外で読み込んだときに問題があるようです。

以下、テスト結果。

test port-current-line (read-char), expects 4 ==> ok
test port-current-line (read-line), expects 4 ==> ERROR: GOT 1
test port-current-line (read-byte), expects 4 ==> ERROR: GOT 1
test port-current-line (read-block), expects 4 ==> ERROR: GOT 1

以下、テストプログラム。

(use gauche.test)

(with-output-to-file "tmp1.o" (lambda () (newline)(newline)(newline)))

(define (port-current-line-tester reader)
  (call-with-input-file "tmp1.o"
    (lambda (p)
      (let loop ((cl (port-current-line p)))
        (if (eof-object? (reader p))
            cl
            (loop (port-current-line p)))))))

(test* "port-current-line (read-char)" 4
       (port-current-line-tester read-char))

(test* "port-current-line (read-line)" 4
       (port-current-line-tester read-line))

(test* "port-current-line (read-byte)" 4
       (port-current-line-tester read-byte))

(test* "port-current-line (read-block)" 4
       (port-current-line-tester (lambda (p) (read-block 1 p))))

--hira




Gauche-devel-jp メーリングリストの案内
Back to archive index