-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
118 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use std::path::Path; | ||
|
||
use noirc_driver::{file_manager_with_stdlib, prepare_crate, ErrorsAndWarnings}; | ||
use noirc_frontend::hir::Context; | ||
|
||
#[test] | ||
fn stdlib_does_not_produce_constant_warnings() -> Result<(), ErrorsAndWarnings> { | ||
// We use a minimal source file so that if stdlib produces warnings then we can expect these warnings to _always_ | ||
// be emitted. | ||
let source = "fn main() {}"; | ||
|
||
let root = Path::new(""); | ||
let file_name = Path::new("main.nr"); | ||
let mut file_manager = file_manager_with_stdlib(root); | ||
file_manager.add_file_with_source(file_name, source.to_owned()).expect( | ||
"Adding source buffer to file manager should never fail when file manager is empty", | ||
); | ||
|
||
let mut context = Context::new(file_manager); | ||
let root_crate_id = prepare_crate(&mut context, file_name); | ||
|
||
let ((), warnings) = noirc_driver::check_crate(&mut context, root_crate_id, false, false)?; | ||
|
||
assert_eq!(warnings, Vec::new(), "stdlib is producing warnings"); | ||
|
||
Ok(()) | ||
} |
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