From f33143837e5424c5417ed0366c7d8a05800113fa Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Thu, 28 Feb 2019 18:44:45 +0000 Subject: [PATCH] Bug 1527673 - Output histogram name in asserts r=chutten Depends on D21531 Differential Revision: https://phabricator.services.mozilla.com/D21532 --HG-- extra : moz-landing-system : lando --- .../tests/utils/TelemetryTestUtils.jsm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/toolkit/components/telemetry/tests/utils/TelemetryTestUtils.jsm b/toolkit/components/telemetry/tests/utils/TelemetryTestUtils.jsm index f7cf9dfaa678..2756162be42d 100644 --- a/toolkit/components/telemetry/tests/utils/TelemetryTestUtils.jsm +++ b/toolkit/components/telemetry/tests/utils/TelemetryTestUtils.jsm @@ -233,13 +233,13 @@ var TelemetryTestUtils = { if (i == index) { found = true; Assert.equal(val, expected, - `expected counts should match for the histogram index ${i}`); + `expected counts should match for ${histogram.name()} at index ${i}`); } else { Assert.equal(val, 0, - `unexpected counts should be zero for the histogram index ${i}`); + `unexpected counts should be zero for ${histogram.name()} at index ${i}`); } } - Assert.ok(found, `Should have found an entry for histogram index ${index}`); + Assert.ok(found, `Should have found an entry for ${histogram.name()} at index ${index}`); }, /** @@ -252,12 +252,12 @@ var TelemetryTestUtils = { assertKeyedHistogramSum(histogram, key, expected) { const snapshot = histogram.snapshot(); if (expected === undefined) { - Assert.ok(!(key in snapshot), `The histogram must not contain ${key}.`); + Assert.ok(!(key in snapshot), `The histogram ${histogram.name()} must not contain ${key}.`); return; } - Assert.ok(key in snapshot, `The histogram must contain ${key}.`); + Assert.ok(key in snapshot, `The histogram ${histogram.name()} must contain ${key}.`); Assert.equal(snapshot[key].sum, expected, - `The key ${key} must contain the expected sum.`); + `The key ${key} must contain the expected sum in ${histogram.name()}.`); }, /** @@ -272,16 +272,16 @@ var TelemetryTestUtils = { assertKeyedHistogramValue(histogram, key, index, expected) { const snapshot = histogram.snapshot(); if (!(key in snapshot)) { - Assert.ok(false, `The histogram must contain ${key}`); + Assert.ok(false, `The histogram ${histogram.name()} must contain ${key}`); return; } for (let [i, val] of Object.entries(snapshot[key].values)) { if (i == index) { Assert.equal(val, expected, - `expected counts should match for the histogram index ${i}`); + `expected counts should match for ${histogram.name()} at index ${i}`); } else { Assert.equal(val, 0, - `unexpected counts should be zero for the histogram index ${i}`); + `unexpected counts should be zero for ${histogram.name() } at index ${i}`); } } },