mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-23 23:23:50 +03:00
enforce aleo prefix and character length
This commit is contained in:
parent
2c3c852ff4
commit
a0d294591e
@ -206,7 +206,7 @@ group_tuple = {"(" ~ value_number ~ "," ~ value_number ~ ")"}
|
||||
group_single_or_tuple = {value_number | group_tuple}
|
||||
|
||||
// Declared in values/address.rs
|
||||
address = @{ (LOWERCASE_LETTER | ASCII_DIGIT)+ }
|
||||
address = @{ "aleo" ~ ASCII_DIGIT ~ (LOWERCASE_LETTER | ASCII_DIGIT){58} }
|
||||
|
||||
// Declared in values/address_value.rs
|
||||
value_address = { type_address ~ "(" ~ address ~ ")" }
|
||||
|
3
compiler/tests/address/invalid_length.leo
Normal file
3
compiler/tests/address/invalid_length.leo
Normal file
@ -0,0 +1,3 @@
|
||||
function main() {
|
||||
let public_key_string = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j88);
|
||||
}
|
@ -13,11 +13,19 @@ fn test_valid() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid() {
|
||||
let bytes = include_bytes!("invalid.leo");
|
||||
let program = parse_program(bytes).unwrap();
|
||||
fn test_invalid_prefix() {
|
||||
let bytes = include_bytes!("invalid_prefix.leo");
|
||||
let syntax_error = parse_program(bytes).is_err();
|
||||
|
||||
let _output = expect_compiler_error(program);
|
||||
assert!(syntax_error);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_length() {
|
||||
let bytes = include_bytes!("invalid_length.leo");
|
||||
let syntax_error = parse_program(bytes).is_err();
|
||||
|
||||
assert!(syntax_error);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user