mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 21:40:33 +02:00
(string-for-each, string-for-each-index): Add tests.
This commit is contained in:
parent
4cf7528804
commit
e5c5ac9240
1 changed files with 22 additions and 4 deletions
|
@ -1021,3 +1021,21 @@
|
|||
|
||||
(pass-if "upcase"
|
||||
(string=? "FOO" (string-map char-upcase "foo"))))
|
||||
|
||||
(with-test-prefix "string-for-each"
|
||||
|
||||
(pass-if "copy"
|
||||
(let* ((foo "foo")
|
||||
(bar (make-string (string-length foo)))
|
||||
(i 0))
|
||||
(string-for-each
|
||||
(lambda (c) (string-set! bar i c) (set! i (1+ i))) foo)
|
||||
(string=? foo bar)))
|
||||
|
||||
(pass-if "index"
|
||||
(let* ((foo "foo")
|
||||
(bar (make-string (string-length foo))))
|
||||
(string-for-each-index
|
||||
(lambda (i) (string-set! bar i (string-ref foo i))) foo)
|
||||
(string=? foo bar))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue