From 4a4ef6febcf55c35c005476cf9439955dcb77b12 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 2 Sep 2015 19:14:11 -0400 Subject: [PATCH] tidy up test --- test/sourcemaps/names/_config.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/test/sourcemaps/names/_config.js b/test/sourcemaps/names/_config.js index e69fbac..14f081a 100644 --- a/test/sourcemaps/names/_config.js +++ b/test/sourcemaps/names/_config.js @@ -9,23 +9,19 @@ module.exports = { moduleName: 'myModule' }, test: function ( code, map ) { - var smc = new SourceMapConsumer( map ); - var generatedLoc, originalLoc; - var match = /Object\.create\( ([^\.]+)\.prototype/.exec( code ); - if ( !match ) throw new Error( 'errr...' ); var deconflictedName = match[1]; if ( deconflictedName === 'Foo' ) throw new Error( 'Need to update this test!' ); - var pattern = new RegExp( deconflictedName, 'g' ); + var smc = new SourceMapConsumer( map ); var index = code.indexOf( deconflictedName ); - generatedLoc = getLocation( code, index ); - originalLoc = smc.originalPositionFor( generatedLoc ); + var generatedLoc = getLocation( code, index ); + var originalLoc = smc.originalPositionFor( generatedLoc ); assert.equal( originalLoc.name, 'Foo' ); - var index = code.indexOf( deconflictedName, index + 1 ); + index = code.indexOf( deconflictedName, index + 1 ); generatedLoc = getLocation( code, index ); originalLoc = smc.originalPositionFor( generatedLoc ); assert.equal( originalLoc.name, 'Bar' );