@@ -219,10 +219,10 @@ fn it_works() {
219219This is a very common use of ` assert_eq! ` : call some function with
220220some known arguments and compare it to the expected output.
221221
222- # The ` test ` module
222+ # The ` tests ` module
223223
224224There is one way in which our existing example is not idiomatic: it's
225- missing the test module. The idiomatic way of writing our example
225+ missing the ` tests ` module. The idiomatic way of writing our example
226226looks like this:
227227
228228``` {rust,ignore}
@@ -231,7 +231,7 @@ pub fn add_two(a: i32) -> i32 {
231231}
232232
233233#[cfg(test)]
234- mod test {
234+ mod tests {
235235 use super::add_two;
236236
237237 #[test]
@@ -241,7 +241,7 @@ mod test {
241241}
242242```
243243
244- There's a few changes here. The first is the introduction of a ` mod test ` with
244+ There's a few changes here. The first is the introduction of a ` mod tests ` with
245245a ` cfg ` attribute. The module allows us to group all of our tests together, and
246246to also define helper functions if needed, that don't become a part of the rest
247247of our crate. The ` cfg ` attribute only compiles our test code if we're
@@ -260,7 +260,7 @@ pub fn add_two(a: i32) -> i32 {
260260}
261261
262262#[cfg(test)]
263- mod test {
263+ mod tests {
264264 use super::*;
265265
266266 #[test]
@@ -279,7 +279,7 @@ $ cargo test
279279 Running target/adder-91b3e234d4ed382a
280280
281281running 1 test
282- test test ::it_works ... ok
282+ test tests ::it_works ... ok
283283
284284test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
285285
@@ -292,7 +292,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
292292
293293It works!
294294
295- The current convention is to use the ` test ` module to hold your "unit-style"
295+ The current convention is to use the ` tests ` module to hold your "unit-style"
296296tests. Anything that just tests one small bit of functionality makes sense to
297297go here. But what about "integration-style" tests instead? For that, we have
298298the ` tests ` directory
@@ -325,7 +325,7 @@ $ cargo test
325325 Running target/adder-91b3e234d4ed382a
326326
327327running 1 test
328- test test ::it_works ... ok
328+ test tests ::it_works ... ok
329329
330330test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
331331
@@ -346,7 +346,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
346346Now we have three sections: our previous test is also run, as well as our new
347347one.
348348
349- That's all there is to the ` tests ` directory. The ` test ` module isn't needed
349+ That's all there is to the ` tests ` directory. The ` tests ` module isn't needed
350350here, since the whole thing is focused on tests.
351351
352352Let's finally check out that third section: documentation tests.
@@ -382,7 +382,7 @@ pub fn add_two(a: i32) -> i32 {
382382}
383383
384384#[cfg(test)]
385- mod test {
385+ mod tests {
386386 use super::*;
387387
388388 #[test]
@@ -405,7 +405,7 @@ $ cargo test
405405 Running target/adder-91b3e234d4ed382a
406406
407407running 1 test
408- test test ::it_works ... ok
408+ test tests ::it_works ... ok
409409
410410test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
411411
0 commit comments