Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

extended assert example

  • Loading branch information...
commit 87304c48f4a61a97fd73feb3f19a35270b0e759d 1 parent a83d33e
@tj authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 examples/assert.js
View
11 examples/assert.js
@@ -14,9 +14,11 @@ function assert(expr) {
, src = parse(line);
var fmt = ' \033[91massert: \033[31m%s\033[0m'
- + '\033[90m in %s:%d\033[0m';
+ + '\n \033[90min: %s:%d'
+ + '\n value: %j\033[0m'
+ + '\n';
- console.error(fmt, src, file, lineno);
+ console.error(fmt, src, file, lineno, expr);
}
function parse(str) {
@@ -28,4 +30,9 @@ assert('wahoo');
var user = { authenticated: false };
assert(user.authenticated);
+user.authenticated = true;
+assert(user.authenticated);
+
+user.authenticated = 0;
+assert(user.authenticated);
Please sign in to comment.
Something went wrong with that request. Please try again.