@@ -198,12 +198,11 @@ fn ssr_block_expr_match() {
198
198
199
199
#[ test]
200
200
fn ssr_let_stmt_replace ( ) {
201
- // FIXME: See remark above about trailing semicolons
202
- // assert_ssr_transform(
203
- // "let $a = $b ==>> let $a = 11",
204
- // "fn main() { let x = 10; x }",
205
- // expect![["fn main() { let x = 11; x }"]],
206
- // );
201
+ assert_ssr_transform (
202
+ "let $a = $b ==>> let $a = 11" ,
203
+ "fn main() { let x = 10; x }" ,
204
+ expect ! [ [ "fn main() { let x = 11; x }" ] ] ,
205
+ ) ;
207
206
208
207
// Pattern without trailing semicolon
209
208
// FIXME: This should fail, the expected value must be `let x = 11;;`
@@ -219,6 +218,30 @@ fn ssr_let_stmt_replace() {
219
218
"fn main() { let x = 10; x }" ,
220
219
expect ! [ [ "fn main() { let x = 11; x }" ] ] ,
221
220
) ;
221
+
222
+ // Trailing semicolon should be dropped from the new expression
223
+ assert_ssr_transform (
224
+ "let $a = $b; ==>> let $a = 11" ,
225
+ "fn main() { let x = 10; x }" ,
226
+ expect ! [ [ "fn main() { let x = 11 x }" ] ] ,
227
+ ) ;
228
+ }
229
+
230
+ #[ test]
231
+ fn ssr_let_stmt_replace_expr ( ) {
232
+ // Trailing semicolon should be dropped from the new expression
233
+ assert_ssr_transform (
234
+ "let $a = $b; ==>> $b" ,
235
+ "fn main() { let x = 10; }" ,
236
+ expect ! [ [ "fn main() { 10 }" ] ] ,
237
+ ) ;
238
+
239
+ // Trailing semicolon should _not_ be dropped from the new expression
240
+ assert_ssr_transform (
241
+ "let $a = $b ==>> $b" ,
242
+ "fn main() { let x = 10; }" ,
243
+ expect ! [ [ "fn main() { 10; }" ] ] ,
244
+ ) ;
222
245
}
223
246
224
247
#[ test]
0 commit comments