diff --git a/CHANGELOG.md b/CHANGELOG.md index be3dcc1a..fed5257d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ - **aiken-lang**: the keyword `fail` on property-based test semantic has changed and now consider a test to succeed only if **every** execution of the test failed (instead of just one). The previous behavior can be recovered by adding the keyword `once` after `fail`. @KtorZ +### Fixed + +- **aiken-lang**: fixed the number of 'after x tests' number reported on property test failure, which was off by one. @KtorZ +- **aiken-lang**: fixed parsing of single hex digits. @KtorZ + ## v1.0.28-alpha - 2024-05-23 ### Added diff --git a/crates/aiken-lang/src/parser/lexer.rs b/crates/aiken-lang/src/parser/lexer.rs index 097ec4fd..d5fd978d 100644 --- a/crates/aiken-lang/src/parser/lexer.rs +++ b/crates/aiken-lang/src/parser/lexer.rs @@ -112,7 +112,7 @@ pub fn lexer() -> impl Parser, Error = ParseError> { .ignore_then( one_of("0123456789abcdefABCDEF") .repeated() - .at_least(2) + .at_least(1) .collect::(), ) .validate(|value: String, span, emit| { diff --git a/crates/aiken-lang/src/tests/format.rs b/crates/aiken-lang/src/tests/format.rs index d82e0270..ce0b7128 100644 --- a/crates/aiken-lang/src/tests/format.rs +++ b/crates/aiken-lang/src/tests/format.rs @@ -11,6 +11,18 @@ fn format_comment_at_end_of_file() { ); } +#[test] +fn format_single_hex_digit() { + assert_format!( + r#" + const a = 0xa + const b = 0x0f + const c = 0x0000000f + const d = 0x123 + "# + ); +} + #[test] fn format_simple_module() { assert_format!( diff --git a/crates/aiken-lang/src/tests/snapshots/format_single_hex_digit.snap b/crates/aiken-lang/src/tests/snapshots/format_single_hex_digit.snap new file mode 100644 index 00000000..9b355d0a --- /dev/null +++ b/crates/aiken-lang/src/tests/snapshots/format_single_hex_digit.snap @@ -0,0 +1,11 @@ +--- +source: crates/aiken-lang/src/tests/format.rs +description: "Code:\n\nconst a = 0xa\nconst b = 0x0f\nconst c = 0x0000000f\nconst d = 0x123\n" +--- +const a = 0xa + +const b = 0xf + +const c = 0xf + +const d = 0x123