mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-01 18:56:38 +03:00
commit
ba23ea3832
@ -15,6 +15,7 @@ impl From<Error<Rule>> for SyntaxError {
|
||||
Rule::type_integer => "`u32`".to_owned(),
|
||||
Rule::type_field => "`field`".to_owned(),
|
||||
Rule::type_group => "`group`".to_owned(),
|
||||
Rule::address => "an aleo address: `aleo1...`".to_owned(),
|
||||
Rule::file => "an import, circuit, or function".to_owned(),
|
||||
Rule::identifier => "a variable name".to_owned(),
|
||||
Rule::type_ => "a type".to_owned(),
|
||||
|
@ -209,7 +209,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/empty.leo
Normal file
3
compiler/tests/address/empty.leo
Normal file
@ -0,0 +1,3 @@
|
||||
function main() {
|
||||
let owner = 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,27 @@ 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]
|
||||
fn test_empty() {
|
||||
let bytes = include_bytes!("empty.leo");
|
||||
let syntax_error = parse_program(bytes).is_err();
|
||||
|
||||
assert!(syntax_error);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user