Unverified Commit 706d7d7b authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #16 from ethereum/filename

include filename in contract callback
parents b95a20a9 6b098bfe
...@@ -53,7 +53,7 @@ function deployAll (compileResult, web3, callback) { ...@@ -53,7 +53,7 @@ function deployAll (compileResult, web3, callback) {
next(null, contractsToDeploy) next(null, contractsToDeploy)
}, },
function deployContracts (contractsToDeploy, next) { function deployContracts (contractsToDeploy, next) {
var deployRunner = (deployObject, contractObject, contractName, callback) => { var deployRunner = (deployObject, contractObject, contractName, filename, callback) => {
deployObject.estimateGas().then((gasValue) => { deployObject.estimateGas().then((gasValue) => {
deployObject.send({ deployObject.send({
from: accounts[0], from: accounts[0],
...@@ -65,6 +65,7 @@ function deployAll (compileResult, web3, callback) { ...@@ -65,6 +65,7 @@ function deployAll (compileResult, web3, callback) {
compiledObject[contractName].deployedAddress = receipt.contractAddress compiledObject[contractName].deployedAddress = receipt.contractAddress
contracts[contractName] = contractObject contracts[contractName] = contractObject
contracts[contractName].filename = filename
callback(null, { result: { createdAddress: receipt.contractAddress } }) // TODO this will only work with JavaScriptV VM callback(null, { result: { createdAddress: receipt.contractAddress } }) // TODO this will only work with JavaScriptV VM
}).on('error', function (err) { }).on('error', function (err) {
...@@ -80,7 +81,7 @@ function deployAll (compileResult, web3, callback) { ...@@ -80,7 +81,7 @@ function deployAll (compileResult, web3, callback) {
if (error) return nextEach(error) if (error) return nextEach(error)
let contractObject = new web3.eth.Contract(contract.abi) let contractObject = new web3.eth.Contract(contract.abi)
let deployObject = contractObject.deploy({arguments: [], data: '0x' + contractDeployData.dataHex}) let deployObject = contractObject.deploy({arguments: [], data: '0x' + contractDeployData.dataHex})
deployRunner(deployObject, contractObject, contractName, (error) => { nextEach(error) }) deployRunner(deployObject, contractObject, contractName, contract.filename, (error) => { nextEach(error) })
} }
let encodeDataStepCallback = (msg) => { console.dir(msg) } let encodeDataStepCallback = (msg) => { console.dir(msg) }
...@@ -90,7 +91,7 @@ function deployAll (compileResult, web3, callback) { ...@@ -90,7 +91,7 @@ function deployAll (compileResult, web3, callback) {
let code = compiledObject[libData.data.contractName].code let code = compiledObject[libData.data.contractName].code
let libraryObject = new web3.eth.Contract(abi) let libraryObject = new web3.eth.Contract(abi)
let deployObject = libraryObject.deploy({arguments: [], data: '0x' + code}) let deployObject = libraryObject.deploy({arguments: [], data: '0x' + code})
deployRunner(deployObject, libraryObject, libData.data.contractName, callback) deployRunner(deployObject, libraryObject, libData.data.contractName, contract.filename, callback)
} }
let funAbi = null // no need to set the abi for encoding the constructor let funAbi = null // no need to set the abi for encoding the constructor
......
...@@ -38,7 +38,7 @@ function runTest (testName, testObject, testCallback, resultsCallback) { ...@@ -38,7 +38,7 @@ function runTest (testName, testObject, testCallback, resultsCallback) {
let timePassed = 0 let timePassed = 0
let web3 = new Web3() let web3 = new Web3()
testCallback({type: 'contract', value: testName}) testCallback({type: 'contract', value: testName, filename: testObject.filename})
async.eachOfLimit(runList, 1, function (func, index, next) { async.eachOfLimit(runList, 1, function (func, index, next) {
let method = testObject.methods[func.name].apply(testObject.methods[func.name], []) let method = testObject.methods[func.name].apply(testObject.methods[func.name], [])
let startTime = Date.now() let startTime = Date.now()
......
...@@ -52,7 +52,7 @@ describe('testRunner', function () { ...@@ -52,7 +52,7 @@ describe('testRunner', function () {
it('should returns 3 messages', function () { it('should returns 3 messages', function () {
assert.deepEqual(tests, [ assert.deepEqual(tests, [
{ type: 'contract', value: 'MyTest' }, { type: 'contract', value: 'MyTest', filename: 'simple_storage_test.sol' },
{ type: 'testPass', value: 'Initial value should be100', time: 1, context: 'MyTest' }, { type: 'testPass', value: 'Initial value should be100', time: 1, context: 'MyTest' },
{ type: 'testFailure', value: 'Initial value should be200', time: 1, context: 'MyTest', errMsg: 'function returned false' } { type: 'testFailure', value: 'Initial value should be200', time: 1, context: 'MyTest', errMsg: 'function returned false' }
]) ])
...@@ -86,7 +86,7 @@ describe('testRunner', function () { ...@@ -86,7 +86,7 @@ describe('testRunner', function () {
it('should returns 3 messages', function () { it('should returns 3 messages', function () {
assert.deepEqual(tests, [ assert.deepEqual(tests, [
{ type: 'contract', value: 'MyTest' }, { type: 'contract', value: 'MyTest', filename: 'simple_storage_test.sol' },
{ type: 'testPass', value: 'Initial value should be100', time: 1, context: 'MyTest' }, { type: 'testPass', value: 'Initial value should be100', time: 1, context: 'MyTest' },
{ type: 'testPass', value: 'Initial value should be200', time: 1, context: 'MyTest' } { type: 'testPass', value: 'Initial value should be200', time: 1, context: 'MyTest' }
]) ])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment