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

Unified Diff: LayoutTests/fast/dom/DOMImplementation/script-tests/createDocumentType-err.js

Issue 24203002: Improve generated "Not enough arguments." TypeError exceptions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: NeedsRebaseline Created 7 years, 3 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
Index: LayoutTests/fast/dom/DOMImplementation/script-tests/createDocumentType-err.js
diff --git a/LayoutTests/fast/dom/DOMImplementation/script-tests/createDocumentType-err.js b/LayoutTests/fast/dom/DOMImplementation/script-tests/createDocumentType-err.js
index 60dba1ac255e148f343ad9fe9372e82fd00df081..2032e0afa4d5d5969b949df47cd51845c57694a0 100644
--- a/LayoutTests/fast/dom/DOMImplementation/script-tests/createDocumentType-err.js
+++ b/LayoutTests/fast/dom/DOMImplementation/script-tests/createDocumentType-err.js
@@ -1,15 +1,19 @@
description("createDocument tests modeled after mozilla's testing");
-shouldThrow("document.implementation.createDocumentType('foo')", "'TypeError: Not enough arguments'");
-shouldThrow("document.implementation.createDocumentType('foo', null)", "'TypeError: Not enough arguments'");
-shouldThrow("document.implementation.createDocumentType(undefined, undefined)", "'TypeError: Not enough arguments'");
-shouldThrow("document.implementation.createDocumentType(null, undefined)", "'TypeError: Not enough arguments'");
-shouldThrow("document.implementation.createDocumentType(undefined, null)", "'TypeError: Not enough arguments'");
+function ExpectedNotEnoughArgumentsMessage(num) {
+ return "\"TypeError: Failed to execute 'createDocumentType' on 'DOMImplementation': 3 arguments required, but only " + num + " present.\"";
+}
+
+shouldThrow("document.implementation.createDocumentType('foo')", ExpectedNotEnoughArgumentsMessage(1));
+shouldThrow("document.implementation.createDocumentType('foo', null)", ExpectedNotEnoughArgumentsMessage(2));
+shouldThrow("document.implementation.createDocumentType(undefined, undefined)", ExpectedNotEnoughArgumentsMessage(2));
+shouldThrow("document.implementation.createDocumentType(null, undefined)", ExpectedNotEnoughArgumentsMessage(2));
+shouldThrow("document.implementation.createDocumentType(undefined, null)", ExpectedNotEnoughArgumentsMessage(2));
shouldNotThrow("document.implementation.createDocumentType(undefined, undefined, null)");
-shouldThrow("document.implementation.createDocumentType(null, null)", "'TypeError: Not enough arguments'");
-shouldThrow("document.implementation.createDocumentType(null, '')", "'TypeError: Not enough arguments'");
-shouldThrow("document.implementation.createDocumentType('', null)", "'TypeError: Not enough arguments'");
-shouldThrow("document.implementation.createDocumentType('', '')", "'TypeError: Not enough arguments'");
+shouldThrow("document.implementation.createDocumentType(null, null)", ExpectedNotEnoughArgumentsMessage(2));
+shouldThrow("document.implementation.createDocumentType(null, '')", ExpectedNotEnoughArgumentsMessage(2));
+shouldThrow("document.implementation.createDocumentType('', null)", ExpectedNotEnoughArgumentsMessage(2));
+shouldThrow("document.implementation.createDocumentType('', '')", ExpectedNotEnoughArgumentsMessage(2));
shouldThrow("document.implementation.createDocumentType('a:', null, null)", "'NamespaceError: An attempt was made to create or change an object in a way which is incorrect with regard to namespaces.'");
shouldThrow("document.implementation.createDocumentType(':foo', null, null)", "'NamespaceError: An attempt was made to create or change an object in a way which is incorrect with regard to namespaces.'");
shouldThrow("document.implementation.createDocumentType(':', null, null)", "'NamespaceError: An attempt was made to create or change an object in a way which is incorrect with regard to namespaces.'");

Powered by Google App Engine
This is Rietveld 408576698