Skip to content

Commit a567be8

Browse files
authored
Merge pull request #293 from ethereum/simplify-skip
Simplify reasons for skipping tests
2 parents 54cfd48 + 0d5cf63 commit a567be8

File tree

1 file changed

+15
-44
lines changed

1 file changed

+15
-44
lines changed

test/package.js

Lines changed: 15 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ tape('Compilation', function (t) {
5353
st.end();
5454
return;
5555
}
56+
5657
var output = solc.compile('contract x { function g() public {} }');
5758
st.ok('contracts' in output);
5859
var bytecode = getBytecode(output, '', 'x');
@@ -67,6 +68,7 @@ tape('Compilation', function (t) {
6768
st.end();
6869
return;
6970
}
71+
7072
var output = JSON.parse(solc.lowlevel.compileSingle('contract x { function g() public {} }'));
7173
st.ok('contracts' in output);
7274
var bytecode = getBytecode(output, '', 'x');
@@ -81,6 +83,7 @@ tape('Compilation', function (t) {
8183
st.end();
8284
return;
8385
}
86+
8487
var output = solc.compile('contract x { this is an invalid contract }');
8588
if (semver.lt(solc.semver(), '0.1.4')) {
8689
st.ok(output.error.indexOf('Parser error: Expected identifier') !== -1);
@@ -108,12 +111,7 @@ tape('Compilation', function (t) {
108111
});
109112

110113
t.test('multiple files can be compiled', function (st) {
111-
if (semver.lt(solc.semver(), '0.1.6')) {
112-
st.skip('Not supported by solc <0.1.6');
113-
st.end();
114-
return;
115-
}
116-
114+
// <0.1.6 doesn't have this
117115
if (!solc.features.multipleInputs) {
118116
st.skip('Not supported by solc');
119117
st.end();
@@ -156,12 +154,7 @@ tape('Compilation', function (t) {
156154
});
157155

158156
t.test('lazy-loading callback works', function (st) {
159-
if (semver.lt(solc.semver(), '0.2.1')) {
160-
st.skip('Not supported by solc <0.2.1');
161-
st.end();
162-
return;
163-
}
164-
157+
// <0.2.1 doesn't have this
165158
if (!solc.features.importCallback) {
166159
st.skip('Not supported by solc');
167160
st.end();
@@ -216,12 +209,7 @@ tape('Compilation', function (t) {
216209
});
217210

218211
t.test('lazy-loading callback works (with file not found)', function (st) {
219-
if (semver.lt(solc.semver(), '0.2.1')) {
220-
st.skip('Not supported by solc <0.2.1');
221-
st.end();
222-
return;
223-
}
224-
212+
// <0.2.1 doesn't have this
225213
if (!solc.features.importCallback) {
226214
st.skip('Not supported by solc');
227215
st.end();
@@ -251,12 +239,7 @@ tape('Compilation', function (t) {
251239
});
252240

253241
t.test('lazy-loading callback works (with exception)', function (st) {
254-
if (semver.lt(solc.semver(), '0.2.1')) {
255-
st.skip('Not supported by solc <0.2.1');
256-
st.end();
257-
return;
258-
}
259-
242+
// <0.2.1 doesn't have this
260243
if (!solc.features.importCallback) {
261244
st.skip('Not supported by solc');
262245
st.end();
@@ -276,12 +259,7 @@ tape('Compilation', function (t) {
276259
});
277260

278261
t.test('lazy-loading callback fails properly (with invalid callback)', function (st) {
279-
if (semver.lt(solc.semver(), '0.2.1')) {
280-
st.skip('Not supported by solc <0.2.1');
281-
st.end();
282-
return;
283-
}
284-
262+
// <0.2.1 doesn't have this
285263
if (!solc.features.importCallback) {
286264
st.skip('Not supported by solc');
287265
st.end();
@@ -298,12 +276,7 @@ tape('Compilation', function (t) {
298276
});
299277

300278
t.test('file import without lazy-loading callback fails properly', function (st) {
301-
if (semver.lt(solc.semver(), '0.2.1')) {
302-
st.skip('Not supported by solc <0.2.1');
303-
st.end();
304-
return;
305-
}
306-
279+
// <0.2.1 doesn't have this
307280
if (!solc.features.importCallback) {
308281
st.skip('Not supported by solc');
309282
st.end();
@@ -450,10 +423,9 @@ tape('Compilation', function (t) {
450423
});
451424

452425
t.test('compiling standard JSON', function (st) {
453-
// Example needs support for compileJSONMulti
454-
// FIXME: add test for wrapper without multiple files
455-
if (semver.lt(solc.semver(), '0.1.6')) {
456-
st.skip('Not supported by solc <0.1.6');
426+
// <0.1.6 doesn't have this
427+
if (!solc.features.multipleInputs) {
428+
st.skip('Not supported by solc');
457429
st.end();
458430
return;
459431
}
@@ -488,10 +460,9 @@ tape('Compilation', function (t) {
488460
});
489461

490462
t.test('compiling standard JSON (using libraries)', function (st) {
491-
// Example needs support for compileJSONMulti
492-
// FIXME: add test for wrapper without multiple files
493-
if (semver.lt(solc.semver(), '0.1.6')) {
494-
st.skip('Not supported by solc <0.1.6');
463+
// <0.1.6 doesn't have this
464+
if (!solc.features.multipleInputs) {
465+
st.skip('Not supported by solc');
495466
st.end();
496467
return;
497468
}

0 commit comments

Comments
 (0)