Commit 3b37934
[analyzer] Make ContextResolutionTest hermetic.
This change causes all tests derived from `ContextResolutionTest` to
register lint rules during `setUp` and de-register them during
`tearDown`, making these tests properly hermetic.
Previously, the first time a `ContextResolutionTest`-derived test was
run, its `setUp` would register lint rules, and then further
`ContextResolutionTest`-derived tests would not register them, meaning
that if any test was run in the interim that attempted to properly
clean up its lint registrations, it could provoke a later test
failure.
The new approach makes the tests more predictable and
comprehensible. There is a small performance penalty (running
`pkg/analyzer/test/test_all.dart` takes ~2.5% longer on my machine). I
the predictability and comprehensibility that we gain by making the
tests hermetic is worth this small performance cost.
Change-Id: I6a6a6964541ce43a5c5afd6d047bf250050f95c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464060
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>1 parent 192f389 commit 3b37934
File tree
1 file changed
+5
-6
lines changed- pkg/analyzer/test/src/dart/resolution
1 file changed
+5
-6
lines changedLines changed: 5 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
76 | | - | |
77 | | - | |
78 | 77 | | |
79 | 78 | | |
80 | 79 | | |
| |||
246 | 245 | | |
247 | 246 | | |
248 | 247 | | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
| 248 | + | |
253 | 249 | | |
254 | 250 | | |
255 | 251 | | |
256 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
257 | 256 | | |
258 | 257 | | |
259 | 258 | | |
| |||
0 commit comments