Use assertIs<Type>() instead of assertTrue(x is Type) in tests
Categories
(Firefox for Android :: Tooling, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox152 | --- | fixed |
People
(Reporter: mkozinski, Assigned: mkozinski)
References
(Blocks 1 open bug)
Details
(Whiteboard: [fxdroid][group2][quickwins])
Attachments
(8 files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
assertIs<SomeType>(x) from kotlin.test gives a smart cast on the variable and a descriptive error on failure. Add a lint check with a quick-fix that will guide developers towards this nicer API, by showing a warning in the IDE complete with a "quick-fix" to replace code with one click. Also replace all existing usages of assertTrue(x is Type) in fenix and android-components tests.
Updated•3 months ago
|
| Assignee | ||
Comment 1•3 months ago
|
||
| Assignee | ||
Comment 2•3 months ago
|
||
| Assignee | ||
Comment 3•3 months ago
|
||
| Assignee | ||
Comment 4•2 months ago
|
||
| Assignee | ||
Comment 5•2 months ago
|
||
Updated•2 months ago
|
Comment 7•2 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/ecda386de4e1
https://hg.mozilla.org/mozilla-central/rev/8e888baf2818
https://hg.mozilla.org/mozilla-central/rev/7f08d037b646
https://hg.mozilla.org/mozilla-central/rev/21a94c445834
https://hg.mozilla.org/mozilla-central/rev/99d780f7488e
| Assignee | ||
Comment 8•1 month ago
|
||
AssertIsDetector was always meant to only be a warning with a quick-fix, so it helps developers find their way to the recommended API without annoying them with backouts. The original patch missed the additional configuration applied in android-components that upgrades all warnings to errors.
| Assignee | ||
Comment 9•1 month ago
|
||
| Assignee | ||
Comment 10•1 month ago
|
||
Comment 11•1 month ago
|
||
A patch has been attached on this bug, which was already closed. Filing a separate bug will ensure better tracking. If this was not by mistake and further action is needed, please alert the appropriate party. (Or: if the patch doesn't change behavior -- e.g. landing a test case, or fixing a typo -- then feel free to disregard this message)
Comment 12•1 month ago
|
||
Comment 13•1 month ago
|
||
| bugherder | ||
Description
•