var path = require( 'path' );
var assert = require( 'assert' );
var getLocation = require( '../../utils/getLocation' );
var SourceMapConsumer = require( 'source-map' ).SourceMapConsumer;

module.exports = {
	description: 'names are recovered (https://github.com/rollup/rollup/issues/101)',
	options: {
		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 index = code.indexOf( deconflictedName );
		generatedLoc = getLocation( code, index );
		originalLoc = smc.originalPositionFor( generatedLoc );
		assert.equal( originalLoc.name, 'Foo' );

		var index = code.indexOf( deconflictedName, index + 1 );
		generatedLoc = getLocation( code, index );
		originalLoc = smc.originalPositionFor( generatedLoc );
		assert.equal( originalLoc.name, 'Bar' );
	}
};

@@ -360,84 +360,8 @@
 ) %7B%0A
-%09%09var smc = new SourceMapConsumer( map );%0A%09%09var generatedLoc, originalLoc;%0A%0A
 %09%09va
@@ -426,54 +426,8 @@
 e );
-%0A%09%09if ( !match ) throw new Error( 'errr...' );
 %0A%0A%09%09
@@ -554,51 +554,40 @@
 var 
-pattern = new RegExp( deconflictedName, 'g'
+smc = new SourceMapConsumer( map
  );%0A
@@ -633,24 +633,28 @@
 edName );%0A%09%09
+var 
 generatedLoc
@@ -678,32 +678,36 @@
 ode, index );%0A%09%09
+var 
 originalLoc = sm
@@ -787,28 +787,24 @@
 'Foo' );%0A%0A%09%09
-var 
 index = code

tidy up test