Skip to content

Commit 4ab296f

Browse files
committed
Add tests for compiling single file with compileStandard
1 parent 83563ff commit 4ab296f

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

test/compiler.js

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,40 @@ function runTests (solc, versionText) {
421421
st.end();
422422
});
423423

424-
t.test('compiling standard JSON', function (st) {
424+
t.test('compiling standard JSON (single file)', function (st) {
425+
var input = {
426+
'language': 'Solidity',
427+
'settings': {
428+
'outputSelection': {
429+
'*': {
430+
'*': [ 'evm.bytecode', 'evm.gasEstimates' ]
431+
}
432+
}
433+
},
434+
'sources': {
435+
'c.sol': {
436+
'content': 'contract C { function g() public { } function h() internal {} }'
437+
}
438+
}
439+
};
440+
441+
var output = JSON.parse(solc.compile(JSON.stringify(input)));
442+
st.ok(expectNoError(output));
443+
var C = getBytecodeStandard(output, 'c.sol', 'C');
444+
st.ok(typeof C === 'string');
445+
st.ok(C.length > 0);
446+
var CGas = getGasEstimate(output, 'c.sol', 'C');
447+
st.ok(typeof CGas === 'object');
448+
st.ok(typeof CGas['creation'] === 'object');
449+
st.ok(typeof CGas['creation']['codeDepositCost'] === 'string');
450+
st.ok(typeof CGas['external'] === 'object');
451+
st.ok(typeof CGas['external']['g()'] === 'string');
452+
st.ok(typeof CGas['internal'] === 'object');
453+
st.ok(typeof CGas['internal']['h()'] === 'string');
454+
st.end();
455+
});
456+
457+
t.test('compiling standard JSON (multiple files)', function (st) {
425458
// <0.1.6 doesn't have this
426459
if (!solc.features.multipleInputs) {
427460
st.skip('Not supported by solc');

0 commit comments

Comments
 (0)