File tree Expand file tree Collapse file tree 4 files changed +63
-71
lines changed
Expand file tree Collapse file tree 4 files changed +63
-71
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,18 @@ test: "nested ands interspersed with ors can be flattened"
7070- (and 1 2 (or 3 4 ) 5 6 )
7171
7272
73+ test: "refactoring an expression doesn't affect formatting of unrefactored code "
74+ ----------------------------------------
75+ ( displayln "foo " )
76+ (or 1 (or 2 3 ))
77+ ( displayln "bar " )
78+ ========================================
79+ ( displayln "foo " )
80+ (or 1 2 3 )
81+ ( displayln "bar " )
82+ ----------------------------------------
83+
84+
7385test: "using if to convert a boolean expression to a boolean can be removed "
7486- (if (string? "foo " ) #true #false )
7587- (string? "foo " )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -297,3 +297,25 @@ no-change-test: "and with more than two arguments should not be refactored"
297297(and 'some-condition 'another-condition (let ([x 42 ]) (* x 2 )))
298298------------------------------
299299
300+
301+ test: "cond-let-to-cond-define doesn't reformat the entire cond expression "
302+ ----------------------------------------
303+ (define (f c1 c2)
304+ (cond
305+ [c1 ( displayln "foo " )]
306+ [c2
307+ ( displayln "bar " )
308+ (let ([x 1 ])
309+ (* x 2 ))]
310+ [else ( displayln "else " )]))
311+ ========================================
312+ (define (f c1 c2)
313+ (cond
314+ [c1 ( displayln "foo " )]
315+ [c2
316+ ( displayln "bar " )
317+ (define x 1 )
318+ (* x 2 )]
319+ [else ( displayln "else " )]))
320+ ----------------------------------------
321+
Original file line number Diff line number Diff line change @@ -625,3 +625,32 @@ test: "let binding with body nested in begin0 extractable to definition and body
625625 (displayln "bar " )))
626626------------------------------
627627
628+
629+ test: "let-to-define doesn't reformat the entire definition context "
630+ ----------------------------------------
631+ (define (f)
632+ ( displayln "foo " )
633+ (let ([x 1 ])
634+ (* x 2 )))
635+ ========================================
636+ (define (f)
637+ ( displayln "foo " )
638+ (define x 1 )
639+ (* x 2 ))
640+ ----------------------------------------
641+
642+
643+ test: "define-let-to-double-define doesn't reformat the entire definition context "
644+ ----------------------------------------
645+ (define (f)
646+ ( displayln "foo " )
647+ (define y (let ([x 1 ]) (* x 2 )))
648+ ( displayln "bar " ))
649+ ========================================
650+ (define (f)
651+ ( displayln "foo " )
652+ (define x 1 )
653+ (define y (* x 2 ))
654+ ( displayln "bar " ))
655+ ----------------------------------------
656+
You can’t perform that action at this time.
0 commit comments