aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-cov/test
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-06-22 16:39:07 +0800
committerFabio Berger <me@fabioberger.com>2018-06-22 16:39:07 +0800
commit3ce295a2af17feef6cd4e3140196501805493719 (patch)
tree964df912ce86d98a211f81f3d6159d797a37c3b3 /packages/sol-cov/test
parenta30107ab867964d371b2d5fc6791c7b1963f1c7b (diff)
parent0515c6acded983bba05320895ea2c2891f37055c (diff)
downloaddexon-sol-tools-3ce295a2af17feef6cd4e3140196501805493719.tar.gz
dexon-sol-tools-3ce295a2af17feef6cd4e3140196501805493719.tar.zst
dexon-sol-tools-3ce295a2af17feef6cd4e3140196501805493719.zip
Merge branch 'v2-prototype' into refactor/check-revert-reasons
* v2-prototype: (40 commits) Use make-promises-safe as a preloader instead of manually importing Updated compiler runs to be 1,000,000 Add event to setSignatureValidatorApproval, rename signer => signerAddress accross all contracts Add senderAddress to Fill and Cancel logs, add comments to events and types Fix Island component Add missing image assets for Chris and Mel Fix some bugs in sol-cov Remove unreachable PreSigned check Fix linting Buttons look hella disabled now Remove border radius, fix width issue for unlock step Add Chris and Mel to about page fix linter issues only call getLocationByOffset if source if defined Set settleOrder and settleMatchedOrders to private Prevent prettier issue Support mobile friendly onboarding flows Removed MixinSettlement. Moved `settleOrder` into `MixinExchangeCore` and `settleMatchedOrders` into `MixinMatchOrders` Migrations after rebasing Linter ...
Diffstat (limited to 'packages/sol-cov/test')
-rw-r--r--packages/sol-cov/test/collect_coverage_entries_test.ts18
-rw-r--r--packages/sol-cov/test/instructions_test.ts1
-rw-r--r--packages/sol-cov/test/sol_compiler_artifact_adapter_test.ts1
-rw-r--r--packages/sol-cov/test/source_maps_test.ts1
-rw-r--r--packages/sol-cov/test/utils_test.ts1
5 files changed, 5 insertions, 17 deletions
diff --git a/packages/sol-cov/test/collect_coverage_entries_test.ts b/packages/sol-cov/test/collect_coverage_entries_test.ts
index a03be19cd..f88f3b3c3 100644
--- a/packages/sol-cov/test/collect_coverage_entries_test.ts
+++ b/packages/sol-cov/test/collect_coverage_entries_test.ts
@@ -1,22 +1,14 @@
import * as chai from 'chai';
import * as fs from 'fs';
import * as _ from 'lodash';
-import 'make-promises-safe';
import 'mocha';
import * as path from 'path';
import { collectCoverageEntries } from '../src/collect_coverage_entries';
-import { SingleFileSourceRange } from '../src/types';
+import { utils } from '../src/utils';
const expect = chai.expect;
-const getRange = (sourceCode: string, range: SingleFileSourceRange) => {
- const lines = sourceCode.split('\n').slice(range.start.line - 1, range.end.line);
- lines[lines.length - 1] = lines[lines.length - 1].slice(0, range.end.column);
- lines[0] = lines[0].slice(range.start.column);
- return lines.join('\n');
-};
-
describe('Collect coverage entries', () => {
describe('#collectCoverageEntries', () => {
it('correctly collects coverage entries for Simplest contract', () => {
@@ -45,20 +37,20 @@ describe('Collect coverage entries', () => {
const setFunction = `function set(uint x) {
storedData = x;
}`;
- expect(getRange(simpleStorageContract, coverageEntries.fnMap[fnIds[0]].loc)).to.be.equal(setFunction);
+ expect(utils.getRange(simpleStorageContract, coverageEntries.fnMap[fnIds[0]].loc)).to.be.equal(setFunction);
expect(coverageEntries.fnMap[fnIds[1]].name).to.be.equal('get');
// tslint:disable-next-line:custom-no-magic-numbers
expect(coverageEntries.fnMap[fnIds[1]].line).to.be.equal(8);
const getFunction = `function get() constant returns (uint retVal) {
return storedData;
}`;
- expect(getRange(simpleStorageContract, coverageEntries.fnMap[fnIds[1]].loc)).to.be.equal(getFunction);
+ expect(utils.getRange(simpleStorageContract, coverageEntries.fnMap[fnIds[1]].loc)).to.be.equal(getFunction);
expect(coverageEntries.branchMap).to.be.deep.equal({});
const statementIds = _.keys(coverageEntries.statementMap);
- expect(getRange(simpleStorageContract, coverageEntries.statementMap[statementIds[1]])).to.be.equal(
+ expect(utils.getRange(simpleStorageContract, coverageEntries.statementMap[statementIds[1]])).to.be.equal(
'storedData = x',
);
- expect(getRange(simpleStorageContract, coverageEntries.statementMap[statementIds[3]])).to.be.equal(
+ expect(utils.getRange(simpleStorageContract, coverageEntries.statementMap[statementIds[3]])).to.be.equal(
'return storedData;',
);
expect(coverageEntries.modifiersStatementIds).to.be.deep.equal([]);
diff --git a/packages/sol-cov/test/instructions_test.ts b/packages/sol-cov/test/instructions_test.ts
index 02f30a5ca..058053cf9 100644
--- a/packages/sol-cov/test/instructions_test.ts
+++ b/packages/sol-cov/test/instructions_test.ts
@@ -1,5 +1,4 @@
import * as chai from 'chai';
-import 'make-promises-safe';
import 'mocha';
import { constants } from '../src/constants';
diff --git a/packages/sol-cov/test/sol_compiler_artifact_adapter_test.ts b/packages/sol-cov/test/sol_compiler_artifact_adapter_test.ts
index 0ebad669b..9c58d2cef 100644
--- a/packages/sol-cov/test/sol_compiler_artifact_adapter_test.ts
+++ b/packages/sol-cov/test/sol_compiler_artifact_adapter_test.ts
@@ -1,6 +1,5 @@
import * as chai from 'chai';
import * as _ from 'lodash';
-import 'make-promises-safe';
import 'mocha';
import * as path from 'path';
diff --git a/packages/sol-cov/test/source_maps_test.ts b/packages/sol-cov/test/source_maps_test.ts
index 071f5a057..5820bedd7 100644
--- a/packages/sol-cov/test/source_maps_test.ts
+++ b/packages/sol-cov/test/source_maps_test.ts
@@ -1,7 +1,6 @@
import * as chai from 'chai';
import * as fs from 'fs';
import * as _ from 'lodash';
-import 'make-promises-safe';
import 'mocha';
import * as path from 'path';
diff --git a/packages/sol-cov/test/utils_test.ts b/packages/sol-cov/test/utils_test.ts
index 9a0227773..6fc8fcfe1 100644
--- a/packages/sol-cov/test/utils_test.ts
+++ b/packages/sol-cov/test/utils_test.ts
@@ -1,6 +1,5 @@
import * as chai from 'chai';
import * as dirtyChai from 'dirty-chai';
-import 'make-promises-safe';
import 'mocha';
import { utils } from '../src/utils';