~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to tools/node_modules/source-map/build/assert-shim.js

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-09-20 22:44:35 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130920224435-apuwj4fsl3fqv1a6
Tags: 1.5.6~20130920~6010666-1
* New snapshot release
* Update the list of supported architectures to the same as libv8
  (Closes: #723129)
* emlibtool has been removed from upstream.
* Fix warning syntax-error-in-dep5-copyright
* Refresh of the patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: js; js-indent-level: 2; -*- */
 
2
/*
 
3
 * Copyright 2011 Mozilla Foundation and contributors
 
4
 * Licensed under the New BSD license. See LICENSE or:
 
5
 * http://opensource.org/licenses/BSD-3-Clause
 
6
 */
 
7
define('test/source-map/assert', ['exports'], function (exports) {
 
8
 
 
9
  let do_throw = function (msg) {
 
10
    throw new Error(msg);
 
11
  };
 
12
 
 
13
  exports.init = function (throw_fn) {
 
14
    do_throw = throw_fn;
 
15
  };
 
16
 
 
17
  exports.doesNotThrow = function (fn) {
 
18
    try {
 
19
      fn();
 
20
    }
 
21
    catch (e) {
 
22
      do_throw(e.message);
 
23
    }
 
24
  };
 
25
 
 
26
  exports.equal = function (actual, expected, msg) {
 
27
    msg = msg || String(actual) + ' != ' + String(expected);
 
28
    if (actual != expected) {
 
29
      do_throw(msg);
 
30
    }
 
31
  };
 
32
 
 
33
  exports.ok = function (val, msg) {
 
34
    msg = msg || String(val) + ' is falsey';
 
35
    if (!Boolean(val)) {
 
36
      do_throw(msg);
 
37
    }
 
38
  };
 
39
 
 
40
  exports.strictEqual = function (actual, expected, msg) {
 
41
    msg = msg || String(actual) + ' !== ' + String(expected);
 
42
    if (actual !== expected) {
 
43
      do_throw(msg);
 
44
    }
 
45
  };
 
46
 
 
47
  exports.throws = function (fn) {
 
48
    try {
 
49
      fn();
 
50
      do_throw('Expected an error to be thrown, but it wasn\'t.');
 
51
    }
 
52
    catch (e) {
 
53
    }
 
54
  };
 
55
 
 
56
});