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 for adding tags to suites/contexts/examples #42

Open
regexident opened this issue Oct 23, 2017 · 4 comments
Open

Support for adding tags to suites/contexts/examples #42

regexident opened this issue Oct 23, 2017 · 4 comments

Comments

@regexident
Copy link
Collaborator

regexident commented Oct 23, 2017

I have the feeling that instead of implementing dedicated logic for skipping of/focussing on specific suites/contexts/examples it might be a good idea to instead add support for adding custom tags.

This along with a way to filter for tags (both positively foo, as well as negatively ~bar) would then add functionality equivalent to these features:


And as we're doing Rust we might as well go the extra mile and make the tags type-safe.

Suite/Context/Example would thus be generic over E: Environment as well as T: Tag.

Proof-of-concept

(We should further more be able to provide a stable derive for TryFrom<&'a str> for T via macros 1.1, afaict.)

This way one would define the Tags for a given test scenario (group of suites tied to the types of a given Environment), and any typo within the test code would be caught by the compiler, while passing an unknown tag to an (at this point still) imaginary CLI à la cargo spec --filter="baz" would trigger an error message on execution.

@JustinRyanH
Copy link

Would the Macro 1.1, require users to apply the #[Derive(TraitWhatever)] statement to get the compile time failures?

@regexident
Copy link
Collaborator Author

regexident commented Oct 28, 2017

Probably, yes. Unless rspec provided a convenience macro à la

rspec_tags!(
    foo, bar, baz, blee
);

which would do all the necessary work for you.

@mackwic
Copy link
Member

mackwic commented Oct 28, 2017

as I said, not convince by the need. I would like someone to step up and say that he/she really needs this feature.

@regexident
Copy link
Collaborator Author

I’d like to be able to mark contexts as smoke, exhaustive, etc. So that I can easily add …

Smoke Test

Run the test suite using $ cargo run tests —include=smoke for a quick smoke test.

… to my project’s documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants