mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-26 08:30:59 +03:00
Add tests for undefined types
This commit is contained in:
parent
a26c452de2
commit
a69954b64a
14
tests/compiler/circuits/unknown_member_type_fail.leo
Normal file
14
tests/compiler/circuits/unknown_member_type_fail.leo
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
circuit Foo {
|
||||
a: u8,
|
||||
bar: Bar,
|
||||
}
|
||||
|
||||
@program
|
||||
function main(a: u8) -> u8 {
|
||||
return a + 1u8;
|
||||
}
|
14
tests/compiler/function/unknown_parameter_type_fail.leo
Normal file
14
tests/compiler/function/unknown_parameter_type_fail.leo
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
@program
|
||||
function main(a: u8, foo: Foo) -> u8 {
|
||||
return a;
|
||||
}
|
||||
|
||||
@program
|
||||
function returns_foo(a: u8) -> Foo {
|
||||
return a;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
input_file: inputs/dummy.in
|
||||
*/
|
||||
|
||||
@program
|
||||
function main(k: bool) -> bool {
|
||||
let b: Foo = 1u8;
|
||||
return k == true;
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372017]: The type `Bar` is not found in the current scope.\n --> compiler-test:3:1\n |\n 3 | circuit Foo {\n 4 | a: u8,\n 5 | bar: Bar,\n 6 | }\n | ^\n"
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:4:22\n |\n 4 | function main(a: u8, foo: Foo) -> u8 {\n | ^^^\nError [ETYC0372003]: Expected type `circuit Foo` but type `u8` was found\n --> compiler-test:9:22\n |\n 9 | function returns_foo(a: u8) -> Foo {\n | ^\nError [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:9:1\n |\n 9 | function returns_foo(a: u8) -> Foo {\n 10 | return a;\n 11 | }\n | ^\n"
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:5:2\n |\n 5 | \tlet b: Foo = 1u8;\n | ^^^^^^^^^^^^^^^^\nError [ETYC0372003]: Expected type `circuit Foo` but type `u8` was found\n --> compiler-test:5:15\n |\n 5 | \tlet b: Foo = 1u8;\n | ^^^\n"
|
Loading…
Reference in New Issue
Block a user