Skip to content

Integration tests are not checked #38

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
jsdir opened this issue Oct 6, 2016 · 2 comments · Fixed by #43
Closed

Integration tests are not checked #38

jsdir opened this issue Oct 6, 2016 · 2 comments · Fixed by #43
Assignees

Comments

@jsdir
Copy link

jsdir commented Oct 6, 2016

The integration tests in my Cargo project (tests/integration_test.rs) are not being checked on save.

flycheck-compile gives me:

cargo rustc --lib -- -Z no-trans -Z unstable-options --error-format\=json --test -L/home/me/libname/target/debug -L/home/me/libname/target/debug/deps

This command exits successfully even when there are errors in the integration tests. I don't know if this is an issue with flycheck-rust or flycheck.

@jsdir jsdir changed the title integration tests are not checked Integration tests are not checked Oct 6, 2016
@fmdkdd
Copy link
Member

fmdkdd commented Oct 6, 2016

Thanks for pointing this out.

As far as I understand, the files in tests won't be checked by the current command because cargo rustc --lib will only build the files needed by the library. If there are any #[test] functions in these files, they will be checked, but the files in tests are obviously not part of the library, so they won't be checked.

According to the rust book:

Each file in tests/*.rs directory is treated as individual crate

And indeed, running cargo read-manifest reports the files in tests/ as separate targets:

{
  "targets": [{
      "kind": ["bin"],
      "name": "flycheck",
      "src_path": "src/main.rs"
    },
    {
      "kind": ["test"],
      "name": "integration_test",
      "src_path": "tests/integration_test.rs"
    }

And it seems that neither flycheck-rust nor flycheck has code to handle a test crate, so might as well report it here :)

There's a simple fix, and then there's the right fix, which is to eat what read-manifest feeds us completly, and is related to #8. I lean towards the latter, so I'll see what I can do about that.

@fmdkdd fmdkdd self-assigned this Oct 6, 2016
@jsdir
Copy link
Author

jsdir commented Oct 6, 2016

Thanks for the quick response!

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

Successfully merging a pull request may close this issue.

2 participants