Skip to content

Commit

Permalink
Simplify default test definition, add dev dependencies to retriever
Browse files Browse the repository at this point in the history
  • Loading branch information
d0cd committed Dec 9, 2024
1 parent 1623a77 commit 3152050
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions leo/cli/commands/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ fn handle_build<N: Network>(command: &LeoBuild, context: Context) -> Result<<Leo

// If the `build_tests` flag is set, compile the tests.
if command.options.build_tests {
println!("main_stubs: {:?}", main_stubs);
// Compile the tests.
compile_tests::<N>(main_sym.to_string(), &package_path, &handler, command.options.clone(), main_stubs.clone())?;
}
Expand Down
5 changes: 1 addition & 4 deletions leo/package/src/tst/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,11 @@ impl DefaultTestFile {
fn template() -> String {
r#"// A Leo test file.
// To learn more about testing your program, see the documentation at https://docs.leo-lang.org
import helloworld.aleo;
program test.aleo {
@compiled_test
@interpreted_test
transition test_helloworld() {{
let result: u32 = helloworld.aleo/main(1u32, 2u32);
assert_eq(result, 3u32);
assert_eq(1u32 + 2u32, 3u32);
}}
}
"#
Expand Down
7 changes: 6 additions & 1 deletion utils/retriever/src/retriever/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,11 +409,16 @@ fn retrieve_local(name: &String, path: &PathBuf) -> Result<Vec<Dependency>, Util
))?;
}

let dependencies = match program_data.dependencies() {
let mut dependencies = match program_data.dependencies() {
Some(deps) => deps.clone(),
None => Vec::new(),
};

// Add the dev dependencies, if they exist.
if let Some(deps) = program_data.dev_dependencies() {
dependencies.extend(deps.clone())
}

Ok(dependencies)
}

Expand Down

0 comments on commit 3152050

Please sign in to comment.