From 972fbfa0463879eaa591cdbda71b33127acebdb9 Mon Sep 17 00:00:00 2001 From: azjezz Date: Wed, 7 Dec 2022 09:01:54 +0100 Subject: [PATCH] chore: fix tests Signed-off-by: azjezz --- Justfile | 8 +++--- src/lexer/mod.rs | 5 ---- tests/fixtures/0268/ast.txt | 18 +++++++++++++ tests/fixtures/0268/tokens.txt | 48 ++++++++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 9 deletions(-) create mode 100644 tests/fixtures/0268/ast.txt create mode 100644 tests/fixtures/0268/tokens.txt diff --git a/Justfile b/Justfile index 449b411..5a5cfce 100644 --- a/Justfile +++ b/Justfile @@ -20,13 +20,13 @@ fix: cargo clippy --fix --allow-dirty --allow-staged # dump AST for the given file. -dump file: build +dump file: cargo run --bin php-parser-rs -- {{file}} # run all integration tests, except third-party. -test filter='': build +test filter='': cargo test --all {{filter}} -- --skip third_party # run integration tests for third-party libraries. -test-third-party: build - cargo test third_party +test-third-party: + cargo test third_party -- --nocapture diff --git a/src/lexer/mod.rs b/src/lexer/mod.rs index aa964e4..9fc5bbd 100644 --- a/src/lexer/mod.rs +++ b/src/lexer/mod.rs @@ -1337,11 +1337,6 @@ impl Lexer { | [b'e' | b'E', b'0'..=b'9', ..] ); if !is_float { - let base = if kind == NumberKind::OctalOrFloat { - 8 - } else { - 10 - }; return parse_int(&buffer); } diff --git a/tests/fixtures/0268/ast.txt b/tests/fixtures/0268/ast.txt new file mode 100644 index 0000000..b5e4dbe --- /dev/null +++ b/tests/fixtures/0268/ast.txt @@ -0,0 +1,18 @@ +[ + While { + condition: Variable( + Variable { + start: ( + 3, + 8, + ), + name: "foo", + end: ( + 3, + 12, + ), + }, + ), + body: [], + }, +] diff --git a/tests/fixtures/0268/tokens.txt b/tests/fixtures/0268/tokens.txt new file mode 100644 index 0000000..29ecceb --- /dev/null +++ b/tests/fixtures/0268/tokens.txt @@ -0,0 +1,48 @@ +[ + Token { + kind: OpenTag( + Full, + ), + span: ( + 1, + 1, + ), + }, + Token { + kind: While, + span: ( + 3, + 1, + ), + }, + Token { + kind: LeftParen, + span: ( + 3, + 7, + ), + }, + Token { + kind: Variable( + "foo", + ), + span: ( + 3, + 8, + ), + }, + Token { + kind: RightParen, + span: ( + 3, + 12, + ), + }, + Token { + kind: SemiColon, + span: ( + 3, + 13, + ), + }, +]