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

support more items inside #[defmt_test::tests] #627

Open
japaric opened this issue Nov 15, 2021 · 0 comments
Open

support more items inside #[defmt_test::tests] #627

japaric opened this issue Nov 15, 2021 · 0 comments
Labels
difficulty: medium Somewhat difficult to solve status: needs PR Issue just needs a Pull Request implementing the changes type: enhancement Enhancement or feature request

Comments

@japaric
Copy link
Member

japaric commented Nov 15, 2021

currently, the #[tests] module can only contain function items that have one of these attributes: #[test] on #[init].
instead, we should support any kind of item that a normal module can contain: non-unit-test (e.g. helper) functions, structs, etc.

#[defmt_test::tests]
mod tests {
    #[test]
    fn f() {
        helper();
    }

    fn helper() {
        // ..
    }

    struct Helper;

    #[test]
    fn g() {
        Helper::constructor().method();
    }
}

implementation wise, items that are not unit tests or the #[init] function should not be touched by the proc-macro and emitted as they appear in the input

@japaric japaric added type: enhancement Enhancement or feature request status: needs PR Issue just needs a Pull Request implementing the changes labels Nov 15, 2021
@Urhengulas Urhengulas added difficulty: easy Pretty easy to solve difficulty: medium Somewhat difficult to solve and removed difficulty: easy Pretty easy to solve labels Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: medium Somewhat difficult to solve status: needs PR Issue just needs a Pull Request implementing the changes type: enhancement Enhancement or feature request
Projects
None yet
Development

No branches or pull requests

2 participants