Skip to content

RustTest: specify module name to run exact one test case #292

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

Merged
merged 1 commit into from
Dec 23, 2018

Conversation

rhysd
Copy link
Contributor

@rhysd rhysd commented Dec 22, 2018

I found one issue for :RustTest.

  • some_test.rs
#[test]
fn test_foo() {}
  • another_test.rs
#[test]
fn test_foo() {}

Running :RustTest in test_foo() function in some_test.rs runs both test cases some_test::test_foo and another_test::test_foo.

To solve this issue, this patch extracts module name from its file name and specify mod_name::test_func instead of test_func.

@rust-highfive
Copy link

r? @steveklabnik

(rust_highfive has picked a reviewer for you, use r? to override)

@da-x
Copy link
Member

da-x commented Dec 22, 2018

I wish there was something more precise for this. Opened: rust-lang/cargo#6478

@rhysd
Copy link
Contributor Author

rhysd commented Dec 23, 2018

Looks good. I agree that it's definitely better that cargo supports running a test specified by position in file.
Until the feature is supported, I want to add this patch as the best effort.

@rhysd rhysd force-pushed the RustTest-specify-mod branch from 4b5bed6 to ce5aada Compare December 23, 2018 04:34
@da-x da-x merged commit c631252 into rust-lang:master Dec 23, 2018
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.

4 participants