File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -395,8 +395,8 @@ fn it_works() {
395
395
```
396
396
397
397
This 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.
400
400
This is also why ` tests ` is a suitable place to write integration-style tests:
401
401
they use the library like any other consumer of it would.
402
402
@@ -429,6 +429,11 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
429
429
Now we have three sections: our previous test is also run, as well as our new
430
430
one.
431
431
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
+
432
437
That's all there is to the ` tests ` directory. The ` tests ` module isn't needed
433
438
here, since the whole thing is focused on tests.
434
439
You can’t perform that action at this time.
0 commit comments