Skip to content

Restore the generated tests module created by cargo new #3799

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
Mar 6, 2017
Merged

Restore the generated tests module created by cargo new #3799

merged 1 commit into from
Mar 6, 2017

Conversation

carols10cents
Copy link
Member

Appears to have been removed unintentionally in #3004.

Was just working on the book, ran cargo new adder with cargo-0.18.0-nightly (6f1b860 2017-02-11), and got this in src/lib.rs:

#[test]
fn it_works() {
}

when I expected to get this:

#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
    }
}

It looks like this was changed as part of #3004 (removed, added), I'm assuming unintentionally?

The regression has not yet hit the beta channel; cargo-0.17.0-nightly (0bb8047 2017-02-06) generates the src/lib.rs I expect.

Appears to have been removed unintentionally in #3004.
@rust-highfive
Copy link

r? @brson

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

@carols10cents
Copy link
Member Author

AHA I think i figured out what happened-- the original templating PR was created before the tests module was created!

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Mar 6, 2017

📌 Commit de06b75 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Mar 6, 2017

⌛ Testing commit de06b75 with merge c54a2ad...

bors added a commit that referenced this pull request Mar 6, 2017
…alexcrichton

Restore the generated tests module created by `cargo new`

Appears to have been removed unintentionally in #3004.

Was just working on the book, ran `cargo new adder` with cargo-0.18.0-nightly (6f1b860 2017-02-11), and got this in `src/lib.rs`:

```rust
#[test]
fn it_works() {
}
```

when I expected to get this:

```rust
#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
    }
}
```

It looks like this was changed as part of #3004 ([removed](875a8ab#diff-149dd4362a3b0dc13b113762713119dfL477), [added](875a8ab#diff-149dd4362a3b0dc13b113762713119dfR678)), I'm assuming unintentionally?

The regression has not yet hit the beta channel; `cargo-0.17.0-nightly (0bb8047 2017-02-06)` generates the src/lib.rs I expect.
@alexcrichton
Copy link
Member

Heh, that's an amusing historical accident :)

@bors
Copy link
Contributor

bors commented Mar 6, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing c54a2ad to master...

@bors bors merged commit de06b75 into rust-lang:master Mar 6, 2017
@shepmaster shepmaster deleted the restore-generated-tests-module branch April 13, 2017 13:58
@ehuss ehuss added this to the 1.17.0 milestone Feb 6, 2022
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.

6 participants