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

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

Issue 2595393003: Handle should.throw() assertion with no argument properly (Closed)
Patch Set: Created 4 years 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 | « no previous file | third_party/WebKit/LayoutTests/webaudio/unit-tests/audit.html » ('j') | 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 7d337e6f087c41ed0cc55c907a9c55bf30119376..5177c596049b0cb0cc3f97eed71d125696aeeb8c 100644
--- a/third_party/WebKit/LayoutTests/webaudio/resources/audit.js
+++ b/third_party/WebKit/LayoutTests/webaudio/resources/audit.js
@@ -270,12 +270,16 @@ window.Audit = (function () {
// Catch did not happen, so the test is failed.
failDetail = '${actual} did not throw an exception.';
} catch (error) {
- if (this._expected === undefined) {
+ if (this._expected === null) {
Raymond Toy 2016/12/22 17:55:00 What if someone did should(...).throw(undefined)
hongchan 2016/12/22 18:10:31 Giving |undefined| as an argument will do nothing.
+ // The expected error type was not given.
didThrowCorrectly = true;
- passDetail = '${actual} threw an exception of ' + error.name + '.';
+ passDetail = '${actual} threw an exception of ' + error.name + ': "'
+ + error.message + '".';
Raymond Toy 2016/12/22 17:55:00 Nit: Can we actually throw anything other than an
hongchan 2016/12/22 18:10:31 Good call. Done.
} 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} as expected: "'
+ + error.message + '".';
Raymond Toy 2016/12/22 17:55:00 Nit: Similarly, can we just say "threw expected $
hongchan 2016/12/22 18:10:31 Sure. Done.
} else {
didThrowCorrectly = false;
failDetail = '${actual} threw "' + error.name
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/unit-tests/audit.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698