Skip to content

Commit 5d4ee83

Browse files
Copilotjackfirth
andcommitted
Add test cases demonstrating expression and block comment preservation
- Added comment-preservation-test.rkt with 6 test cases - Tests show expression comments (#;) are preserved - Tests show block comments (#|) are preserved - All 1043 tests pass Co-authored-by: jackfirth <[email protected]>
1 parent adc0b3c commit 5d4ee83

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#lang resyntax/test
2+
3+
4+
require: resyntax/default-recommendations let-replacement
5+
6+
7+
header:
8+
- #lang racket/base
9+
10+
11+
test: "expression comments are preserved between let bindings"
12+
------------------------------
13+
(define (foo)
14+
(let ([x 1]
15+
#;(debug-binding [z 0])
16+
[y 2])
17+
(+ x y)))
18+
==============================
19+
(define (foo)
20+
(define x 1)
21+
#;(debug-binding [z 0])
22+
(define y 2)
23+
(+ x y))
24+
------------------------------
25+
26+
27+
test: "expression comments with atoms are preserved between let bindings"
28+
------------------------------
29+
(define (foo)
30+
(let ([x 1]
31+
#;unused-binding
32+
[y 2])
33+
(+ x y)))
34+
==============================
35+
(define (foo)
36+
(define x 1)
37+
#;unused-binding
38+
(define y 2)
39+
(+ x y))
40+
------------------------------
41+
42+
43+
test: "block comments are preserved between let bindings"
44+
------------------------------
45+
(define (foo)
46+
(let ([x 1]
47+
#| The second
48+
binding |#
49+
[y 2])
50+
(+ x y)))
51+
==============================
52+
(define (foo)
53+
(define x 1)
54+
#| The second
55+
binding |#
56+
(define y 2)
57+
(+ x y))
58+
------------------------------
59+
60+
61+
test: "expression comments with nested sexps are preserved"
62+
------------------------------
63+
(define (foo)
64+
(let ([x 1]
65+
#;(commented-binding
66+
[y 3]
67+
[z 4])
68+
[a 2])
69+
(+ x a)))
70+
==============================
71+
(define (foo)
72+
(define x 1)
73+
#;(commented-binding [y 3] [z 4])
74+
(define a 2)
75+
(+ x a))
76+
------------------------------
77+
78+
79+
test: "expression comments in let body are preserved"
80+
------------------------------
81+
(define (foo)
82+
(let ([x 1])
83+
#;(debug-stmt)
84+
(+ x 1)))
85+
==============================
86+
(define (foo)
87+
(define x 1)
88+
#;(debug-stmt)
89+
(+ x 1))
90+
------------------------------
91+
92+
93+
test: "block comments in let body are preserved"
94+
------------------------------
95+
(define (foo)
96+
(let ([x 1])
97+
#| computation |#
98+
(+ x 1)))
99+
==============================
100+
(define (foo)
101+
(define x 1)
102+
#| computation |#
103+
(+ x 1))
104+
------------------------------

0 commit comments

Comments
 (0)