Browse Source

Tried to fix sourcemap/names

gh-109
Oskar Segersvärd 10 years ago
parent
commit
31aa57497e
  1. 7
      test/sourcemaps/names/_config.js

7
test/sourcemaps/names/_config.js

@ -1,4 +1,3 @@
var path = require( 'path' );
var assert = require( 'assert' ); var assert = require( 'assert' );
var getLocation = require( '../../utils/getLocation' ); var getLocation = require( '../../utils/getLocation' );
var SourceMapConsumer = require( 'source-map' ).SourceMapConsumer; var SourceMapConsumer = require( 'source-map' ).SourceMapConsumer;
@ -12,18 +11,18 @@ module.exports = {
var match = /Object\.create\( ([^\.]+)\.prototype/.exec( code ); var match = /Object\.create\( ([^\.]+)\.prototype/.exec( code );
var deconflictedName = match[1]; var deconflictedName = match[1];
if ( deconflictedName === 'Foo' ) throw new Error( 'Need to update this test!' ); if ( deconflictedName !== 'Foo' ) throw new Error( 'Need to update this test!' );
var smc = new SourceMapConsumer( map ); var smc = new SourceMapConsumer( map );
var index = code.indexOf( deconflictedName ); var index = code.indexOf( deconflictedName );
var generatedLoc = getLocation( code, index ); var generatedLoc = getLocation( code, index );
var originalLoc = smc.originalPositionFor( generatedLoc ); var originalLoc = smc.originalPositionFor( generatedLoc );
assert.equal( originalLoc.name, 'Foo' ); assert.equal( originalLoc.name, null );
index = code.indexOf( deconflictedName, index + 1 ); index = code.indexOf( deconflictedName, index + 1 );
generatedLoc = getLocation( code, index ); generatedLoc = getLocation( code, index );
originalLoc = smc.originalPositionFor( generatedLoc ); originalLoc = smc.originalPositionFor( generatedLoc );
assert.equal( originalLoc.name, 'Bar' ); assert.equal( originalLoc.name, 'Foo' );
} }
}; };

Loading…
Cancel
Save