From 0ea11a4d134ebf94e4e14f71809cd953fbc1ca81 Mon Sep 17 00:00:00 2001 From: KtorZ Date: Thu, 8 Jun 2023 13:26:22 +0200 Subject: [PATCH] Introduce new test cases for hexadecimal and underscore parsing. --- crates/aiken-lang/src/tests/parser.rs | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/crates/aiken-lang/src/tests/parser.rs b/crates/aiken-lang/src/tests/parser.rs index b0d292df..46212792 100644 --- a/crates/aiken-lang/src/tests/parser.rs +++ b/crates/aiken-lang/src/tests/parser.rs @@ -3337,3 +3337,33 @@ fn brackets_followed_by_parenthesis() { } "#}); } + +#[test] +fn int_parsing_hex() { + let code = indoc! {r#" + fn foo() { + let i = 0xff + } + "#}; + assert_definitions(code, vec![]) +} + +#[test] +fn int_parsing_hex_bytes() { + let code = indoc! {r#" + fn foo() { + let bytes = [ 0x01, 0xa2, 0x03 ] + } + "#}; + assert_definitions(code, vec![]) +} + +#[test] +fn int_parsing_numeric_underscore() { + let code = indoc! {r#" + fn foo() { + let i = 1_234_567 + } + "#}; + assert_definitions(code, vec![]); +}