Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deny #[test] fns declared in nested items #222

Merged
merged 1 commit into from
Dec 13, 2020
Merged

Deny #[test] fns declared in nested items #222

merged 1 commit into from
Dec 13, 2020

Conversation

udoprog
Copy link
Collaborator

@udoprog udoprog commented Dec 13, 2020

This denies #[test] fns declared inside of other nested items, like these:

fn function() {
    #[test]
    fn test_fn() {
        assert!(true != true);
    }
}

The above would fail to compile with:

  ┌─ scripts\test.rn:2:5
  │
1 │   fn function() {
  │   ------------- nested in here
2 │ ╭     #[test]
3 │ │     fn test_fn() {
  │ ╰────────────────^ #[test] attributes are not supported on nested items

TODO

We still need #[test] fns to be fully pruned during compilation in case we're not compiling for a test case.

@udoprog udoprog added the enhancement New feature or request label Dec 13, 2020
@udoprog udoprog merged commit d46be1d into main Dec 13, 2020
@udoprog udoprog deleted the deny-nested-test branch December 13, 2020 19:36
@udoprog udoprog added the changelog Issue has been added to the changelog label Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog Issue has been added to the changelog enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant