Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/_common.js

Issue 29420584: Noissue - Modify Math object for unit tests in a more sane way (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created April 24, 2017, 1:27 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/_common.js
===================================================================
--- a/test/_common.js
+++ b/test/_common.js
@@ -423,22 +423,21 @@ exports.setupRandomResult = function()
{
let randomResult = 0.5;
Object.defineProperty(this, "randomResult", {
get: () => randomResult,
set: value => randomResult = value
});
return {
- Math: {
- random: () => randomResult,
- min: Math.min,
- max: Math.max,
- round: Math.round
- }
+ Math: Object.create(Math, {
+ random: {
+ value: () => randomResult
+ }
+ })
};
};
exports.unexpectedError = function(error)
{
console.error(error);
this.ok(false, "Unexpected error: " + error);
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld