70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
(define (tests:filter-test-names test-names test-patts)
(delete-duplicates
(filter (lambda (testname)
(tests:match test-patts testname #f))
test-names)))
;; tests:glob-like-match
(define (tests:glob-like-match patt str)
(let ((like (substring-index "%" patt)))
(let* ((notpatt (equal? (substring-index "~" patt) 0))
(newpatt (if notpatt (substring patt 1) patt))
(finpatt (if like
(string-substitute (regexp "%") ".*" newpatt #f)
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
(define (tests:filter-test-names test-names test-patts)
(delete-duplicates
(filter (lambda (testname)
(tests:match test-patts testname #f))
test-names)))
;; given test-b that is waiting on test-a extend test-patt appropriately
;;
(define (tests:extend-test-patts test-patt test-b test-a itemmap)
(let* ((patts (string-split test-patt ","))
(test-b-len (+ (string-length test-b) 1))
(patts-b (map (lambda (x)
(let ((newpatt (conc test-a "/" (substring x test-b-len (string-length x)))))
(print "in map, x=" x ", newpatt=" newpatt)
newpatt))
(filter (lambda (x)
(eq? (substring-index (conc test-b "/") x) 0))
patts))))
(string-intersperse (delete-duplicates (append patts patts-b)) ",")))
;; tests:glob-like-match
(define (tests:glob-like-match patt str)
(let ((like (substring-index "%" patt)))
(let* ((notpatt (equal? (substring-index "~" patt) 0))
(newpatt (if notpatt (substring patt 1) patt))
(finpatt (if like
(string-substitute (regexp "%") ".*" newpatt #f)
|