From 22a46c9d2fa2167e2321618d1fb0336b307ffd49 Mon Sep 17 00:00:00 2001 From: Piotr Spieker Date: Thu, 9 Jan 2025 16:00:15 +0100 Subject: [PATCH 1/2] Specify directories for test files in testing.md Following the [cargo docs](https://github.com/rust-lang/cargo/blob/master/src/doc/src/guide/tests.md) --- src/tutorial/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tutorial/testing.md b/src/tutorial/testing.md index 646768d..627de3d 100644 --- a/src/tutorial/testing.md +++ b/src/tutorial/testing.md @@ -56,7 +56,7 @@ fn check_answer_validity() { } ``` -You can put this snippet of code in pretty much any file +You can put this snippet of code in pretty much any file in `src/` or `tests/` and `cargo test` will find and run it. The key here is the `#[test]` attribute. From 6b677b69044426f6a3c684b66b4191b7e8da636e Mon Sep 17 00:00:00 2001 From: Piotr Spieker Date: Fri, 10 Jan 2025 07:49:41 +0100 Subject: [PATCH 2/2] Improve testing.md based on code review Co-authored-by: Ed Page --- src/tutorial/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tutorial/testing.md b/src/tutorial/testing.md index 627de3d..00561ed 100644 --- a/src/tutorial/testing.md +++ b/src/tutorial/testing.md @@ -56,7 +56,7 @@ fn check_answer_validity() { } ``` -You can put this snippet of code in pretty much any file in `src/` or `tests/` +You can put this snippet of code in pretty much any source file in your package and `cargo test` will find and run it. The key here is the `#[test]` attribute.