mes: open-input-string: peek fix.

* module/mes/guile.mes (open-input-string): Return actual tell.
* tests/guile.test ("open-input-string peek"): Test it.
This commit is contained in:
Jan Nieuwenhuizen 2018-01-04 19:32:35 +01:00
parent 28d0c259ed
commit 0e06928320
2 changed files with 7 additions and 1 deletions

View File

@ -148,7 +148,7 @@
(set! tell 0)
(set! peek-char
(lambda () (if (= tell end) (integer->char -1)
(string-ref string (- tell 1)))))
(string-ref string tell))))
(set! read-char
(lambda () (if (= tell end) (integer->char -1)
(begin

View File

@ -117,4 +117,10 @@ exit $?
(with-input-from-string "X"
(lambda () (peek-char))))
(pass-if-equal "open-input-string peek"
#\X
(let ((port (open-input-string "X")))
(set-current-input-port port)
(peek-char)))
(result 'report)