Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a06abdb
wip just printing frontend test files
michaeljklein Mar 19, 2025
40553f3
chore: add `shared` module within `noirc_frontend` (#7746)
TomAFrench Mar 19, 2025
f020f25
chore: Fix rustdocs error (#7750)
vezenovm Mar 19, 2025
31fb608
emitting files, added wip script, testing
michaeljklein Mar 19, 2025
c4c4230
Merge remote-tracking branch 'origin/master' into michaeljklein/front…
michaeljklein Mar 19, 2025
ff5a074
wip adding frontend test to compilation test generator, adding mod/fu…
michaeljklein Mar 20, 2025
6372998
wip testing generated tests, add 'nextest' feature to assert no new t…
michaeljklein Mar 21, 2025
fbe063d
add generated tests
michaeljklein Mar 21, 2025
1688eda
Merge branch 'master' into michaeljklein/frontend-to-compilation-tests
michaeljklein Mar 21, 2025
e96a03f
removing name_shadowing tests (~2.4k)
michaeljklein Mar 21, 2025
cdc0b20
disable emitting name_shadowing tests
michaeljklein Mar 21, 2025
6ff4e3d
remove unused script
michaeljklein Mar 21, 2025
eae7106
Merge branch 'master' into michaeljklein/frontend-to-compilation-tests
michaeljklein Mar 21, 2025
075feae
Merge branch 'master' into michaeljklein/frontend-to-compilation-tests
michaeljklein Mar 24, 2025
f6406d0
add exception lists, expect error in trait test, add 'ownership' feat…
michaeljklein Mar 24, 2025
82fa368
add bug expectation, got all exception lists working, split turbofish…
michaeljklein Mar 24, 2025
c120d11
add missing main fn to tests, add missing double_generic_alias_in_pat…
michaeljklein Mar 24, 2025
ab64d80
skip generated tests in format.sh, cleanup, rename traits that overla…
michaeljklein Mar 24, 2025
e064fca
Merge branch 'master' into michaeljklein/frontend-to-compilation-tests
michaeljklein Mar 24, 2025
ddc7979
removing TODO that was fixed in another PR, cargo clippy/fmt
michaeljklein Mar 25, 2025
f3f46b1
Merge branch 'master' into michaeljklein/frontend-to-compilation-tests
michaeljklein Mar 25, 2025
3532bc7
Merge branch 'master' into michaeljklein/frontend-to-compilation-tests
michaeljklein Mar 25, 2025
740fd75
Merge branch 'master' into michaeljklein/frontend-to-compilation-tests
michaeljklein Mar 25, 2025
f68dcf3
add note r.e. unique test names, attempt to fix trait_alias_with_wher…
michaeljklein Mar 25, 2025
bf70932
Merge branch 'master' into michaeljklein/frontend-to-compilation-tests
michaeljklein Mar 25, 2025
26e9f03
add 'named' and '!' to test from merging master
michaeljklein Mar 25, 2025
4ae4775
Merge branch 'master' into michaeljklein/frontend-to-compilation-tests
michaeljklein Mar 25, 2025
6514bbb
Merge branch 'master' into michaeljklein/frontend-to-compilation-tests
michaeljklein Mar 26, 2025
0b934b9
move '-Zownership' to execute.rs
michaeljklein Mar 27, 2025
0f1faeb
add ! and '#[named]' to new tests and regenerate
michaeljklein Mar 27, 2025
1947623
Merge branch 'master' into michaeljklein/frontend-to-compilation-tests
michaeljklein Mar 28, 2025
918dd60
move indexing_array_with_non_u32 from error to warning tests
michaeljklein Mar 28, 2025
caab487
Merge branch 'master' into michaeljklein/frontend-to-compilation-tests
michaeljklein Mar 28, 2025
bdc9052
Merge branch 'master' into michaeljklein/frontend-to-compilation-tests
michaeljklein Apr 1, 2025
fb0ab8b
update tests from master and add macro for check_monomorphization_error
michaeljklein Apr 1, 2025
77d3c80
Merge branch 'master' into michaeljklein/frontend-to-compilation-tests
michaeljklein Apr 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/test-rust-workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
tool: nextest@0.9.67

- name: Build and archive tests
run: cargo nextest archive --workspace --archive-file nextest-archive.tar.zst
run: cargo nextest archive --workspace --features noirc_frontend/nextest --archive-file nextest-archive.tar.zst

- name: Upload archive to workflow
uses: actions/upload-artifact@v4
Expand Down
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions compiler/noirc_frontend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ fxhash.workspace = true

[dev-dependencies]
base64.workspace = true
function_name = "0.3.0"
proptest.workspace = true
proptest-derive.workspace = true

[features]
bn254 = []
bls12_381 = []
nextest = []
4 changes: 4 additions & 0 deletions compiler/noirc_frontend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
// Temporary allows.
#![allow(clippy::mutable_key_type, clippy::result_large_err)]

#[cfg(test)]
#[macro_use]
extern crate function_name;

pub mod ast;
pub mod debug;
pub mod elaborator;
Expand Down
43 changes: 34 additions & 9 deletions compiler/noirc_frontend/src/monomorphization/tests.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
#![cfg(test)]
use crate::{
check_monomorphization_error_using_features,
elaborator::UnstableFeature,
tests::{check_monomorphization_error_using_features, get_program},
tests::{Expect, get_program},
};

use super::{ast::Program, errors::MonomorphizationError, monomorphize};

pub fn get_monomorphized(src: &str) -> Result<Program, MonomorphizationError> {
let (_parsed_module, mut context, errors) = get_program(src);
pub fn get_monomorphized(
src: &str,
test_path: &str,
expect: Expect,
) -> Result<Program, MonomorphizationError> {
let (_parsed_module, mut context, errors) = get_program(src, test_path, expect);
assert!(
errors.iter().all(|err| !err.is_error()),
"Expected monomorphized program to have no errors before monomorphization, but found: {errors:?}"
Expand All @@ -20,11 +25,28 @@ pub fn get_monomorphized(src: &str) -> Result<Program, MonomorphizationError> {
monomorphize(main, &mut context.def_interner, false)
}

fn check_rewrite(src: &str, expected: &str) {
let program = get_monomorphized(src).unwrap();
fn check_rewrite(src: &str, expected: &str, test_path: &str) {
let program = get_monomorphized(src, test_path, Expect::Success).unwrap();
assert!(format!("{}", program) == expected);
}

// NOTE: this will fail in CI when called twice within one test: test names must be unique
#[macro_export]
macro_rules! get_monomorphized {
($src:expr, $expect:expr) => {
$crate::monomorphization::tests::get_monomorphized($src, $crate::function_path!(), $expect)
};
}

// NOTE: this will fail in CI when called twice within one test: test names must be unique
#[macro_export]
macro_rules! check_rewrite {
($src:expr, $expected:expr) => {
$crate::monomorphization::tests::check_rewrite($src, $expected, $crate::function_path!())
};
}

#[named]
#[test]
fn bounded_recursive_type_errors() {
// We want to eventually allow bounded recursive types like this, but for now they are
Expand All @@ -45,9 +67,10 @@ fn bounded_recursive_type_errors() {
}
";
let features = vec![UnstableFeature::Enums];
check_monomorphization_error_using_features(src, &features);
check_monomorphization_error_using_features!(src, &features);
}

#[named]
#[test]
fn recursive_type_with_alias_errors() {
// We want to eventually allow bounded recursive types like this, but for now they are
Expand Down Expand Up @@ -80,9 +103,10 @@ fn recursive_type_with_alias_errors() {
}
";
let features = vec![UnstableFeature::Enums];
check_monomorphization_error_using_features(src, &features);
check_monomorphization_error_using_features!(src, &features);
}

#[named]
#[test]
fn mutually_recursive_types_error() {
let src = "
Expand All @@ -103,9 +127,10 @@ fn mutually_recursive_types_error() {
}
";
let features = vec![UnstableFeature::Enums];
check_monomorphization_error_using_features(src, &features);
check_monomorphization_error_using_features!(src, &features);
}

#[named]
#[test]
fn simple_closure_with_no_captured_variables() {
let src = r#"
Expand Down Expand Up @@ -134,5 +159,5 @@ fn lambda$f1(mut env$l1: (Field)) -> Field {
env$l1.0
}
"#;
check_rewrite(src, expected_rewrite);
check_rewrite!(src, expected_rewrite);
}
Loading
Loading