Skip to content

Commit 21c180e

Browse files
committed
chore: add test for consecutive newlines
1 parent c781c17 commit 21c180e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

crates/pglt_lexer/src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,22 @@ mod tests {
212212
assert_eq!(tokens[1].kind, SyntaxKind::Newline);
213213
}
214214

215+
#[test]
216+
fn test_consecutive_newlines() {
217+
// Test with multiple consecutive newlines
218+
#[cfg(windows)]
219+
let input = "select\r\n\r\n1";
220+
#[cfg(not(windows))]
221+
let input = "select\n\n1";
222+
223+
let tokens = lex(input).unwrap();
224+
225+
// Check that we have exactly one newline token between "select" and "1"
226+
assert_eq!(tokens[0].kind, SyntaxKind::Select);
227+
assert_eq!(tokens[1].kind, SyntaxKind::Newline);
228+
assert_eq!(tokens[2].kind, SyntaxKind::Iconst);
229+
}
230+
215231
#[test]
216232
fn test_whitespace_tokens() {
217233
let input = "select 1";

0 commit comments

Comments
 (0)