aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-04-13 19:27:52 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-04-13 19:27:52 +0800
commite5cf41b3134d6cd5fdda995aa81ec23e51bb5145 (patch)
tree73d324f54d680285be856c5d42b5ea346a40cc81 /packages
parent74012ad584ba93043e60f143d88619f580ceed08 (diff)
downloaddexon-sol-tools-e5cf41b3134d6cd5fdda995aa81ec23e51bb5145.tar
dexon-sol-tools-e5cf41b3134d6cd5fdda995aa81ec23e51bb5145.tar.gz
dexon-sol-tools-e5cf41b3134d6cd5fdda995aa81ec23e51bb5145.tar.bz2
dexon-sol-tools-e5cf41b3134d6cd5fdda995aa81ec23e51bb5145.tar.lz
dexon-sol-tools-e5cf41b3134d6cd5fdda995aa81ec23e51bb5145.tar.xz
dexon-sol-tools-e5cf41b3134d6cd5fdda995aa81ec23e51bb5145.tar.zst
dexon-sol-tools-e5cf41b3134d6cd5fdda995aa81ec23e51bb5145.zip
Uncomment tests
Diffstat (limited to 'packages')
-rw-r--r--packages/deployer/src/compiler.ts9
-rw-r--r--packages/deployer/test/compiler_utils_test.ts6
2 files changed, 6 insertions, 9 deletions
diff --git a/packages/deployer/src/compiler.ts b/packages/deployer/src/compiler.ts
index 0a99e5659..dfbe469a7 100644
--- a/packages/deployer/src/compiler.ts
+++ b/packages/deployer/src/compiler.ts
@@ -102,7 +102,7 @@ export class Compiler {
private async _compileContractAsync(contractName: string): Promise<void> {
const contractSource = this._resolver.resolve(contractName);
const currentArtifactIfExists = await getContractArtifactIfExistsAsync(this._artifactsDir, contractName);
- const sourceTreeHash = `0x${this._getSourceTreeHash(contractSource.path).toString('hex')}`;
+ const sourceTreeHashHex = `0x${this._getSourceTreeHash(contractSource.path).toString('hex')}`;
let shouldCompile = false;
if (_.isUndefined(currentArtifactIfExists)) {
@@ -111,7 +111,7 @@ export class Compiler {
const currentArtifact = currentArtifactIfExists as ContractArtifact;
shouldCompile =
currentArtifact.networks[this._networkId].optimizer_enabled !== this._optimizerEnabled ||
- currentArtifact.networks[this._networkId].source_tree_hash !== sourceTreeHash;
+ currentArtifact.networks[this._networkId].source_tree_hash !== sourceTreeHashHex;
}
if (!shouldCompile) {
return;
@@ -138,9 +138,6 @@ export class Compiler {
const solcInstance = solc.setupMethods(requireFromString(solcjs, compilerBinFilename));
logUtils.log(`Compiling ${contractName} with Solidity v${solcVersion}...`);
- if (_.isUndefined(contractSource)) {
- throw new Error(`Failed to resolve ${contractName}`);
- }
const source = contractSource.source;
const absoluteFilePath = contractSource.path;
const standardInput: solc.StandardInput = {
@@ -210,7 +207,7 @@ export class Compiler {
const updated_at = Date.now();
const contractNetworkData: ContractNetworkData = {
solc_version: solcVersion,
- source_tree_hash: sourceTreeHash,
+ source_tree_hash: sourceTreeHashHex,
optimizer_enabled: this._optimizerEnabled,
abi,
bytecode,
diff --git a/packages/deployer/test/compiler_utils_test.ts b/packages/deployer/test/compiler_utils_test.ts
index 36e7b321c..7e7ae1200 100644
--- a/packages/deployer/test/compiler_utils_test.ts
+++ b/packages/deployer/test/compiler_utils_test.ts
@@ -50,7 +50,7 @@ describe('Compiler utils', () => {
const exchangeSource = await fsWrapper.readFileAsync(`${__dirname}/fixtures/contracts/Exchange.sol`, {
encoding: 'utf8',
});
- // expect(parseDependencies(exchangeSource)).to.be.deep.equal(['ERC20', 'TokenTransferProxy', 'SafeMath']);
+ expect(parseDependencies(exchangeSource)).to.be.deep.equal(['ERC20', 'TokenTransferProxy', 'SafeMath']);
});
it('correctly parses TokenTransferProxy dependencies', async () => {
const exchangeSource = await fsWrapper.readFileAsync(
@@ -59,12 +59,12 @@ describe('Compiler utils', () => {
encoding: 'utf8',
},
);
- // expect(parseDependencies(exchangeSource)).to.be.deep.equal(['Ownable', 'ERC20']);
+ expect(parseDependencies(exchangeSource)).to.be.deep.equal(['Ownable', 'ERC20']);
});
// TODO: For now that doesn't work. This will work after we switch to a grammar-based parser
it.skip('correctly parses commented out dependencies', async () => {
const contractWithCommentedOutDependencies = `// import "./TokenTransferProxy.sol";`;
- // expect(parseDependencies(contractWithCommentedOutDependencies)).to.be.deep.equal([]);
+ expect(parseDependencies(contractWithCommentedOutDependencies)).to.be.deep.equal([]);
});
});
});