`TelemetryTestUtils.assertScalar` will probably do the wrong thing if `value` is `0`
Categories
(Toolkit :: Telemetry, defect, P3)
Tracking
()
People
(Reporter: chutten, Assigned: Mardak)
References
Details
Attachments
(1 file)
TelemetryTestUtils.assertScalar
checks if the value passed in is > 0
before asserting that the value is equal. This will not ensure that, e.g., a bool scalar is false
.
Maybe we should fix that.
assertKeyedScalar
doesn't do it this way.
Reporter | ||
Updated•5 years ago
|
Comment 1•5 years ago
|
||
This almost caused me trouble. I was planning to encode errors as the value 0
, and I was writing a test to verify this functionality. Because of this unusual behavior, I will probably use a different value to convey errors.
Reporter | ||
Comment 2•5 years ago
|
||
To instead work around the error, please feel free to use the following workaround:
Assert.ok(scalarName in scalars && scalars[scalarName] === value, msg)
Reporter | ||
Comment 3•5 years ago
|
||
Huh, and the docstring suggests that the function only works for uint scalars:
@param {Number} value The expected value for the provided scalar.
Curious.
Assignee | ||
Comment 4•4 years ago
|
||
Allow both 0 and undefined to have TelemetryTestUtils.assertScalar check for not reported scalar.
Updated•4 years ago
|
Updated•4 years ago
|
Comment 7•4 years ago
|
||
bugherder |
Updated•4 years ago
|
Description
•