Commit 6a49142
authored
Introduce a severity level for issues, and a 'warning' severity (#931)
This introduces the concept of severity to the `Issue` type, represented
by a new enum `Issue.Severity` with two cases: `.warning` and `.error`.
Error is the default severity for all issues, matching current behavior,
but warning is provided as a new option which does not cause the test
the issue is associated with to be marked as a failure.
In this PR, these are
[SPI](https://github.com/swiftlang/swift-testing/blob/main/Documentation/SPI.md)
but they could be considered for promotion to public API eventually.
Additional work would be needed to permit test authors to record issues
with severity < `.error`, since APIs like `Issue.record()` are not being
modified at this time to allow customizing the severity.
### Motivation:
There are certain situations where a problem may arise during a test
that doesn't necessarily affect its outcome or signal an important
problem, but is worth calling attention to. A specific example use case
I have in mind is to allow the testing library to record a warning issue
about problems with the arguments passed to a parameterized test, such
as having duplicate arguments.
### Modifications:
- Introduce `Issue.Severity` as an SPI enum.
- Introduce an SPI property `severity` to `Issue` with default value
`.error`.
- Modify entry point logic to exit with `EXIT_SUCCESS` if all issues
recorded had severity < `.error`.
- Modify console output formatting logic and data structures to
represent warning issues sensibly.
### Checklist:
- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.
- [x] Add new tests1 parent 63eb1d9 commit 6a49142
File tree
18 files changed
+468
-109
lines changed- Sources/Testing
- ABI
- EntryPoints
- v0/Encoded
- Events
- Recorder
- Issues
- Running
- Tests/TestingTests
18 files changed
+468
-109
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
43 | | - | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| |||
270 | 272 | | |
271 | 273 | | |
272 | 274 | | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
273 | 282 | | |
274 | 283 | | |
275 | 284 | | |
| |||
278 | 287 | | |
279 | 288 | | |
280 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
281 | 297 | | |
282 | 298 | | |
283 | 299 | | |
| |||
517 | 533 | | |
518 | 534 | | |
519 | 535 | | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
520 | 539 | | |
521 | 540 | | |
522 | 541 | | |
| |||
547 | 566 | | |
548 | 567 | | |
549 | 568 | | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
550 | 585 | | |
551 | 586 | | |
552 | 587 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
19 | 32 | | |
20 | 33 | | |
21 | 34 | | |
| |||
33 | 46 | | |
34 | 47 | | |
35 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
36 | 54 | | |
37 | 55 | | |
38 | 56 | | |
| |||
48 | 66 | | |
49 | 67 | | |
50 | 68 | | |
| 69 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| 48 | + | |
| 49 | + | |
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 293 | + | |
297 | 294 | | |
298 | 295 | | |
299 | 296 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
| 166 | + | |
165 | 167 | | |
166 | 168 | | |
167 | 169 | | |
| |||
Lines changed: 39 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
117 | | - | |
| 118 | + | |
118 | 119 | | |
119 | | - | |
| 120 | + | |
120 | 121 | | |
121 | | - | |
| 122 | + | |
| 123 | + | |
122 | 124 | | |
123 | | - | |
| 125 | + | |
124 | 126 | | |
125 | 127 | | |
126 | | - | |
127 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
128 | 132 | | |
129 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
130 | 136 | | |
131 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
132 | 140 | | |
133 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
134 | 144 | | |
135 | 145 | | |
136 | 146 | | |
137 | | - | |
| 147 | + | |
138 | 148 | | |
139 | 149 | | |
140 | 150 | | |
| |||
267 | 277 | | |
268 | 278 | | |
269 | 279 | | |
270 | | - | |
| 280 | + | |
| 281 | + | |
271 | 282 | | |
272 | 283 | | |
273 | 284 | | |
| |||
355 | 366 | | |
356 | 367 | | |
357 | 368 | | |
358 | | - | |
| 369 | + | |
359 | 370 | | |
360 | 371 | | |
361 | 372 | | |
362 | 373 | | |
363 | 374 | | |
364 | 375 | | |
365 | 376 | | |
366 | | - | |
| 377 | + | |
367 | 378 | | |
368 | 379 | | |
369 | 380 | | |
| |||
400 | 411 | | |
401 | 412 | | |
402 | 413 | | |
403 | | - | |
| 414 | + | |
404 | 415 | | |
405 | 416 | | |
406 | | - | |
| 417 | + | |
407 | 418 | | |
408 | | - | |
409 | | - | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
410 | 427 | | |
411 | 428 | | |
412 | 429 | | |
| |||
435 | 452 | | |
436 | 453 | | |
437 | 454 | | |
438 | | - | |
| 455 | + | |
439 | 456 | | |
440 | 457 | | |
441 | 458 | | |
442 | 459 | | |
443 | 460 | | |
444 | | - | |
| 461 | + | |
445 | 462 | | |
446 | 463 | | |
447 | 464 | | |
| |||
498 | 515 | | |
499 | 516 | | |
500 | 517 | | |
501 | | - | |
| 518 | + | |
502 | 519 | | |
503 | 520 | | |
504 | 521 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
| 25 | + | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
| |||
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| 69 | + | |
| 70 | + | |
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
| |||
122 | 128 | | |
123 | 129 | | |
124 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
125 | 134 | | |
126 | 135 | | |
127 | 136 | | |
| |||
157 | 166 | | |
158 | 167 | | |
159 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
160 | 172 | | |
161 | 173 | | |
162 | 174 | | |
| |||
0 commit comments