Skip to content

Commit 4c37589

Browse files
author
Leonardo
authored
Merge pull request #424 from ethereum/non-determinism
Workaround 0.3.x non-determinism bug (this test has been removed in 0.6.x anyway)
2 parents d51374f + 5337b37 commit 4c37589

File tree

1 file changed

+42
-2
lines changed

1 file changed

+42
-2
lines changed

test/compiler.js

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,9 +493,49 @@ function runTests (solc, versionText) {
493493
var L = getBytecodeStandard(output, 'lib.sol', 'L');
494494
st.ok(typeof L === 'string');
495495
st.ok(L.length > 0);
496+
st.end();
497+
});
498+
499+
t.test('compiling standard JSON (with imports + new callback API)', function (st) {
500+
// <0.2.1 doesn't have this
501+
if (!solc.features.importCallback) {
502+
st.skip('Not supported by solc');
503+
st.end();
504+
return;
505+
}
506+
507+
var input = {
508+
'language': 'Solidity',
509+
'settings': {
510+
'outputSelection': {
511+
'*': {
512+
'*': [ 'evm.bytecode' ]
513+
}
514+
}
515+
},
516+
'sources': {
517+
'cont.sol': {
518+
'content': 'import "lib.sol"; contract x { function g() public { L.f(); } }'
519+
}
520+
}
521+
};
522+
523+
function findImports (path) {
524+
if (path === 'lib.sol') {
525+
return { contents: 'library L { function f() public returns (uint) { return 7; } }' };
526+
} else {
527+
return { error: 'File not found' };
528+
}
529+
}
496530

497-
var outputNewApi = JSON.parse(solc.compile(JSON.stringify(input), { import: findImports }));
498-
st.deepEqual(output, outputNewApi);
531+
var output = JSON.parse(solc.compile(JSON.stringify(input), { import: findImports }));
532+
st.ok(expectNoError(output));
533+
var x = getBytecodeStandard(output, 'cont.sol', 'x');
534+
st.ok(typeof x === 'string');
535+
st.ok(x.length > 0);
536+
var L = getBytecodeStandard(output, 'lib.sol', 'L');
537+
st.ok(typeof L === 'string');
538+
st.ok(L.length > 0);
499539
st.end();
500540
});
501541

0 commit comments

Comments
 (0)