Skip to content

Commit

Permalink
✅ ensure lexer skips comments correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
KPMGE committed Mar 26, 2024
1 parent 2d112ab commit b6f4351
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,15 @@ fn given_code_with_a_strinig_it_should_parse_correctly() {

assert!(token == expected_token);
}

#[test]
fn given_code_with_comments_it_should_parse_correctly() {
let code = "/*any comment*/1";

let mut lexer = Lexer::new(code.to_string());

let token = lexer.next_token();
let expected_token = Token::Int(1.to_string());

assert!(token == expected_token);
}

0 comments on commit b6f4351

Please sign in to comment.