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

Unified Diff: test/_common.js

Issue 29618577: Issue 6090 - Silence warnings from the RSA signature tests (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Nov. 25, 2017, 3:15 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 | test/signatures.js » ('j') | 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
@@ -414,16 +414,34 @@
Date: {
now: () => currentTime
}
};
};
console.warn = console.log;
+exports.silenceWarnOutput = function(test, msg)
+{
+ let warnHandler = globals.console.warn;
+ globals.console.warn = s =>
+ {
+ if (s != msg)
+ warnHandler(s);
+ };
+ try
+ {
+ return test();
+ }
+ finally
+ {
+ globals.console.warn = warnHandler;
+ }
+};
+
exports.silenceAssertionOutput = function(test, msg)
{
let msgMatch = new RegExp(`^Error: ${msg}[\r\n]`);
let errorHandler = globals.console.error;
globals.console.error = s =>
{
if (!msgMatch.test(s))
errorHandler(s);
« no previous file with comments | « no previous file | test/signatures.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld