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

Update testing.md to reflect changes to cargo new #37368

Merged
merged 6 commits into from Nov 12, 2016

Commits on Nov 8, 2016

  1. Update testing.md to reflect changes to cargo new

    `cargo new` now creates a `src/lib.rs` with a `tests` module by default. I've updated the earlier examples in this doc to reflect this. However, I don't know how we want to approach the "introduction" to idiomatic testing that follows in "the tests module" section. I _think_ it should be broken apart, with the module concept being introduced early on, and the `super` concept being addressed when we hit the `add_two` example. I'd like to get agreement on that being the right approach before I do it though.
    
    I _also_ removed the `#fn main() {}` hidden at the beginning of each example, as these cause Rust Playground to not treat the file as a set of tests that it can run. Removing it _should_ cause Rust Playground to display a "Test >" button in the top left when a user runs the code, which will allow them to see the test runner output.
    trotter committed Nov 8, 2016
    Configuration menu
    Copy the full SHA
    b1d0c5b View commit details
    Browse the repository at this point in the history

Commits on Nov 10, 2016

  1. Instruct play.rust-lang.org to treat code as tests

    Without these changes, play.rust-lang.org (as of today) would wrap
    our examples in `fn main() {}`. This prevents the user from being able
    to easily run the tests.
    trotter committed Nov 10, 2016
    Configuration menu
    Copy the full SHA
    d9c60ca View commit details
    Browse the repository at this point in the history
  2. Remove mod tests from earlier sections

    The narrative flows better if we follow what @steveklabnik is doing in
    rust-lang/book#288. Therefore, I completely copied it.
    trotter committed Nov 10, 2016
    Configuration menu
    Copy the full SHA
    35903bb View commit details
    Browse the repository at this point in the history
  3. Change project path for consistency

    I had used `/tmp/adder` for my previous commits. Flipped over to
    `/home/you/projects/adder` for consistency with other parts of testing.md
    trotter committed Nov 10, 2016
    Configuration menu
    Copy the full SHA
    dd92809 View commit details
    Browse the repository at this point in the history
  4. Remove extraneous word

    trotter committed Nov 10, 2016
    Configuration menu
    Copy the full SHA
    4cf7644 View commit details
    Browse the repository at this point in the history

Commits on Nov 11, 2016

  1. Ignore tests failing due to lack of fn main

    While the commit message on this one sounds terrible, it's really not so
    bad. The issue is that our test runner _expects_ a `fn main() {}` in
    code blocks that it'll test, but this code really shouldn't have them.
    If it did, then clicking the "play" link in the docs would result in
    play.rust-lang.org not treating this code as a test example to be run.
    trotter committed Nov 11, 2016
    Configuration menu
    Copy the full SHA
    2a832a0 View commit details
    Browse the repository at this point in the history