From 657b2bb098879b115576c08b42a2e0e63e3c437d Mon Sep 17 00:00:00 2001 From: Robert Kowalski Date: Fri, 29 Jan 2016 00:23:40 +0100 Subject: [PATCH 1/2] document differences for console.assert formatting --- NOTES.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/NOTES.md b/NOTES.md index ed5eeea..1e8a9ad 100644 --- a/NOTES.md +++ b/NOTES.md @@ -78,3 +78,32 @@ Chrome: console.log("%s %snewword", "duck") duck %snewword ``` + +## console.assert + +``` +FF / Edge: + +console.assert(false, "robert keeps %s on his balcony", "plaices") +robert keeps plaices on his balcony + +Chrome: + +console.assert(false, "robert keeps %s on his balcony", "plaices") +Assertion failed: robert keeps %s on his balcony plaices +``` + + +## console.assert + +``` +FF / Edge: + +console.assert(false, "robert keeps %s on his balcony", {foo: "bar"}) +robert keeps [object Object] on his balcony + +Chrome: + +console.assert(false, "robert keeps %s on his balcony", {foo: "bar"}) +Assertion failed: robert keeps %s on his balcony Object {foo: "bar"} +``` From dd52f49fa7e23fb3f11171630b81c86e03327abf Mon Sep 17 00:00:00 2001 From: Robert Kowalski Date: Fri, 29 Jan 2016 00:43:17 +0100 Subject: [PATCH 2/2] console.assert: support format specifier support multiple arguments and not just one message. as the logger is called if the assertion fails, console.assert MUST support format specifiers. --- index.bs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.bs b/index.bs index 2097572..6285c3a 100644 --- a/index.bs +++ b/index.bs @@ -169,7 +169,7 @@ By the time the printer operation is called, all format specifiers will have bee [NoInterfaceObject] interface Console { // Logging - void assert(boolean condition, optional any message); + void assert(boolean condition, optional any... data); void clear(); void count(optional DOMString label = ""); void debug(any... data); @@ -201,9 +201,9 @@ partial interface WorkerGlobalScope {

Logging methods

-

assert(condition, message)

+

assert(condition, ...data)

-If condition is false, perform Logger("error", «message»). +If condition is false, perform Logger("error", data).

clear()