File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -395,8 +395,8 @@ fn it_works() {
395395```
396396
397397This looks similar to our previous tests, but slightly different. We now have
398- an ` extern crate adder ` at the top. This is because the tests in the ` tests `
399- directory are an entirely separate crate, and so we need to import our library.
398+ an ` extern crate adder ` at the top. This is because each test in the ` tests `
399+ directory is an entirely separate crate, and so we need to import our library.
400400This is also why ` tests ` is a suitable place to write integration-style tests:
401401they use the library like any other consumer of it would.
402402
@@ -429,6 +429,11 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
429429Now we have three sections: our previous test is also run, as well as our new
430430one.
431431
432+ Cargo will ignore files in subdirectories of the ` tests/ ` directory.
433+ Therefore shared modules in integrations tests are possible.
434+ For example ` tests/common/mod.rs ` is not seperatly compiled by cargo but can
435+ be imported in every test with ` mod common; `
436+
432437That's all there is to the ` tests ` directory. The ` tests ` module isn't needed
433438here, since the whole thing is focused on tests.
434439
You can’t perform that action at this time.
0 commit comments