mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-22 22:44:47 +03:00
Add tests for using LocatorExpression out of place
This commit is contained in:
parent
1434e0a610
commit
ed085666a3
@ -17,7 +17,7 @@
|
||||
use super::*;
|
||||
use leo_errors::{ParserError, Result};
|
||||
|
||||
use leo_span::{sym, Symbol};
|
||||
use leo_span::sym;
|
||||
use snarkvm::console::{account::Address, network::Testnet3};
|
||||
|
||||
const INT_TYPES: &[Token] = &[
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372005]: Unknown variable `users`\n --> compiler-test:7:22\n |\n 7 | let a: u32 = relay.aleo/users;\n | ^^^^^^^^^^^^^^^^\nError [ETYC0372005]: Unknown variable `users`\n --> compiler-test:11:35\n |\n 11 | let a:bool = Mapping::get(relay.aleo/users, addr);\n | ^^^^^^^^^^^^^^^^\n"
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [EPAR0370005]: expected 'address', 'bool', 'field', 'group', 'scalar', 'signature', 'string', 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128' -- found 'mapping'\n --> test:7:16\n |\n 7 | let a: mapping = relay.aleo/users;\n | ^^^^^^^"
|
16
tests/tests/compiler/mappings/locator_expression_fail.leo
Normal file
16
tests/tests/compiler/mappings/locator_expression_fail.leo
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
program relay.aleo {
|
||||
mapping users: address => bool;
|
||||
|
||||
transition send(addr: address) {
|
||||
let a: u32 = relay.aleo/users;
|
||||
return then finalize(addr);
|
||||
}
|
||||
finalize send(addr: address) {
|
||||
let a:bool = Mapping::get(relay.aleo/users, addr);
|
||||
}
|
||||
}
|
16
tests/tests/parser/program/locator_expression_fail.leo
Normal file
16
tests/tests/parser/program/locator_expression_fail.leo
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
namespace: Parse
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
program relay.aleo {
|
||||
mapping users: address => bool;
|
||||
|
||||
transition send(addr: address) {
|
||||
let a: mapping = relay.aleo/users;
|
||||
return then finalize(addr);
|
||||
}
|
||||
finalize send(addr: address) {
|
||||
let a:bool = Mapping::get(relay.aleo/users, addr);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user