Skip to content

Commit 905faa0

Browse files
committed
Support <0.1.6
1 parent 1169877 commit 905faa0

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

test/package.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,25 @@ tape('Compilation', function (t) {
5656
});
5757
t.test('invalid source code fails properly', function (st) {
5858
var output = solc.compile('contract x { this is an invalid contract }');
59+
if (semver.lt(solc.semver(), '0.1.4')) {
60+
st.ok(output.error.indexOf('Parser error: Expected identifier') !== -1);
61+
st.end();
62+
return;
63+
}
5964
st.plan(3);
6065
st.ok('errors' in output);
6166
// Check if the ParserError exists, but allow others too
6267
st.ok(output.errors.length >= 1);
6368
for (var error in output.errors) {
64-
// In early versions it was only displaying "Error: Expected identifier" as opposed to "ParserError"
65-
if (output.errors[error].indexOf('ParserError') !== -1 || output.errors[error].indexOf('Error: Expected identifier') !== -1) {
69+
// Error should be something like:
70+
// ParserError
71+
// Error: Expected identifier
72+
// Parser error: Expected identifier
73+
if (
74+
output.errors[error].indexOf('ParserError') !== -1 ||
75+
output.errors[error].indexOf('Error: Expected identifier') !== -1 ||
76+
output.errors[error].indexOf('Parser error: Expected identifier') !== -1
77+
) {
6678
st.ok(true);
6779
}
6880
}
@@ -309,6 +321,14 @@ tape('Compilation', function (t) {
309321
st.end();
310322
});
311323
t.test('compiling standard JSON (using wrapper)', function (st) {
324+
// Example needs support for compileJSONMulti
325+
// FIXME: add test for wrapper without multiple files
326+
if (semver.lt(solc.semver(), '0.1.6')) {
327+
st.skip('Not supported by solc <0.1.6');
328+
st.end();
329+
return;
330+
}
331+
312332
var input = {
313333
'language': 'Solidity',
314334
'settings': {
@@ -353,6 +373,14 @@ tape('Loading Legacy Versions', function (t) {
353373
});
354374

355375
tape('Linking', function (t) {
376+
// FIXME: all the linking tests require compileJSONMulti support,
377+
// create test cases which have all files in a single source and could run with 0.1.3
378+
if (semver.lt(solc.semver(), '0.1.6')) {
379+
t.skip('Not supported by solc <0.1.6');
380+
t.end();
381+
return;
382+
}
383+
356384
t.test('link properly', function (st) {
357385
var input = {
358386
'lib.sol': 'library L { function f() returns (uint) { return 7; } }',

translate.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,13 @@ function translateJsonCompilerOutput (output) {
5656
var ret = {};
5757

5858
ret['errors'] = [];
59-
translateErrors(ret['errors'], output['errors']);
59+
var errors;
60+
if (output['error']) {
61+
errors = [ output['error'] ];
62+
} else {
63+
errors = output['errors'];
64+
}
65+
translateErrors(ret['errors'], errors);
6066

6167
ret['contracts'] = {};
6268
for (var contract in output['contracts']) {

0 commit comments

Comments
 (0)