Fix and run string tests.

This commit is contained in:
Dominik Pantůček 2023-04-11 14:00:28 +02:00
parent cf2913fdea
commit b2da67e4e0
3 changed files with 10 additions and 6 deletions

View file

@ -31,6 +31,7 @@
string-repeat
string-first+rest
string-utf8?
string-tests!
)
(import scheme
@ -62,13 +63,13 @@
;; Returns true, if given string contains UTF-8 characters
(define (string-utf8? str)
(let ((asciilen (string-length str))
(utf8len (length (irregex-extract (irregex "." 'u)))))
(utf8len (length (irregex-extract (irregex "." 'u) str))))
(not (= asciilen utf8len))))
;; Performs utils module self-tests.
(define (utils-tests!)
(define (string-tests!)
(run-tests
utils
util-string
(test-equal? string-repeat
(string-repeat "-" 4)
"----")