Skip to content

Commit

Permalink
chore: move test along prepare_source
Browse files Browse the repository at this point in the history
  • Loading branch information
kobyhallx committed Dec 19, 2023
1 parent 9c6a48a commit 795eb21
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
16 changes: 16 additions & 0 deletions tooling/lsp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,19 @@ fn prepare_source(source: String) -> (Context<'static>, CrateId) {

(context, root_crate_id)
}

#[test]
fn prepare_package_from_source_string() {
let source = r#"
fn main() {
let x = 1;
let y = 2;
let z = x + y;
}
"#;

let (mut context, crate_id) = crate::prepare_source(source.to_string());
let _check_result = noirc_driver::check_crate(&mut context, crate_id, false, false);
let main_func_id = context.get_main_function(&crate_id);
assert!(main_func_id.is_some());
}
15 changes: 0 additions & 15 deletions tooling/nargo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,19 +175,4 @@ mod tests {
assert!(paths.contains(&path));
}
}
#[test]
fn prepare_package_from_source_string() {
let source = r#"
fn main() {
let x = 1;
let y = 2;
let z = x + y;
}
"#;

let (mut context, crate_id) = crate::prepare_source(source.to_string());
let _check_result = noirc_driver::check_crate(&mut context, crate_id, false, false);
let main_func_id = context.get_main_function(&crate_id);
assert!(main_func_id.is_some());
}
}

0 comments on commit 795eb21

Please sign in to comment.