remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
remix-project/test/sourceMappingDecoder.js

32 lines
967 B

'use strict'
var tape = require('tape')
var SourceMappingDecoder = require('../babelify-src/util/sourceMappingDecoder')
var compiler = require('solc')
tape('SourceMappingDecoder', function (t) {
t.test('SourceMappingDecoder.findNodeAtInstructionIndex', function (st) {
var output = compiler.compile(contracts, 0)
var sourceMappingDecoder = new SourceMappingDecoder()
var node = sourceMappingDecoder.findNodeAtInstructionIndex('FunctionDefinition', 2, output.contracts['test'].srcmapRuntime, output.sources[''])
st.equal(node, null)
node = sourceMappingDecoder.findNodeAtInstructionIndex('FunctionDefinition', 37, output.contracts['test'].srcmapRuntime, output.sources[''])
st.notEqual(node, null)
if (node) {
st.equal(node.attributes.name, 'f1')
}
st.end()
})
})
var contracts = `contract test {
function f1() returns (uint) {
uint t = 4;
return t;
}
function f2() {
}
}
`