Fix and run string tests.
This commit is contained in:
parent
cf2913fdea
commit
b2da67e4e0
3 changed files with 10 additions and 6 deletions
|
@ -302,7 +302,8 @@ TESTS-SOURCES=tests.scm listing.import.scm util-dict-list.import.scm \
|
|||
ansi.import.scm command-line.import.scm \
|
||||
members-dir.import.scm primes.import.scm \
|
||||
member-record.import.scm table.import.scm util-csv.import.scm \
|
||||
util-set-list.import.scm util-parser.import.scm
|
||||
util-set-list.import.scm util-parser.import.scm \
|
||||
util-string.import.scm
|
||||
|
||||
tests.o: tests.import.scm
|
||||
tests.import.scm: $(TESTS-SOURCES)
|
||||
|
|
|
@ -45,7 +45,8 @@
|
|||
table
|
||||
util-csv
|
||||
util-set-list
|
||||
util-parser)
|
||||
util-parser
|
||||
util-string)
|
||||
|
||||
(define (run-all-tests!)
|
||||
(listing-tests!)
|
||||
|
@ -61,6 +62,7 @@
|
|||
(table-tests!)
|
||||
(csv-simple-tests!)
|
||||
(lset-tests!)
|
||||
(parser-tests!))
|
||||
(parser-tests!)
|
||||
(string-tests!))
|
||||
|
||||
)
|
||||
|
|
|
@ -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)
|
||||
"----")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue