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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 421
422 exports.setupRandomResult = function() 422 exports.setupRandomResult = function()
423 { 423 {
424 let randomResult = 0.5; 424 let randomResult = 0.5;
425 Object.defineProperty(this, "randomResult", { 425 Object.defineProperty(this, "randomResult", {
426 get: () => randomResult, 426 get: () => randomResult,
427 set: value => randomResult = value 427 set: value => randomResult = value
428 }); 428 });
429 429
430 return { 430 return {
431 Math: { 431 Math: Object.create(Math, {
432 random: () => randomResult, 432 random: {
433 min: Math.min, 433 value: () => randomResult
434 max: Math.max, 434 }
435 round: Math.round 435 })
436 }
437 }; 436 };
438 }; 437 };
439 438
440 exports.unexpectedError = function(error) 439 exports.unexpectedError = function(error)
441 { 440 {
442 console.error(error); 441 console.error(error);
443 this.ok(false, "Unexpected error: " + error); 442 this.ok(false, "Unexpected error: " + error);
444 }; 443 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld