mirror of
https://github.com/AleoHQ/leo.git
synced 2025-01-02 23:04:12 +03:00
add test for const self, no clippy issues locally
This commit is contained in:
parent
128eb60dfb
commit
793cbb9f27
13
compiler/tests/circuits/const_self_variable_fail.leo
Normal file
13
compiler/tests/circuits/const_self_variable_fail.leo
Normal file
@ -0,0 +1,13 @@
|
||||
circuit Foo {
|
||||
a: u8,
|
||||
|
||||
function set_a(const self, new: u8) {
|
||||
self.a = new;
|
||||
}
|
||||
}
|
||||
|
||||
function main() {
|
||||
let f = Foo { a: 0u8 };
|
||||
|
||||
f.set_a(1u8);
|
||||
}
|
@ -132,6 +132,15 @@ fn test_member_static_function_undefined() {
|
||||
expect_asg_error(error)
|
||||
}
|
||||
|
||||
// Constant
|
||||
#[test]
|
||||
fn test_const_self_variable_fail() {
|
||||
let program_string = include_str!("const_self_variable_fail.leo");
|
||||
let error = parse_program(program_string).err().unwrap();
|
||||
|
||||
expect_asg_error(error);
|
||||
}
|
||||
|
||||
// Mutability
|
||||
|
||||
#[test]
|
||||
|
@ -19,11 +19,7 @@ circuit PedersenHash {
|
||||
|
||||
// The 'pedersen-hash' main function.
|
||||
function main(hash_input: [bool; 256], const parameters: [group; 256]) -> group {
|
||||
<<<<<<< HEAD
|
||||
const pedersen = PedersenHash::new(parameters);
|
||||
=======
|
||||
let pedersen = PedersenHash::new(parameters);
|
||||
>>>>>>> 9b61d0fa152f435e3e165090455c85eedeb9b770
|
||||
return pedersen.hash(hash_input)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user