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

cargo fmt doesn't format files in sub-directories in tests #1820

Closed
steveklabnik opened this issue Jul 25, 2017 · 3 comments · Fixed by #3777
Closed

cargo fmt doesn't format files in sub-directories in tests #1820

steveklabnik opened this issue Jul 25, 2017 · 3 comments · Fixed by #3777
Labels

Comments

@steveklabnik
Copy link
Member

I have a big integration test suite with sub-directories inside of the tests directory; running cargo fmt doesn't format these files.

@nrc nrc added this to the impl period milestone Sep 18, 2017
@brauliobz
Copy link

cargo fmt only formats test code that is reached by cargo test, which basically follows the mod inclusions, from what I could see.

I tested the following scenario:

tests/
    root_test.rs
    subdir/
        mod.rs
        sub_test.rs

sub_test.rs is formatted only when:

  • root_test.rs includes subdir by mod subdir;;
  • and subdir/mod.rs includes sub_test.rs by mod sub_test;.

Is this behavior really desirable?

@nrc
Copy link
Member

nrc commented Sep 29, 2017

I think there are two kinds of cargo test - unit tests, which cargo fmt should reach if they are reachable via module includes (I think this is fine); and integration tests, which are not formatted at all (which we should address, though I'm not really sure how).

@calebcartwright
Copy link
Member

Just a heads up that I've taken a pass at this and now have a working implementation locally.

Will open a PR for discussion/review/etc. within the next day or two

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

Successfully merging a pull request may close this issue.

5 participants