react / wstein / node_modules / browserify / node_modules / insert-module-globals / node_modules / combine-source-map / node_modules / source-map / test / source-map / test-dog-fooding.js
80559 views/* -*- Mode: js; js-indent-level: 2; -*- */1/*2* Copyright 2011 Mozilla Foundation and contributors3* Licensed under the New BSD license. See LICENSE or:4* http://opensource.org/licenses/BSD-3-Clause5*/6if (typeof define !== 'function') {7var define = require('amdefine')(module, require);8}9define(function (require, exports, module) {1011var SourceMapConsumer = require('../../lib/source-map/source-map-consumer').SourceMapConsumer;12var SourceMapGenerator = require('../../lib/source-map/source-map-generator').SourceMapGenerator;1314exports['test eating our own dog food'] = function (assert, util) {15var smg = new SourceMapGenerator({16file: 'testing.js',17sourceRoot: '/wu/tang'18});1920smg.addMapping({21source: 'gza.coffee',22original: { line: 1, column: 0 },23generated: { line: 2, column: 2 }24});2526smg.addMapping({27source: 'gza.coffee',28original: { line: 2, column: 0 },29generated: { line: 3, column: 2 }30});3132smg.addMapping({33source: 'gza.coffee',34original: { line: 3, column: 0 },35generated: { line: 4, column: 2 }36});3738smg.addMapping({39source: 'gza.coffee',40original: { line: 4, column: 0 },41generated: { line: 5, column: 2 }42});4344smg.addMapping({45source: 'gza.coffee',46original: { line: 5, column: 10 },47generated: { line: 6, column: 12 }48});4950var smc = new SourceMapConsumer(smg.toString());5152// Exact53util.assertMapping(2, 2, '/wu/tang/gza.coffee', 1, 0, null, smc, assert);54util.assertMapping(3, 2, '/wu/tang/gza.coffee', 2, 0, null, smc, assert);55util.assertMapping(4, 2, '/wu/tang/gza.coffee', 3, 0, null, smc, assert);56util.assertMapping(5, 2, '/wu/tang/gza.coffee', 4, 0, null, smc, assert);57util.assertMapping(6, 12, '/wu/tang/gza.coffee', 5, 10, null, smc, assert);5859// Fuzzy6061// Generated to original62util.assertMapping(2, 0, null, null, null, null, smc, assert, true);63util.assertMapping(2, 9, '/wu/tang/gza.coffee', 1, 0, null, smc, assert, true);64util.assertMapping(3, 0, null, null, null, null, smc, assert, true);65util.assertMapping(3, 9, '/wu/tang/gza.coffee', 2, 0, null, smc, assert, true);66util.assertMapping(4, 0, null, null, null, null, smc, assert, true);67util.assertMapping(4, 9, '/wu/tang/gza.coffee', 3, 0, null, smc, assert, true);68util.assertMapping(5, 0, null, null, null, null, smc, assert, true);69util.assertMapping(5, 9, '/wu/tang/gza.coffee', 4, 0, null, smc, assert, true);70util.assertMapping(6, 0, null, null, null, null, smc, assert, true);71util.assertMapping(6, 9, null, null, null, null, smc, assert, true);72util.assertMapping(6, 13, '/wu/tang/gza.coffee', 5, 10, null, smc, assert, true);7374// Original to generated75util.assertMapping(2, 2, '/wu/tang/gza.coffee', 1, 1, null, smc, assert, null, true);76util.assertMapping(3, 2, '/wu/tang/gza.coffee', 2, 3, null, smc, assert, null, true);77util.assertMapping(4, 2, '/wu/tang/gza.coffee', 3, 6, null, smc, assert, null, true);78util.assertMapping(5, 2, '/wu/tang/gza.coffee', 4, 9, null, smc, assert, null, true);79util.assertMapping(5, 2, '/wu/tang/gza.coffee', 5, 9, null, smc, assert, null, true);80util.assertMapping(6, 12, '/wu/tang/gza.coffee', 6, 19, null, smc, assert, null, true);81};8283});848586