File tree 1 file changed +8
-0
lines changed
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -2317,6 +2317,7 @@ impl<'a> CstBuilder<'a> {
2317
2317
maybe_add_previous_text ( last_found_index, i) ;
2318
2318
container. raw_append_child ( CstNewline :: new ( CstNewlineKind :: CarriageReturnLineFeed ) . into ( ) ) ;
2319
2319
last_found_index = i + 2 ;
2320
+ chars. next ( ) ; // move past the \n
2320
2321
} else if c == '\n' {
2321
2322
maybe_add_previous_text ( last_found_index, i) ;
2322
2323
container. raw_append_child ( CstNewline :: new ( CstNewlineKind :: LineFeed ) . into ( ) ) ;
@@ -3594,6 +3595,12 @@ value3: true
3594
3595
}"#
3595
3596
) ;
3596
3597
}
3598
+ // \r\n newlines
3599
+ {
3600
+ let cst = build_cst ( "[ 1, 2, /* test */ 3 ]\r \n " ) ;
3601
+ cst. value ( ) . unwrap ( ) . as_array ( ) . unwrap ( ) . ensure_multiline ( ) ;
3602
+ assert_eq ! ( cst. to_string( ) , "[\r \n 1,\r \n 2,\r \n /* test */ 3\r \n ]\r \n " ) ;
3603
+ }
3597
3604
}
3598
3605
3599
3606
#[ test]
@@ -3852,6 +3859,7 @@ value3: true
3852
3859
}
3853
3860
}
3854
3861
3862
+ #[ track_caller]
3855
3863
fn build_cst ( text : & str ) -> CstRootNode {
3856
3864
CstRootNode :: parse ( text, & crate :: ParseOptions :: default ( ) ) . unwrap ( )
3857
3865
}
You can’t perform that action at this time.
0 commit comments