Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Unified Diff: third_party/WebKit/LayoutTests/webaudio/resources/audit.js

Issue 2803913003: Add options.omitErrorMessage for should.throw() (Closed)
Patch Set: Add [error message omitted] Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/webaudio/dom-exceptions-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/webaudio/resources/audit.js
diff --git a/third_party/WebKit/LayoutTests/webaudio/resources/audit.js b/third_party/WebKit/LayoutTests/webaudio/resources/audit.js
index d2946161efbb1f2cd2f707a8d6487db5145ddee8..f8d4d35b462ae8210f815cc3f6fb24d1b75166c2 100644
--- a/third_party/WebKit/LayoutTests/webaudio/resources/audit.js
+++ b/third_party/WebKit/LayoutTests/webaudio/resources/audit.js
@@ -269,10 +269,15 @@ window.Audit = (function () {
* should(() => { let a = b; }, 'A bad code').throw();
* should(() => { let c = d; }, 'Assigning d to c.')
* .throw('ReferenceError');
+ * should(() => { let e = f; }, 'Assigning e to f.')
+ * .throw('ReferenceError', { omitErrorMessage: true });
*
* @result
- * "PASS A bad code threw an exception of ReferenceError."
- * "PASS Assigning d to c threw ReferenceError."
+ * "PASS A bad code threw an exception of ReferenceError: b is not
+ * defined."
+ * "PASS Assigning d to c threw ReferenceError: d is not defined."
+ * "PASS Assigning e to f threw ReferenceError: [error message
+ * omitted]."
*/
throw () {
this._processArguments(arguments);
@@ -287,16 +292,17 @@ window.Audit = (function () {
// Catch did not happen, so the test is failed.
failDetail = '${actual} did not throw an exception.';
} catch (error) {
+ let errorMessage = this._options.omitErrorMessage
+ ? ': [error message omitted]'
+ : ': "' + error.message + '"';
if (this._expected === null || this._expected === undefined) {
// The expected error type was not given.
didThrowCorrectly = true;
- passDetail = '${actual} threw ' + error.name + ': "'
- + error.message + '".';
+ passDetail = '${actual} threw ' + error.name + errorMessage + '.';
} else if (error.name === this._expected) {
// The expected error type match the actual one.
didThrowCorrectly = true;
- passDetail = '${actual} threw ${expected}: "'
- + error.message + '".';
+ passDetail = '${actual} threw ${expected}' + errorMessage + '.';
} else {
didThrowCorrectly = false;
failDetail = '${actual} threw "' + error.name
« no previous file with comments | « third_party/WebKit/LayoutTests/webaudio/dom-exceptions-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698