Skip to content

Commit b17371c

Browse files
committed
Add test case for forced warnings (only in >=0.4.0)
1 parent 333b4d6 commit b17371c

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/compiler.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,35 @@ function runTests (solc, versionText) {
676676
st.end();
677677
});
678678

679+
t.test('compiling standard JSON (with warning >=0.4.0)', function (st) {
680+
// In 0.4.0 "pragma solidity" was added. Not including it is a warning.
681+
if (semver.lt(solc.semver(), '0.4.0')) {
682+
st.skip('Not supported by solc');
683+
st.end();
684+
return;
685+
}
686+
687+
var input = {
688+
'language': 'Solidity',
689+
'settings': {
690+
'outputSelection': {
691+
'*': {
692+
'*': [ 'evm.bytecode' ]
693+
}
694+
}
695+
},
696+
'sources': {
697+
'cont.sol': {
698+
'content': 'contract C { function f() public { } }'
699+
}
700+
}
701+
};
702+
703+
var output = JSON.parse(solc.compile(JSON.stringify(input)));
704+
st.ok(expectError(output, 'Warning', 'Source file does not specify required compiler version!'));
705+
st.end();
706+
});
707+
679708
t.test('compiling standard JSON (using libraries) (using lowlevel API)', function (st) {
680709
// 0.4.0 has a bug with libraries
681710
if (semver.eq(solc.semver(), '0.4.0')) {

0 commit comments

Comments
 (0)