Skip to content

Commit 4f82c31

Browse files
committed
Added test to check that newlines are stripped from comments
1 parent aef0581 commit 4f82c31

File tree

1 file changed

+9
-0
lines changed
  • src/libsyntax/parse/lexer

1 file changed

+9
-0
lines changed

src/libsyntax/parse/lexer/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,4 +1565,13 @@ mod tests {
15651565
assert_eq!(lexer.next_token().tok, token::Literal(token::Char(token::intern("a")), None));
15661566
}
15671567

1568+
#[test] fn crlf_comments() {
1569+
let sh = mk_sh();
1570+
let mut lexer = setup(&sh, "// test\r\n/// test\r\n".to_string());
1571+
let comment = lexer.next_token();
1572+
assert_eq!(comment.tok, token::Comment);
1573+
assert_eq!(comment.sp, ::codemap::mk_sp(BytePos(0), BytePos(7)));
1574+
assert_eq!(lexer.next_token().tok, token::Whitespace);
1575+
assert_eq!(lexer.next_token().tok, token::DocComment(token::intern("/// test")));
1576+
}
15681577
}

0 commit comments

Comments
 (0)