Commit 55090d1
committed
docs: fix verified API errors in Testing Facilities section
Audit of all 35 code snippets in 7.testing pages against actual headers
revealed structural bugs that were verified by compiling and running
each example. Fixes:
* 7a thread_pool snippet: replace nonexistent <boost/capy/thread_pool.hpp>
and pool.post(lambda) (which takes only `continuation&`) with the
idiomatic run_async(pool.get_executor())(coroutine) pattern.
* 7b/7c/7d "Putting It Together" snippets: add missing concept-header
includes (read_stream, read_source, write_sink, buffer_source,
buffer_sink) so the templated examples actually compile.
* 7b/7c/7d "Putting It Together" snippets: fix a structural bug where
mocks were constructed and asserted on outside the f.armed() lambda.
With armed running the body multiple times for fault injection, the
outside state was the last run's state, not the success run's. Move
mock construction and state assertions inside the lambda following
the canonical capy test pattern, with functions-under-test now
returning std::error_code so callers can guard with
`if(ec) co_return;`.
* 7c handle_request: read_source::read returns cond::eof on partial
fill; treat eof-with-data as success rather than bailing.
* 7d buffer_sink basic example: remove the dead `if(bufs.empty())
co_return;` check. prepare() always returns a 1-element span for a
non-empty input array.
* All "Returns ...eof" prose and table descriptions: standardize on
cond::eof spelling per error.hpp:32 ("Compare with cond::eof"), since
cond::eof is the user-side comparison value while error::eof is the
implementation's returned code. Both compare equal.
* Mock constructor signatures in tables: add `explicit` qualifier to
match the actual headers (read_stream, write_stream, read_source,
write_sink, buffer_source, buffer_sink, fuse(error_code)).
* Document write_some rollback semantics: write_stream::write_some and
write_sink::write_some roll back on expected-data mismatch and return
(test_failure, 0); call out the asymmetry with write_sink::write,
which leaves the partial write in place.
* Expand 7a's "armed() vs. inert()" subsection with a smoke-test-first
pattern showing the same test body under both modes, plus prose
explaining when each fits.
* 7e bufgrind: add prose explaining why snippets use f.inert (bufgrind
does not do I/O or consult a fuse, so a single pass is sufficient).
All snippets verified by compiling and running them through the test
suite during development.1 parent 8b0ebd9 commit 55090d1
7 files changed
Lines changed: 160 additions & 98 deletions
File tree
- doc/modules/ROOT
- pages/7.testing
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
160 | | - | |
161 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
162 | 203 | | |
163 | 204 | | |
164 | 205 | | |
| |||
213 | 254 | | |
214 | 255 | | |
215 | 256 | | |
216 | | - | |
| 257 | + | |
217 | 258 | | |
218 | | - | |
219 | | - | |
220 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
221 | 264 | | |
222 | 265 | | |
223 | 266 | | |
224 | | - | |
| 267 | + | |
225 | 268 | | |
226 | 269 | | |
227 | 270 | | |
228 | | - | |
| 271 | + | |
229 | 272 | | |
230 | | - | |
| 273 | + | |
231 | 274 | | |
232 | | - | |
| 275 | + | |
233 | 276 | | |
234 | 277 | | |
235 | 278 | | |
236 | 279 | | |
237 | 280 | | |
238 | 281 | | |
239 | 282 | | |
240 | | - | |
241 | 283 | | |
242 | | - | |
243 | | - | |
| 284 | + | |
| 285 | + | |
244 | 286 | | |
245 | | - | |
246 | | - | |
| 287 | + | |
247 | 288 | | |
248 | 289 | | |
249 | 290 | | |
| |||
273 | 314 | | |
274 | 315 | | |
275 | 316 | | |
276 | | - | |
| 317 | + | |
277 | 318 | | |
278 | 319 | | |
279 | 320 | | |
| |||
330 | 371 | | |
331 | 372 | | |
332 | 373 | | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
333 | 377 | | |
334 | | - | |
335 | 378 | | |
336 | 379 | | |
337 | 380 | | |
338 | 381 | | |
339 | | - | |
340 | | - | |
| 382 | + | |
341 | 383 | | |
342 | 384 | | |
343 | | - | |
| 385 | + | |
| 386 | + | |
344 | 387 | | |
345 | 388 | | |
346 | 389 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
| 221 | + | |
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
229 | | - | |
230 | | - | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
| 303 | + | |
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
309 | | - | |
310 | | - | |
| 309 | + | |
| 310 | + | |
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
| |||
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
327 | | - | |
| 327 | + | |
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
333 | | - | |
| 333 | + | |
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
| |||
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
367 | | - | |
368 | | - | |
369 | 367 | | |
| 368 | + | |
370 | 369 | | |
| 370 | + | |
| 371 | + | |
371 | 372 | | |
372 | 373 | | |
373 | 374 | | |
374 | 375 | | |
375 | 376 | | |
376 | 377 | | |
377 | | - | |
| 378 | + | |
| 379 | + | |
378 | 380 | | |
379 | 381 | | |
380 | 382 | | |
| |||
383 | 385 | | |
384 | 386 | | |
385 | 387 | | |
386 | | - | |
| 388 | + | |
387 | 389 | | |
388 | 390 | | |
389 | 391 | | |
390 | 392 | | |
391 | | - | |
| 393 | + | |
392 | 394 | | |
393 | 395 | | |
394 | 396 | | |
395 | 397 | | |
396 | 398 | | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | 399 | | |
401 | | - | |
402 | | - | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
403 | 405 | | |
404 | 406 | | |
405 | 407 | | |
| |||
0 commit comments