Comments from tech review in chapter 11

This commit is contained in:
Carol (Nichols || Goulding) 2022-06-02 16:50:24 -04:00
parent 891769cdca
commit fb28518feb
No known key found for this signature in database
GPG Key ID: E907EE5A736F87D4
1 changed files with 17 additions and 5 deletions

View File

@ -142,16 +142,14 @@ the result of running that test is `ok` [2]. The overall summary `test result:
ok.` [3] means that all the tests passed, and the portion that reads `1 passed;
0 failed` totals the number of tests that passed or failed.
<!-- could you quickly say what it means to be filtered? I've taken a stab at ignored /LC -->
<!-- Done! /Carol -->
It's possible to mark a test as ignored so it doesn't run in a particular
instance; we'll cover that in the “Ignoring Some Tests Unless Specifically
Requested” section later in this chapter. Because we haven't done that here,
the summary shows `0 ignored`. We can also pass an argument to the `cargo test`
command to run only tests whose name matches a string; this is called filtering
and we'll cover that in the “Running a Subset of Tests by Name” section. We
also havent filtered the tests being run, so the end of the summary shows `0
command to run only tests whose name matches a string; this is called *filtering*
and we'll cover that in the “Running a Subset of Tests by Name” section.
Here we havent filtered the tests being run, so the end of the summary shows `0
filtered out`.
The `0 measured` statistic is for benchmark tests that measure performance.
@ -787,6 +785,15 @@ message is unique or dynamic and how precise you want your test to be. In this
case, a substring of the panic message is enough to ensure that the code in the
test function executes the `else if value > 100` case.
<!---
We may want to make extra clear above that `expected` here means substring. I
think many people would assume equality rather than substring like the
expected/actual of unit tests.
(let alone how .expect(..) works. It seems we use the word expect in different
ways around the language/library )
/JT --->
To see what happens when a `should_panic` test with an `expected` message
fails, lets again introduce a bug into our code by swapping the bodies of the
`if value < 1` and the `else if value > 100` blocks:
@ -1494,3 +1501,8 @@ reduce logic bugs having to do with how your code is expected to behave.
Lets combine the knowledge you learned in this chapter and in previous
chapters to work on a project!
<!---
We hint at doc tests but don't cover them. Should we have a section in this
chapter about that? They're pretty handy.
/JT --->