aboutsummaryrefslogtreecommitdiff
path: root/tools/node_modules/source-map/build/assert-shim.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-06-26 10:53:17 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-06-26 10:53:17 -0700
commit501022cbaa9e63cab9cc218ee0239256945a3061 (patch)
treefbad1d122eff2e22707552bff81b35fe2df4a621 /tools/node_modules/source-map/build/assert-shim.js
parent493d0dcf303d66726be5bb08c187f8183ee96a65 (diff)
parent5383aa8bf93e5c9fed3f67853b2675ab2be10493 (diff)
Merge branch 'source-maps' of github.com:int3/emscripten into int3-source-maps
Conflicts: tools/js-optimizer.js
Diffstat (limited to 'tools/node_modules/source-map/build/assert-shim.js')
-rw-r--r--tools/node_modules/source-map/build/assert-shim.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/tools/node_modules/source-map/build/assert-shim.js b/tools/node_modules/source-map/build/assert-shim.js
new file mode 100644
index 00000000..daa1a623
--- /dev/null
+++ b/tools/node_modules/source-map/build/assert-shim.js
@@ -0,0 +1,56 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+define('test/source-map/assert', ['exports'], function (exports) {
+
+ let do_throw = function (msg) {
+ throw new Error(msg);
+ };
+
+ exports.init = function (throw_fn) {
+ do_throw = throw_fn;
+ };
+
+ exports.doesNotThrow = function (fn) {
+ try {
+ fn();
+ }
+ catch (e) {
+ do_throw(e.message);
+ }
+ };
+
+ exports.equal = function (actual, expected, msg) {
+ msg = msg || String(actual) + ' != ' + String(expected);
+ if (actual != expected) {
+ do_throw(msg);
+ }
+ };
+
+ exports.ok = function (val, msg) {
+ msg = msg || String(val) + ' is falsey';
+ if (!Boolean(val)) {
+ do_throw(msg);
+ }
+ };
+
+ exports.strictEqual = function (actual, expected, msg) {
+ msg = msg || String(actual) + ' !== ' + String(expected);
+ if (actual !== expected) {
+ do_throw(msg);
+ }
+ };
+
+ exports.throws = function (fn) {
+ try {
+ fn();
+ do_throw('Expected an error to be thrown, but it wasn\'t.');
+ }
+ catch (e) {
+ }
+ };
+
+});