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

Remove rust_test example which doesn't build. #1267

Merged
merged 3 commits into from
Apr 20, 2022

Conversation

cfredric
Copy link
Contributor

I think this documentation has become out-of-date. If I try to build a rust_test target with no srcs attribute and no crate attribute, I get a build error at analysis time (Error in fail: No lib.rs or hello_lib_test.rs source file found. srcs).

If I understand correctly, the two variations of rust_test targets are:

  • Unit tests: A rust_test target which specifies the crate attribute, has no srcs attribute, and may or may not have dev-dependenices in deps.
  • Integration tests: A rust_test target which has a non-empty srcs attribute, includes a dependency on the SUT in deps (plus any additional dev-dependencies), and does not specify the crate attribute.

If that understanding is incorrect, please let me know!

Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@UebelAndre
Copy link
Collaborator

If I understand correctly, the two variations of rust_test targets are:

* Unit tests: A `rust_test` target which specifies the `crate` attribute, has no `srcs` attribute, and may or may not have dev-dependenices in `deps`.

* Integration tests: A `rust_test` target which has a non-empty `srcs` attribute, includes a dependency on the SUT in `deps` (plus any additional dev-dependencies), and does not specify the `crate` attribute.

I don't think there's a hard distinction in Bazel between unit and integration tests but I do share the same mental picture here and would use this terminology (which I feel aligns with Cargo terminology where these are more explicitly defined).

@UebelAndre UebelAndre merged commit 965044a into bazelbuild:main Apr 20, 2022
@cfredric cfredric deleted the rust_test_docs branch April 20, 2022 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants