mes: with-input-from-string: peek fix.
* module/mes/guile.mes (with-input-from-string): Return actual tell. * tests/guile.test ("with-input-from-string peek"): Test it.
This commit is contained in:
parent
fd13741eb3
commit
28d0c259ed
|
@ -71,8 +71,9 @@
|
|||
(let ((tell 0)
|
||||
(end (string-length string)))
|
||||
(set! peek-char
|
||||
(lambda () (if (= tell end) (integer->char -1)
|
||||
(string-ref string (- tell 1)))))
|
||||
(lambda ()
|
||||
(if (= tell end) (integer->char -1)
|
||||
(string-ref string tell))))
|
||||
(set! read-char
|
||||
(lambda () (if (= tell end) (integer->char -1)
|
||||
(begin
|
||||
|
|
|
@ -112,4 +112,9 @@ exit $?
|
|||
(push-input sp)
|
||||
(and (pop-input) (not (pop-input)))))
|
||||
|
||||
(pass-if-equal "with-input-from-string peek"
|
||||
#\X
|
||||
(with-input-from-string "X"
|
||||
(lambda () (peek-char))))
|
||||
|
||||
(result 'report)
|
||||
|
|
Loading…
Reference in a new issue