mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-26 16:37:30 +03:00
Add more test cases checking for member records
This commit is contained in:
parent
8caafb78d5
commit
64cecda841
@ -3,13 +3,9 @@ namespace: Compile
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
record Foo {
|
||||
// The token owner.
|
||||
owner: address,
|
||||
// The Aleo balance (in gates).
|
||||
gates: u64,
|
||||
circuit Foo {
|
||||
// The token amount.
|
||||
amount: u64,
|
||||
token: Token,
|
||||
}
|
||||
|
||||
record Token {
|
||||
@ -19,4 +15,4 @@ record Token {
|
||||
gates: u64,
|
||||
// The token amount.
|
||||
foo: Foo,
|
||||
}
|
||||
}
|
16
tests/compiler/records/nested_record_1_fail.leo
Normal file
16
tests/compiler/records/nested_record_1_fail.leo
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
record Foo {
|
||||
owner: address,
|
||||
gates: u64,
|
||||
amount: u64,
|
||||
}
|
||||
|
||||
record Token {
|
||||
owner: address,
|
||||
gates: u64,
|
||||
foo: Foo,
|
||||
}
|
17
tests/compiler/records/nested_record_2_fail.leo
Normal file
17
tests/compiler/records/nested_record_2_fail.leo
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
|
||||
record Token2 {
|
||||
owner: address,
|
||||
gates: u64,
|
||||
foo: (Foo, Foo),
|
||||
}
|
||||
|
||||
record Foo {
|
||||
owner: address,
|
||||
gates: u64,
|
||||
amount: u64,
|
||||
}
|
21
tests/compiler/records/nested_record_3_fail.leo
Normal file
21
tests/compiler/records/nested_record_3_fail.leo
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
record Token {
|
||||
owner: address,
|
||||
gates: u64,
|
||||
bar: Bar,
|
||||
}
|
||||
|
||||
|
||||
circuit Bar {
|
||||
bar: Foo,
|
||||
}
|
||||
|
||||
record Foo {
|
||||
owner: address,
|
||||
gates: u64,
|
||||
amount: u64,
|
||||
}
|
25
tests/compiler/records/nested_record_4_fail.leo
Normal file
25
tests/compiler/records/nested_record_4_fail.leo
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
record Token3 {
|
||||
owner: address,
|
||||
gates: u64,
|
||||
bar: (Bar, Bar),
|
||||
}
|
||||
|
||||
circuit Bar {
|
||||
bar: (Token, Token),
|
||||
}
|
||||
|
||||
record Token {
|
||||
owner: address,
|
||||
gates: u64,
|
||||
amount: u64,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372030]: A circuit or record cannot contain another record.\n --> compiler-test:5:5\n |\n 5 | token: Token,\n | ^^^^^\n |\n = Remove the record `Token` from `Foo`.\n"
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372030]: A circuit or record cannot contain another record.\n --> compiler-test:12:5\n |\n 12 | foo: Foo,\n | ^^^\n |\n = Remove the record `Foo` from `Token`.\n"
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372025]: Tuples are only allowed as function return types.\n --> compiler-test:7:5\n |\n 7 | foo: (Foo, Foo),\n | ^^^\nError [ETYC0372030]: A circuit or record cannot contain another record.\n --> compiler-test:7:5\n |\n 7 | foo: (Foo, Foo),\n | ^^^\n |\n = Remove the record `Foo` from `Token2`.\nError [ETYC0372030]: A circuit or record cannot contain another record.\n --> compiler-test:7:5\n |\n 7 | foo: (Foo, Foo),\n | ^^^\n |\n = Remove the record `Foo` from `Token2`.\n"
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372030]: A circuit or record cannot contain another record.\n --> compiler-test:11:5\n |\n 11 | bar: Foo,\n | ^^^\n |\n = Remove the record `Foo` from `Bar`.\n"
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372025]: Tuples are only allowed as function return types.\n --> compiler-test:6:5\n |\n 6 | bar: (Bar, Bar),\n | ^^^\nError [ETYC0372025]: Tuples are only allowed as function return types.\n --> compiler-test:10:5\n |\n 10 | bar: (Token, Token),\n | ^^^\nError [ETYC0372030]: A circuit or record cannot contain another record.\n --> compiler-test:10:5\n |\n 10 | bar: (Token, Token),\n | ^^^\n |\n = Remove the record `Token` from `Bar`.\nError [ETYC0372030]: A circuit or record cannot contain another record.\n --> compiler-test:10:5\n |\n 10 | bar: (Token, Token),\n | ^^^\n |\n = Remove the record `Token` from `Bar`.\n"
|
@ -2,4 +2,4 @@
|
||||
namespace: Compile
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- "Error [ETYC0372030]: A record cannot contain another record.\n --> compiler-test:12:1\n |\n 12 | record Token {\n 13 | // The token owner.\n 14 | owner: address,\n 15 | // The Aleo balance (in gates).\n 16 | gates: u64,\n 17 | // The token amount.\n 18 | foo: Foo,\n 19 | }\n | ^\n |\n = Remove the record `Foo from `Token`.\n"
|
||||
- "Error [EPAR0370005]: expected 'function', 'circuit', 'test' -- found 'interface'\n --> compiler-test:21:1\n |\n 21 | interface Bar {\n | ^^^^^^^^^"
|
||||
|
Loading…
Reference in New Issue
Block a user