Skip to content

Add support for generics and impl Trait types #18

@foresterre

Description

@foresterre
  • TODO:
    • Figure out limitations to this approach. Will it scale with async for example
    • Where should the __generated fn be placed? Is it good enough to put it in the module, or, especially for custom macro's, do we want the implementation to be stacked inside the #[maybe_my_custom_test] fn?

Can we replace the current binding based implementation completely? Or do we want or need to keep both?

#[parameterized(a = { 0 }, b = { 1 })]
fn numbers<T: Into<u8>>(input: T) {
    assert_eq!(0, input)
}

mod test {
    #[test]
    fn a() {
        fn __generated<T: Into<u8>>(input: T) {
            assert_eq!(0, input.into());
        }

        __generated(0); 
    }

    #[test]
    fn b() {
        fn __generated<T: Into<u8>>(input: T) {
            assert_eq!(0, input.into());
        }

        __generated(1);
    }
}

and

fn __generated(input: impl Into<u8>) {
            assert_eq!(0, input.into());
        }

        __generated(0);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions