Skip to content

Commit 316d88a

Browse files
authored
Merge pull request #185 from ethereum/test-safer
Add more assertions to tests
2 parents cfcd9c5 + 4922b84 commit 316d88a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/package.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,12 @@ tape('Compilation', function (t) {
167167
st.end();
168168
});
169169
t.test('invalid source code fails properly with standard JSON', function (st) {
170+
if (!solc.supportsStandard) {
171+
st.skip('Not supported by solc');
172+
st.end();
173+
return;
174+
}
175+
170176
var input = {
171177
'language': 'Solidity',
172178
'settings': {
@@ -293,6 +299,9 @@ tape('Linking', function (t) {
293299
'cont.sol': 'import "lib.sol"; contract x { function g() { L.f(); } }'
294300
};
295301
var output = solc.compile({sources: input});
302+
st.ok('contracts' in output);
303+
st.ok('cont.sol:x' in output.contracts);
304+
st.ok('bytecode' in output.contracts['cont.sol:x']);
296305
var bytecode = solc.linkBytecode(output.contracts['cont.sol:x'].bytecode, { 'lib.sol:L': '0x123456' });
297306
st.ok(bytecode.indexOf('_') < 0);
298307
st.end();
@@ -304,6 +313,9 @@ tape('Linking', function (t) {
304313
'cont.sol': 'import "lib.sol"; contract x { function g() { L.f(); } }'
305314
};
306315
var output = solc.compile({sources: input});
316+
st.ok('contracts' in output);
317+
st.ok('cont.sol:x' in output.contracts);
318+
st.ok('bytecode' in output.contracts['cont.sol:x']);
307319
var bytecode = solc.linkBytecode(output.contracts['cont.sol:x'].bytecode, { });
308320
st.ok(bytecode.indexOf('_') >= 0);
309321
st.end();
@@ -315,6 +327,9 @@ tape('Linking', function (t) {
315327
'cont.sol': 'import "lib.sol"; contract x { function g() { L.f(); } }'
316328
};
317329
var output = solc.compile({sources: input});
330+
st.ok('contracts' in output);
331+
st.ok('cont.sol:x' in output.contracts);
332+
st.ok('bytecode' in output.contracts['cont.sol:x']);
318333
st.throws(function () {
319334
solc.linkBytecode(output.contracts['cont.sol:x'].bytecode, { 'lib.sol:L': '' });
320335
});
@@ -327,6 +342,9 @@ tape('Linking', function (t) {
327342
'cont.sol': 'import "lib.sol"; contract x { function g() { L1234567890123456789012345678901234567890.f(); } }'
328343
};
329344
var output = solc.compile({sources: input});
345+
st.ok('contracts' in output);
346+
st.ok('cont.sol:x' in output.contracts);
347+
st.ok('bytecode' in output.contracts['cont.sol:x']);
330348
var bytecode = solc.linkBytecode(output.contracts['cont.sol:x'].bytecode, { 'lib.sol:L1234567890123456789012345678901234567890': '0x123456' });
331349
st.ok(bytecode.indexOf('_') < 0);
332350
st.end();

0 commit comments

Comments
 (0)