aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-cov/test
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-04-10 04:23:25 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-04-12 18:52:48 +0800
commiteb89926cee2c50ef657b3c033b5637f527d73c6a (patch)
tree6a4ece7902c860bfa48ac53033baf86ba25683d0 /packages/sol-cov/test
parent7923ff4ac6d03adf3787a2a3e6f7deb6aa38fc73 (diff)
downloaddexon-0x-contracts-eb89926cee2c50ef657b3c033b5637f527d73c6a.tar.gz
dexon-0x-contracts-eb89926cee2c50ef657b3c033b5637f527d73c6a.tar.zst
dexon-0x-contracts-eb89926cee2c50ef657b3c033b5637f527d73c6a.zip
Implement the resolver
Diffstat (limited to 'packages/sol-cov/test')
-rw-r--r--packages/sol-cov/test/collect_contracts_data_test.ts1
-rw-r--r--packages/sol-cov/test/collect_coverage_entries_test.ts4
-rw-r--r--packages/sol-cov/test/fixtures/artifacts/SimpleStorage.json64
-rw-r--r--packages/sol-cov/test/fixtures/artifacts/Simplest.json20
-rw-r--r--packages/sol-cov/test/fixtures/contracts/SimpleStorage.sol2
5 files changed, 4 insertions, 87 deletions
diff --git a/packages/sol-cov/test/collect_contracts_data_test.ts b/packages/sol-cov/test/collect_contracts_data_test.ts
index e793085e3..943a4a878 100644
--- a/packages/sol-cov/test/collect_contracts_data_test.ts
+++ b/packages/sol-cov/test/collect_contracts_data_test.ts
@@ -16,7 +16,6 @@ describe('Collect contracts data', () => {
const contractsData = collectContractsData(artifactsPath, sourcesPath, networkId);
_.forEach(contractsData, contractData => {
expect(contractData).to.have.keys([
- 'baseName',
'sourceCodes',
'sources',
'sourceMap',
diff --git a/packages/sol-cov/test/collect_coverage_entries_test.ts b/packages/sol-cov/test/collect_coverage_entries_test.ts
index c7bc45bbf..c7b9d44b1 100644
--- a/packages/sol-cov/test/collect_coverage_entries_test.ts
+++ b/packages/sol-cov/test/collect_coverage_entries_test.ts
@@ -39,13 +39,13 @@ describe('Collect coverage entries', () => {
const coverageEntries = collectCoverageEntries(simpleStorageContract);
const fnIds = _.keys(coverageEntries.fnMap);
expect(coverageEntries.fnMap[fnIds[0]].name).to.be.equal('set');
- expect(coverageEntries.fnMap[fnIds[0]].line).to.be.equal(3);
+ expect(coverageEntries.fnMap[fnIds[0]].line).to.be.equal(5);
const setFunction = `function set(uint x) {
storedData = x;
}`;
expect(getRange(simpleStorageContract, coverageEntries.fnMap[fnIds[0]].loc)).to.be.equal(setFunction);
expect(coverageEntries.fnMap[fnIds[1]].name).to.be.equal('get');
- expect(coverageEntries.fnMap[fnIds[1]].line).to.be.equal(6);
+ expect(coverageEntries.fnMap[fnIds[1]].line).to.be.equal(8);
const getFunction = `function get() constant returns (uint retVal) {
return storedData;
}`;
diff --git a/packages/sol-cov/test/fixtures/artifacts/SimpleStorage.json b/packages/sol-cov/test/fixtures/artifacts/SimpleStorage.json
deleted file mode 100644
index 416170ef2..000000000
--- a/packages/sol-cov/test/fixtures/artifacts/SimpleStorage.json
+++ /dev/null
@@ -1,64 +0,0 @@
-{
- "contract_name": "SimpleStorage",
- "networks": {
- "50": {
- "solc_version": "0.4.21",
- "keccak256": "0x18dc5b5a0e813c17e49936d2f2f7c07c51f050c09ba5e7206f17c855f23f4b6a",
- "source_tree_hash": "0x18dc5b5a0e813c17e49936d2f2f7c07c51f050c09ba5e7206f17c855f23f4b6a",
- "optimizer_enabled": 0,
- "abi": [
- {
- "constant": true,
- "inputs": [],
- "name": "storedData",
- "outputs": [
- {
- "name": "",
- "type": "uint256"
- }
- ],
- "payable": false,
- "stateMutability": "view",
- "type": "function"
- },
- {
- "constant": false,
- "inputs": [
- {
- "name": "x",
- "type": "uint256"
- }
- ],
- "name": "set",
- "outputs": [],
- "payable": false,
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "constant": true,
- "inputs": [],
- "name": "get",
- "outputs": [
- {
- "name": "retVal",
- "type": "uint256"
- }
- ],
- "payable": false,
- "stateMutability": "view",
- "type": "function"
- }
- ],
- "bytecode":
- "0x6060604052341561000f57600080fd5b6101098061001e6000396000f3006060604052600436106053576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632a1afcd914605857806360fe47b114607e5780636d4ce63c14609e575b600080fd5b3415606257600080fd5b606860c4565b6040518082815260200191505060405180910390f35b3415608857600080fd5b609c600480803590602001909190505060ca565b005b341560a857600080fd5b60ae60d4565b6040518082815260200191505060405180910390f35b60005481565b8060008190555050565b600080549050905600a165627a7a723058207f743855fd0c71699620424a21a257cd197ed05032d6768eb9b874e4898f44c60029",
- "runtime_bytecode":
- "0x6060604052600436106053576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632a1afcd914605857806360fe47b114607e5780636d4ce63c14609e575b600080fd5b3415606257600080fd5b606860c4565b6040518082815260200191505060405180910390f35b3415608857600080fd5b609c600480803590602001909190505060ca565b005b341560a857600080fd5b60ae60d4565b6040518082815260200191505060405180910390f35b60005481565b8060008190555050565b600080549050905600a165627a7a723058207f743855fd0c71699620424a21a257cd197ed05032d6768eb9b874e4898f44c60029",
- "updated_at": 1521118350895,
- "source_map": "26:196:0:-;;;;;;;;;;;;;;;;;",
- "source_map_runtime":
- "26:196:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;55:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;83:52;;;;;;;;;;;;;;;;;;;;;;;;;;140:80;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;55:22;;;;:::o;83:52::-;127:1;114:10;:14;;;;83:52;:::o;140:80::-;173:11;203:10;;196:17;;140:80;:::o",
- "sources": ["SimpleStorage.sol"]
- }
- }
-}
diff --git a/packages/sol-cov/test/fixtures/artifacts/Simplest.json b/packages/sol-cov/test/fixtures/artifacts/Simplest.json
deleted file mode 100644
index 8de60e481..000000000
--- a/packages/sol-cov/test/fixtures/artifacts/Simplest.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "contract_name": "Simplest",
- "networks": {
- "50": {
- "solc_version": "0.4.21",
- "keccak256": "0x8e7d62e19c7c7b8bf9a4a43749e111605950cc877574fb9640a1a07d1c3749f9",
- "source_tree_hash": "0x8e7d62e19c7c7b8bf9a4a43749e111605950cc877574fb9640a1a07d1c3749f9",
- "optimizer_enabled": 0,
- "abi": [],
- "bytecode":
- "0x60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a7230582097cfe05b4d18d6ffb3a8d8fab0570cf09640d3131b9677ddb9be4e9fbcb65f010029",
- "runtime_bytecode":
- "0x6060604052600080fd00a165627a7a7230582097cfe05b4d18d6ffb3a8d8fab0570cf09640d3131b9677ddb9be4e9fbcb65f010029",
- "updated_at": 1521118525393,
- "source_map": "26:21:0:-;;;;;;;;;;;;;;;;;",
- "source_map_runtime": "26:21:0:-;;;;;",
- "sources": ["Simplest.sol"]
- }
- }
-}
diff --git a/packages/sol-cov/test/fixtures/contracts/SimpleStorage.sol b/packages/sol-cov/test/fixtures/contracts/SimpleStorage.sol
index 178a52318..e4b4ac246 100644
--- a/packages/sol-cov/test/fixtures/contracts/SimpleStorage.sol
+++ b/packages/sol-cov/test/fixtures/contracts/SimpleStorage.sol
@@ -1,3 +1,5 @@
+pragma solidity ^0.4.21;
+
contract SimpleStorage {
uint public storedData;
function set(uint x) {