@@ -209,6 +209,11 @@ fn assert_ssr_transform(rule: &str, input: &str, result: &str) {
209
209
assert_ssr_transforms ( & [ rule] , input, result) ;
210
210
}
211
211
212
+ fn normalize_code ( code : & str ) -> String {
213
+ let ( db, file_id) = single_file ( code) ;
214
+ db. file_text ( file_id) . to_string ( )
215
+ }
216
+
212
217
fn assert_ssr_transforms ( rules : & [ & str ] , input : & str , result : & str ) {
213
218
let ( db, file_id) = single_file ( input) ;
214
219
let mut match_finder = MatchFinder :: new ( & db) ;
@@ -217,8 +222,13 @@ fn assert_ssr_transforms(rules: &[&str], input: &str, result: &str) {
217
222
match_finder. add_rule ( rule) ;
218
223
}
219
224
if let Some ( edits) = match_finder. edits_for_file ( file_id) {
220
- let mut after = input. to_string ( ) ;
225
+ // Note, db.file_text is not necessarily the same as `input`, since fixture parsing alters
226
+ // stuff.
227
+ let mut after = db. file_text ( file_id) . to_string ( ) ;
221
228
edits. apply ( & mut after) ;
229
+ // Likewise, we need to make sure that whatever transformations fixture parsing applies,
230
+ // also get appplied to our expected result.
231
+ let result = normalize_code ( result) ;
222
232
assert_eq ! ( after, result) ;
223
233
} else {
224
234
panic ! ( "No edits were made" ) ;
0 commit comments