Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-schott committed Feb 9, 2024
1 parent 9e0cfd5 commit 5af08b5
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 52 deletions.
2 changes: 0 additions & 2 deletions compiler/parser/src/parser/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ pub(crate) struct ParserContext<'a> {
pub(crate) prev_token: SpannedToken,
/// true if parsing an expression for if and loop statements -- means struct inits are not legal
pub(crate) disallow_struct_construction: bool,
/// true if parsing an identifier inside an input file.
pub(crate) allow_identifier_underscores: bool,
/// The name of the program being parsed.
pub(crate) program_name: Option<Symbol>,
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/parser/src/parser/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use super::*;
use leo_errors::{ParserError, Result};

use leo_span::sym;
use leo_span::{sym, Symbol};
use snarkvm::console::{account::Address, network::Testnet3};

const INT_TYPES: &[Token] = &[
Expand Down
2 changes: 2 additions & 0 deletions leo/cli/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ mod tests {
name: "inner_1_main".to_string(),
inputs: vec!["1u32".to_string(), "2u32".to_string()],
compiler_options: Default::default(),
file: None,
},
},
path: Some(project_directory.clone()),
Expand Down Expand Up @@ -299,6 +300,7 @@ mod tests {
name: "main".to_string(),
inputs: vec!["1u32".to_string(), "2u32".to_string()],
compiler_options: Default::default(),
file: None,
},
},
path: Some(project_directory.clone()),
Expand Down
2 changes: 0 additions & 2 deletions leo/cli/commands/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,13 @@ fn compile_leo_file(
handler: &Handler,
options: BuildOptions,
stubs: IndexMap<Symbol, Stub>,
) -> Result<IndexMap<Symbol, Composite>> {
) -> Result<()> {
// Construct the Leo file name with extension `foo.leo`.
let file_name =
file_path.file_name().and_then(|name| name.to_str()).ok_or_else(PackageError::failed_to_get_file_name)?;

// Construct program name from the program_id found in `package.json`.
let program_name = program_id.name().to_string();
let program_symbol = Symbol::intern(&program_name);

// Create the path to the Aleo file.
let mut aleo_file_path = build.to_path_buf();
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/compiler/finalize/mapping_fail.out
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- "Error [ETYC0372030]: A mapping's key cannot be a tuple\n --> compiler-test:4:5\n |\n 4 | mapping foo: (u32, u32) => u32;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372017]: The type `baz` is not found in the current scope.\n --> compiler-test:6:5\n |\n 6 | mapping floo: baz => u8;\n | ^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = If you are using an external type, make sure to preface with the program name. Ex: `credits.aleo/credits` instead of `credits`\nError [ETYC0372017]: The type `foo` is not found in the current scope.\n --> compiler-test:8:5\n |\n 8 | mapping floop: foo => foo;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = If you are using an external type, make sure to preface with the program name. Ex: `credits.aleo/credits` instead of `credits`\nError [ETYC0372017]: The type `foo` is not found in the current scope.\n --> compiler-test:8:5\n |\n 8 | mapping floop: foo => foo;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = If you are using an external type, make sure to preface with the program name. Ex: `credits.aleo/credits` instead of `credits`\nError [ETYC0372017]: The type `foo` is not found in the current scope.\n --> compiler-test:10:5\n |\n 10 | mapping bar: foo => baz;\n | ^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = If you are using an external type, make sure to preface with the program name. Ex: `credits.aleo/credits` instead of `credits`\nError [ETYC0372017]: The type `baz` is not found in the current scope.\n --> compiler-test:10:5\n |\n 10 | mapping bar: foo => baz;\n | ^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = If you are using an external type, make sure to preface with the program name. Ex: `credits.aleo/credits` instead of `credits`\nError [ETYC0372030]: A mapping's value cannot be a record\n --> compiler-test:19:5\n |\n 19 | mapping real_tokens: address => RealToken;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372030]: A mapping's key cannot be a record\n --> compiler-test:21:5\n |\n 21 | mapping owners: RealToken => address;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"
- "Error [ETYC0372030]: A mapping's key cannot be a tuple\n --> compiler-test:4:5\n |\n 4 | mapping foo: (u32, u32) => u32;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372017]: The type `baz` is not found in the current scope.\n --> compiler-test:6:5\n |\n 6 | mapping floo: baz => u8;\n | ^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = If you are using an external type, make sure to preface with the program name. Ex: `credits.aleo/credits` instead of `credits`\nError [ETYC0372017]: The type `foo` is not found in the current scope.\n --> compiler-test:8:5\n |\n 8 | mapping floop: foo => foo;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = If you are using an external type, make sure to preface with the program name. Ex: `credits.aleo/credits` instead of `credits`\nError [ETYC0372017]: The type `foo` is not found in the current scope.\n --> compiler-test:8:5\n |\n 8 | mapping floop: foo => foo;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = If you are using an external type, make sure to preface with the program name. Ex: `credits.aleo/credits` instead of `credits`\nError [ETYC0372017]: The type `foo` is not found in the current scope.\n --> compiler-test:10:5\n |\n 10 | mapping bar: foo => baz;\n | ^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = If you are using an external type, make sure to preface with the program name. Ex: `credits.aleo/credits` instead of `credits`\nError [ETYC0372017]: The type `baz` is not found in the current scope.\n --> compiler-test:10:5\n |\n 10 | mapping bar: foo => baz;\n | ^^^^^^^^^^^^^^^^^^^^^^^^\n |\n = If you are using an external type, make sure to preface with the program name. Ex: `credits.aleo/credits` instead of `credits`\nError [ETYC0372030]: A mapping's value cannot be a record\n --> compiler-test:19:5\n |\n 19 | mapping real_tokens: address => RealToken;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372030]: A mapping's key cannot be a record\n --> compiler-test:21:5\n |\n 21 | mapping owners: RealToken => address;\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nError [ETYC0372093]: A program must have at least one transition function.\n --> compiler-test:1:1\n |\n 1 | \n 2 | \n 3 | program test.aleo { \n | ^^^^^^^^^^^^\n"

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- "Error [ETYC0372017]: The type `Board` is not found in the current scope.\n --> compiler-test:4:35\n |\n 4 | function aria192check_for_win(b: Board, p: u8) -> u128bool {\n | ^\n |\n = If you are using an external type, make sure to preface with the program name. Ex: `credits.aleo/credits` instead of `credits`\nError [ETYC0372017]: The type `u128bool` is not found in the current scope.\n --> compiler-test:4:55\n |\n 4 | function aria192check_for_win(b: Board, p: u8) -> u128bool {\n | ^^^^^^^^\n |\n = If you are using an external type, make sure to preface with the program name. Ex: `credits.aleo/credits` instead of `credits`\nError [ETYC0372005]: Unknown variable `test`\n --> compiler-test:5:16\n |\n 5 | return test;\n | ^^^^\n"
- "Error [ETYC0372017]: The type `Board` is not found in the current scope.\n --> compiler-test:4:35\n |\n 4 | function aria192check_for_win(b: Board, p: u8) -> u128bool {\n | ^\n |\n = If you are using an external type, make sure to preface with the program name. Ex: `credits.aleo/credits` instead of `credits`\nError [ETYC0372017]: The type `u128bool` is not found in the current scope.\n --> compiler-test:4:55\n |\n 4 | function aria192check_for_win(b: Board, p: u8) -> u128bool {\n | ^^^^^^^^\n |\n = If you are using an external type, make sure to preface with the program name. Ex: `credits.aleo/credits` instead of `credits`\nError [ETYC0372005]: Unknown variable `test`\n --> compiler-test:5:16\n |\n 5 | return test;\n | ^^^^\nError [ETYC0372093]: A program must have at least one transition function.\n --> compiler-test:1:1\n |\n 1 | \n 2 | \n 3 | program test.aleo {\n | ^^^^^^^^^^^^\n"

This file was deleted.

2 changes: 1 addition & 1 deletion tests/expectations/compiler/structs/inline_undefined.out
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
namespace: Compile
expectation: Fail
outputs:
- "Error [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:5:9\n |\n 5 | let a: Foo = Foo { };\n | ^^^^^^^^^^^^^^^^^^^^\n |\n = If you are using an external type, make sure to preface with the program name. Ex: `credits.aleo/credits` instead of `credits`\nError [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:5:9\n |\n 5 | let a: Foo = Foo { };\n | ^^^^^^^^^^^^^^^^^^^^\n |\n = If you are using an external type, make sure to preface with the program name. Ex: `credits.aleo/credits` instead of `credits`\nError [ETYC0372005]: Unknown struct `Foo`\n --> compiler-test:5:22\n |\n 5 | let a: Foo = Foo { };\n | ^^^\n"
- "Error [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:5:9\n |\n 5 | let a: Foo = Foo { };\n | ^^^^^^^^^^^^^^^^^^^^\n |\n = If you are using an external type, make sure to preface with the program name. Ex: `credits.aleo/credits` instead of `credits`\nError [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:5:9\n |\n 5 | let a: Foo = Foo { };\n | ^^^^^^^^^^^^^^^^^^^^\n |\n = If you are using an external type, make sure to preface with the program name. Ex: `credits.aleo/credits` instead of `credits`\nError [ETYC0372005]: Unknown struct `Foo`\n --> compiler-test:5:22\n |\n 5 | let a: Foo = Foo { };\n | ^^^\nError [ETYC0372093]: A program must have at least one transition function.\n --> compiler-test:1:1\n |\n 1 | \n 2 | \n 3 | program test.aleo { \n | ^^^^^^^^^^^^\n"
17 changes: 0 additions & 17 deletions tests/tests/compiler/function/shadow_function_with_input_fail.leo

This file was deleted.

17 changes: 0 additions & 17 deletions tests/tests/compiler/structs/duplicate_name_context.leo

This file was deleted.

0 comments on commit 5af08b5

Please sign in to comment.