Closed Bug 980981 Opened 11 years ago Closed 11 years ago

[MocksHelper] Fail when we specify a mock twice

Categories

(Firefox OS Graveyard :: Gaia::TestAgent, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: julienw, Assigned: julienw)

Details

Attachments

(1 file)

(deleted), text/x-github-pull-request
rik
: review+
Details
In Bug 943976 we had a programming mistake: the author specified an object name twice in the MocksHelper constructor. When this happens, we save the original object twice, which means that the second time, we save the mock. Then when we "restore" it, we restore the mock instead of the original object. This patch will fail early when there is such a programming mistake.
Assignee: nobody → felash
Attached file github PR (deleted) —
Rik, I think you're a good person to review this, but feel free to say if you don't feel comfortable enough. I'd ask Etienne ;)
Attachment #8387675 - Flags: review?(anthony)
Comment on attachment 8387675 [details] github PR It might not be a big win but I think checking for uniqueness by sorting the array and then comparing with the previous item will be a bit faster. And should read better. Also, two tests are actually failing because of this so they'll need to be fixed before landing.
Attachment #8387675 - Flags: review?(anthony)
Comment on attachment 8387675 [details] github PR Updated the patch, Travis is green, I locally checked it was still working as expected. I also fixed the jshint issues.
Attachment #8387675 - Flags: review?(anthony)
Comment on attachment 8387675 [details] github PR r=me with the comment about comment on Github addressed.
Attachment #8387675 - Flags: review?(anthony) → review+
Here is a comment about the comment I added to address your comment in comment 4. Pushed a rebased version and waiting for Travis.
master: 28497d16c9f5d3feafaf3ca5b45cabd2df157366
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: