Skip to content

Ignore tests #3

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

Closed
RazrFalcon opened this issue Jun 21, 2018 · 9 comments
Closed

Ignore tests #3

RazrFalcon opened this issue Jun 21, 2018 · 9 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@RazrFalcon
Copy link

Currently, the test code is also included, which is misleading.

For example, the float-cmp crate has only two unsafe expressions, but 32 are reported.

@anderejd
Copy link
Contributor

Good find! Thank you.

@anderejd anderejd added the bug Something isn't working label Jun 21, 2018
@anderejd
Copy link
Contributor

Question: Should there be a command line flag to include tests but keep it off by default?

@anderejd anderejd added the question Further information is requested label Jun 21, 2018
@RazrFalcon
Copy link
Author

Unsafe in tests is irrelative to the crate itself. They will not be included into the parent crate. So I don't see a point in including them even as an option.

@anderejd
Copy link
Contributor

Sounds reasonable to me 👍

@anderejd anderejd added good first issue Good for newcomers and removed question Further information is requested labels Jun 21, 2018
@anderejd
Copy link
Contributor

@anderejd
Copy link
Contributor

@anderejd
Copy link
Contributor

anderejd commented Jul 22, 2018

Simple #[test] functions are now ignored. Fixed by: #26

Functions inside #[cfg(test)] modules that are not decorated with the #[test] attribute are still counted though, so that needs fixing.

This could be fixed as part of general tracking of code usage on a per function basis, see #22

@anderejd
Copy link
Contributor

anderejd commented Jul 23, 2018

Since #26 the counts for float-cmp seems correct to me.

Since this commit:
anderejd@9fa3534
there's a new flag --include-tests. Without it float-cmp reports 8/8 unsafe expressions which seems correct, it has four transmutes, each with a dereference expression inside. With --include-tests the count is 20/20 unsafe expressions.

@anderejd
Copy link
Contributor

Commit: anderejd@cdccce6 adds default ignore filter for #[cfg(test)] modules.

I think this issue can be closed now. Feel free to reopen if the solution is not good enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants