michael@0: /* michael@0: * WARNING! michael@0: * michael@0: * Do not edit this file directly, it is built from the sources at michael@0: * https://github.com/mozilla/source-map/ michael@0: */ michael@0: michael@0: Components.utils.import('resource://test/Utils.jsm'); michael@0: /* -*- Mode: js; js-indent-level: 2; -*- */ michael@0: /* michael@0: * Copyright 2011 Mozilla Foundation and contributors michael@0: * Licensed under the New BSD license. See LICENSE or: michael@0: * http://opensource.org/licenses/BSD-3-Clause michael@0: */ michael@0: define("test/source-map/test-dog-fooding", ["require", "exports", "module"], function (require, exports, module) { michael@0: michael@0: var SourceMapConsumer = require('source-map/source-map-consumer').SourceMapConsumer; michael@0: var SourceMapGenerator = require('source-map/source-map-generator').SourceMapGenerator; michael@0: michael@0: exports['test eating our own dog food'] = function (assert, util) { michael@0: var smg = new SourceMapGenerator({ michael@0: file: 'testing.js', michael@0: sourceRoot: '/wu/tang' michael@0: }); michael@0: michael@0: smg.addMapping({ michael@0: source: 'gza.coffee', michael@0: original: { line: 1, column: 0 }, michael@0: generated: { line: 2, column: 2 } michael@0: }); michael@0: michael@0: smg.addMapping({ michael@0: source: 'gza.coffee', michael@0: original: { line: 2, column: 0 }, michael@0: generated: { line: 3, column: 2 } michael@0: }); michael@0: michael@0: smg.addMapping({ michael@0: source: 'gza.coffee', michael@0: original: { line: 3, column: 0 }, michael@0: generated: { line: 4, column: 2 } michael@0: }); michael@0: michael@0: smg.addMapping({ michael@0: source: 'gza.coffee', michael@0: original: { line: 4, column: 0 }, michael@0: generated: { line: 5, column: 2 } michael@0: }); michael@0: michael@0: var smc = new SourceMapConsumer(smg.toString()); michael@0: michael@0: // Exact michael@0: util.assertMapping(2, 2, '/wu/tang/gza.coffee', 1, 0, null, smc, assert); michael@0: util.assertMapping(3, 2, '/wu/tang/gza.coffee', 2, 0, null, smc, assert); michael@0: util.assertMapping(4, 2, '/wu/tang/gza.coffee', 3, 0, null, smc, assert); michael@0: util.assertMapping(5, 2, '/wu/tang/gza.coffee', 4, 0, null, smc, assert); michael@0: michael@0: // Fuzzy michael@0: michael@0: // Original to generated michael@0: util.assertMapping(2, 0, null, null, null, null, smc, assert, true); michael@0: util.assertMapping(2, 9, '/wu/tang/gza.coffee', 1, 0, null, smc, assert, true); michael@0: util.assertMapping(3, 0, '/wu/tang/gza.coffee', 1, 0, null, smc, assert, true); michael@0: util.assertMapping(3, 9, '/wu/tang/gza.coffee', 2, 0, null, smc, assert, true); michael@0: util.assertMapping(4, 0, '/wu/tang/gza.coffee', 2, 0, null, smc, assert, true); michael@0: util.assertMapping(4, 9, '/wu/tang/gza.coffee', 3, 0, null, smc, assert, true); michael@0: util.assertMapping(5, 0, '/wu/tang/gza.coffee', 3, 0, null, smc, assert, true); michael@0: util.assertMapping(5, 9, '/wu/tang/gza.coffee', 4, 0, null, smc, assert, true); michael@0: michael@0: // Generated to original michael@0: util.assertMapping(2, 2, '/wu/tang/gza.coffee', 1, 1, null, smc, assert, null, true); michael@0: util.assertMapping(3, 2, '/wu/tang/gza.coffee', 2, 3, null, smc, assert, null, true); michael@0: util.assertMapping(4, 2, '/wu/tang/gza.coffee', 3, 6, null, smc, assert, null, true); michael@0: util.assertMapping(5, 2, '/wu/tang/gza.coffee', 4, 9, null, smc, assert, null, true); michael@0: }; michael@0: michael@0: }); michael@0: function run_test() { michael@0: runSourceMapTests('test/source-map/test-dog-fooding', do_throw); michael@0: }