File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
crates/pglt_statement_splitter/src Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,12 @@ mod tests {
114114 ] ) ;
115115 }
116116
117+ #[ test]
118+ fn single_newlines ( ) {
119+ Tester :: from ( "select 1\n from contact\n \n select 3" )
120+ . expect_statements ( vec ! [ "select 1\n from contact" , "select 3" ] ) ;
121+ }
122+
117123 #[ test]
118124 fn alter_column ( ) {
119125 Tester :: from ( "alter table users alter column email drop not null;" )
Original file line number Diff line number Diff line change @@ -183,6 +183,17 @@ impl Parser {
183183 }
184184}
185185
186+ #[ cfg( windows) ]
187+ /// Returns true if the token is relevant for the paring process
188+ ///
189+ /// On windows, a newline is represented by `\r\n` which is two characters.
190+ fn is_irrelevant_token ( t : & Token ) -> bool {
191+ WHITESPACE_TOKENS . contains ( & t. kind )
192+ && ( t. kind != SyntaxKind :: Newline || t. text == "\r \n " || t. text . chars . count ( ) == 1 )
193+ }
194+
195+ #[ cfg( not( windows) ) ]
196+ /// Returns true if the token is relevant for the paring process
186197fn is_irrelevant_token ( t : & Token ) -> bool {
187198 WHITESPACE_TOKENS . contains ( & t. kind )
188199 && ( t. kind != SyntaxKind :: Newline || t. text . chars ( ) . count ( ) == 1 )
You can’t perform that action at this time.
0 commit comments