-
Notifications
You must be signed in to change notification settings - Fork 660
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve validation for test annotations
- Loading branch information
Showing
10 changed files
with
188 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tests/expectations/compiler/function/annotated_function.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace = "Compile" | ||
expectation = "Pass" | ||
outputs = [[{ compile = [{ initial_symbol_table = "690edb74eb02c5ac9e717bfb51933668a2b530f7e803ba5666880d23f28d5bec", type_checked_symbol_table = "e7e865d4fe1f786bea9fa28c5cff41a8c29ce00da69306b522dd79eac50d4c78", unrolled_symbol_table = "e7e865d4fe1f786bea9fa28c5cff41a8c29ce00da69306b522dd79eac50d4c78", initial_ast = "97b8563a49a209737aa82195d8fe84257cdd16ac2b32133de91b43de7bb557b1", unrolled_ast = "97b8563a49a209737aa82195d8fe84257cdd16ac2b32133de91b43de7bb557b1", ssa_ast = "4e6c70e32a0fd6f3fc362568ba2f365b198be164922c9276b48a54513a9a0501", flattened_ast = "5ecbeaa566e8bd200515944b8f73945bff67eace488df97e8d0f477f2255bcd7", destructured_ast = "f0ae5e19798aaa5777a17d477f6eb0b2d9ccd1067c807c4348e1ba0a0f147dd5", inlined_ast = "f0ae5e19798aaa5777a17d477f6eb0b2d9ccd1067c807c4348e1ba0a0f147dd5", dce_ast = "f0ae5e19798aaa5777a17d477f6eb0b2d9ccd1067c807c4348e1ba0a0f147dd5", bytecode = """ | ||
program test.aleo; | ||
|
||
function test: | ||
is.eq 1u32 1u32 into r0; | ||
assert.eq r0 true; | ||
|
||
function test_other: | ||
is.eq 1u32 1u32 into r0; | ||
assert.eq r0 true; | ||
""", errors = "", warnings = "" }] }]] |
49 changes: 32 additions & 17 deletions
49
tests/expectations/compiler/function/annotated_function_fail.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,36 @@ | ||
namespace = "Compile" | ||
expectation = "Fail" | ||
outputs = [""" | ||
Error [ETYC0372027]: Unknown annotation: `@test`. | ||
--> compiler-test:4:5 | ||
expectation = "Pass" | ||
outputs = [[{ compile = [{ initial_symbol_table = "4886e187c6b46dbeeb507a7f5188c89f415516c2ff7781ad5af48ea13fca665b", type_checked_symbol_table = "214bdcdf17793e3098343e1aa5993244ad520847278f8864ce7ce0bf4e3bf8ad", unrolled_symbol_table = "214bdcdf17793e3098343e1aa5993244ad520847278f8864ce7ce0bf4e3bf8ad", initial_ast = "05ac2357efbe8d0e00d30f8b7ee33cb625070471ab6f513d2613cb8baeaeff39", unrolled_ast = "05ac2357efbe8d0e00d30f8b7ee33cb625070471ab6f513d2613cb8baeaeff39", ssa_ast = "2f8548323d07c917964e711b10e5198796ac601eb3c75aae61009a600a437220", flattened_ast = "67707c544bfd8a551287d9bf6d4d869b4817d767003c44735ec27ff33d75cf8d", destructured_ast = "3c3c87cf1069c8691bfe57d696be55e2716021cb03e11f8345d3bafb5b23c99b", inlined_ast = "3c3c87cf1069c8691bfe57d696be55e2716021cb03e11f8345d3bafb5b23c99b", dce_ast = "3c3c87cf1069c8691bfe57d696be55e2716021cb03e11f8345d3bafb5b23c99b", bytecode = """ | ||
program test.aleo; | ||
|
||
function test: | ||
is.eq 1u32 1u32 into r0; | ||
assert.eq r0 true; | ||
|
||
closure foo: | ||
input r0 as u8; | ||
input r1 as u8; | ||
add r0 r1 into r2; | ||
output r2 as u8; | ||
|
||
closure bar: | ||
input r0 as u8; | ||
input r1 as u8; | ||
mul r0 r1 into r2; | ||
output r2 as u8; | ||
""", errors = "", warnings = """ | ||
Warning [WTYC0372005]: Unknown key `foo` in annotation `test`. | ||
--> compiler-test:16:11 | ||
| | ||
4 | @test | ||
| ^^^^^ | ||
Error [ETYC0372027]: Unknown annotation: `@program`. | ||
--> compiler-test:9:5 | ||
16 | @test(foo) | ||
| ^^^ | ||
Warning [WTYC0372004]: Unknown annotation: `foo`. | ||
--> compiler-test:6:5 | ||
| | ||
9 | @program | ||
| ^^^^^^^^ | ||
Error [ETYC0372083]: A program must have at least one transition function. | ||
--> compiler-test:1:1 | ||
6 | @foo | ||
| ^^^^ | ||
Warning [WTYC0372004]: Unknown annotation: `program`. | ||
--> compiler-test:11:5 | ||
| | ||
1 | | ||
2 | | ||
3 | program test.aleo { | ||
| ^^^^^^^^^^^^ | ||
"""] | ||
11 | @program | ||
| ^^^^^^^^""" }] }]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
namespace = "Compile" | ||
expectation = "Pass" | ||
*/ | ||
|
||
program test.aleo { | ||
@test | ||
transition test() { | ||
assert(1u32 == 1u32); | ||
} | ||
|
||
@test( | ||
private_key = "APrivateKey1zkp9wLdmfcM57QFL3ZEzgfZwCWV52nM24ckmLSmTQcp64FL", | ||
batch = "0", | ||
seed = "1234" | ||
) | ||
transition test_other() { | ||
assert(1u32 == 1u32); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,23 @@ | ||
/* | ||
namespace = "Compile" | ||
expectation = "Fail" | ||
expectation = "Pass" | ||
*/ | ||
|
||
// This test should pass, but produce warnings about unrecognized and malformed annotations. | ||
|
||
program test.aleo { | ||
@test | ||
@foo | ||
function foo(a: u8, b: u8) -> u8 { | ||
return a + b; | ||
} | ||
|
||
@program | ||
function bar(a: u8, b: u8) -> u8 { | ||
return a * b; | ||
}} | ||
} | ||
|
||
@test(foo) | ||
transition test() { | ||
assert(1u32 == 1u32); | ||
} | ||
} |