Skip to content

Commit fc90acf

Browse files
committed
Minor improvement to ports test runner and adds pure Scheme string-index
1 parent 3f8b45b commit fc90acf

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

ports/ports.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@
294294
(define (display-test-result-details test-results info)
295295
(for-each
296296
(lambda (test-result)
297-
(display "- " (string-append (test-full-name (test-result-test test-result)) "\n"))
297+
(display (string-append "- " (test-full-name (test-result-test test-result)) "\n"))
298298
(display (info test-result))
299299
(display "\n"))
300300
test-results))

ports/stdlib.scm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,12 @@
167167

168168
(define (string-prefix-ci? prefix string)
169169
(string-prefix? (string-downcase prefix) (string-downcase string)))
170+
171+
(define (string-index str substr)
172+
(define (string-index-help str substr index)
173+
(if (empty? str) #f
174+
(if (string-prefix? substr str) index
175+
(string-index-help (cdr str) substr (+ index 1)))))
176+
(string-index-help str substr 0))
170177

171178
)

0 commit comments

Comments
 (0)