Skip to content

Commit

Permalink
chore: run tests in metaprogramming.rs (#6339)
Browse files Browse the repository at this point in the history
# Description

## Problem\*

Resolves <!-- Link to GitHub Issue -->

## Summary\*

These tests weren't being run because of a missing `mod
metaprogramming;`. I've also added a test for a requested feature from
another team.

## Additional Context



## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
  • Loading branch information
TomAFrench authored Oct 24, 2024
1 parent 598230d commit fb5d16b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions compiler/noirc_frontend/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

mod bound_checks;
mod imports;
mod metaprogramming;
mod name_shadowing;
mod references;
mod traits;
Expand Down
26 changes: 24 additions & 2 deletions compiler/noirc_frontend/src/tests/metaprogramming.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use crate::hir::def_collector::dc_crate::CompilationError;
use crate::hir::{
def_collector::dc_crate::CompilationError, resolution::errors::ResolverError,
type_check::TypeCheckError,
};

use super::get_program_errors;
use super::{assert_no_errors, get_program_errors};

// Regression for #5388
#[test]
Expand Down Expand Up @@ -74,3 +77,22 @@ fn unquoted_integer_as_integer_token() {

assert_no_errors(src);
}

#[test]
fn allows_references_to_structs_generated_by_macros() {
let src = r#"
comptime fn make_new_struct(_s: StructDefinition) -> Quoted {
quote { struct Bar {} }
}
#[make_new_struct]
struct Foo {}
fn main() {
let _ = Foo {};
let _ = Bar {};
}
"#;

assert_no_errors(src);
}

0 comments on commit fb5d16b

Please sign in to comment.