You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-12-02 01:21:59 +02:00
Be more consistent about tests vs. main (#2644)
The content slides all use `fn main`, with the exception of the testing segment. But with this change, where it makes sense exercises use tests instead, and not both tests and `fn main`. A small change in `book.js` supports running tests when a code sample does not have `fn main` but does have `#[test]`, so these work naturally. Fixes #1581.
This commit is contained in:
committed by
GitHub
parent
699c5137c7
commit
44a79741ff
@@ -50,13 +50,6 @@ impl User {
|
||||
}
|
||||
}
|
||||
|
||||
// ANCHOR: main
|
||||
fn main() {
|
||||
let bob = User::new(String::from("Bob"), 32, 155.2);
|
||||
println!("I'm {} and my age is {}", bob.name, bob.age);
|
||||
}
|
||||
// ANCHOR_END: main
|
||||
|
||||
// ANCHOR: tests
|
||||
#[test]
|
||||
fn test_visit() {
|
||||
|
||||
Reference in New Issue
Block a user