File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 103103 [(list #false _ ) (values accumulated piece)]
104104 [(list (inserted-string s1) (inserted-string s2))
105105 (values accumulated (inserted-string (string-append s1 s2)))]
106+ [(list (copied-string start1 end1) (copied-string start2 end2))
107+ #:when (equal? end1 start2)
108+ (values accumulated (copied-string start1 end2))]
106109 [(list _ _ ) (values (cons previous accumulated) piece)])))
107110 (define new-span (transduce content-list (mapping replacement-string-span) #:into into-sum))
108111 (define max-end
134137 #:contents initial-pieces))
135138 (check-equal? (string-replacement-contents replacement) expected-pieces))
136139
137- (test-case "should not merge copied pieces "
140+ (test-case "should merge adjacent copied pieces "
138141 (define initial-pieces
139142 (list (copied-string 2 5 ) (copied-string 5 7 ) (copied-string 7 9 )))
143+ (define expected-pieces (list (copied-string 2 9 )))
144+ (define replacement
145+ (string-replacement
146+ #:start 0
147+ #:end 10
148+ #:contents initial-pieces))
149+ (check-equal? (string-replacement-contents replacement) expected-pieces))
150+
151+ (test-case "should not merge non-adjacent copied pieces "
152+ (define initial-pieces
153+ (list (copied-string 2 5 ) (copied-string 6 8 ) (copied-string 10 12 )))
140154 (define replacement
141155 (string-replacement
142156 #:start 0
You can’t perform that action at this time.
0 commit comments