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

« back to all changes in this revision

Viewing changes to tools/node_modules/source-map/test/source-map/test-dog-fooding.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
if (typeof define !== 'function') {
 
8
    var define = require('amdefine')(module);
 
9
}
 
10
define(function (require, exports, module) {
 
11
 
 
12
  var SourceMapConsumer = require('../../lib/source-map/source-map-consumer').SourceMapConsumer;
 
13
  var SourceMapGenerator = require('../../lib/source-map/source-map-generator').SourceMapGenerator;
 
14
 
 
15
  exports['test eating our own dog food'] = function (assert, util) {
 
16
    var smg = new SourceMapGenerator({
 
17
      file: 'testing.js',
 
18
      sourceRoot: '/wu/tang'
 
19
    });
 
20
 
 
21
    smg.addMapping({
 
22
      source: 'gza.coffee',
 
23
      original: { line: 1, column: 0 },
 
24
      generated: { line: 2, column: 2 }
 
25
    });
 
26
 
 
27
    smg.addMapping({
 
28
      source: 'gza.coffee',
 
29
      original: { line: 2, column: 0 },
 
30
      generated: { line: 3, column: 2 }
 
31
    });
 
32
 
 
33
    smg.addMapping({
 
34
      source: 'gza.coffee',
 
35
      original: { line: 3, column: 0 },
 
36
      generated: { line: 4, column: 2 }
 
37
    });
 
38
 
 
39
    smg.addMapping({
 
40
      source: 'gza.coffee',
 
41
      original: { line: 4, column: 0 },
 
42
      generated: { line: 5, column: 2 }
 
43
    });
 
44
 
 
45
    var smc = new SourceMapConsumer(smg.toString());
 
46
 
 
47
    // Exact
 
48
    util.assertMapping(2, 2, '/wu/tang/gza.coffee', 1, 0, null, smc, assert);
 
49
    util.assertMapping(3, 2, '/wu/tang/gza.coffee', 2, 0, null, smc, assert);
 
50
    util.assertMapping(4, 2, '/wu/tang/gza.coffee', 3, 0, null, smc, assert);
 
51
    util.assertMapping(5, 2, '/wu/tang/gza.coffee', 4, 0, null, smc, assert);
 
52
 
 
53
    // Fuzzy
 
54
 
 
55
    // Original to generated
 
56
    util.assertMapping(2, 0, null, null, null, null, smc, assert, true);
 
57
    util.assertMapping(2, 9, '/wu/tang/gza.coffee', 1, 0, null, smc, assert, true);
 
58
    util.assertMapping(3, 0, '/wu/tang/gza.coffee', 1, 0, null, smc, assert, true);
 
59
    util.assertMapping(3, 9, '/wu/tang/gza.coffee', 2, 0, null, smc, assert, true);
 
60
    util.assertMapping(4, 0, '/wu/tang/gza.coffee', 2, 0, null, smc, assert, true);
 
61
    util.assertMapping(4, 9, '/wu/tang/gza.coffee', 3, 0, null, smc, assert, true);
 
62
    util.assertMapping(5, 0, '/wu/tang/gza.coffee', 3, 0, null, smc, assert, true);
 
63
    util.assertMapping(5, 9, '/wu/tang/gza.coffee', 4, 0, null, smc, assert, true);
 
64
 
 
65
    // Generated to original
 
66
    util.assertMapping(2, 2, '/wu/tang/gza.coffee', 1, 1, null, smc, assert, null, true);
 
67
    util.assertMapping(3, 2, '/wu/tang/gza.coffee', 2, 3, null, smc, assert, null, true);
 
68
    util.assertMapping(4, 2, '/wu/tang/gza.coffee', 3, 6, null, smc, assert, null, true);
 
69
    util.assertMapping(5, 2, '/wu/tang/gza.coffee', 4, 9, null, smc, assert, null, true);
 
70
  };
 
71
 
 
72
});