You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-11-30 17:15:23 +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
@@ -4,6 +4,6 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
[[bin]]
|
||||
name = "offset-differences"
|
||||
[lib]
|
||||
name = "offset_differences"
|
||||
path = "exercise.rs"
|
||||
|
||||
@@ -11,7 +11,7 @@ Copy the following code to <https://play.rust-lang.org/> and make the tests
|
||||
pass. Use an iterator expression and `collect` the result to construct the
|
||||
return value.
|
||||
|
||||
```rust
|
||||
```rust,editable
|
||||
{{#include exercise.rs:offset_differences}}
|
||||
todo!()
|
||||
}
|
||||
|
||||
@@ -51,5 +51,3 @@ fn test_degenerate_cases() {
|
||||
assert_eq!(offset_differences(1, empty), vec![]);
|
||||
}
|
||||
// ANCHOR_END: unit-tests
|
||||
|
||||
fn main() {}
|
||||
|
||||
Reference in New Issue
Block a user