Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workarounds for running tests against wasm rebuilds of old compilers. #441

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions test/cli.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const tape = require('tape');
const semver = require('semver');
const spawn = require('tape-spawn');
const pkg = require('../package.json');

Expand Down Expand Up @@ -44,7 +45,11 @@ tape('CLI', function (t) {

t.test('incorrect source source', function (st) {
var spt = spawn(st, './solcjs --bin test/resources/fixtureIncorrectSource.sol');
spt.stderr.match(/^test\/resources\/fixtureIncorrectSource.sol:1:1: SyntaxError: Invalid pragma "contract"/);
if (semver.lt(pkg.version, '0.4.16')) {
spt.stderr.match(/^test\/resources\/fixtureIncorrectSource.sol:1:1:.* Unknown pragma "contract"/);
} else {
spt.stderr.match(/^test\/resources\/fixtureIncorrectSource.sol:1:1: SyntaxError: Invalid pragma "contract"/);
}
spt.end();
});

Expand All @@ -63,6 +68,8 @@ tape('CLI', function (t) {
});

t.test('standard json', function (st) {
var pure = semver.lt(pkg.version, '0.4.17') ? '' : 'pure';
var pragma = semver.lt(pkg.version, '0.4.0') ? '' : 'pragma solidity >=0.4.0; ';
var input = {
'language': 'Solidity',
'settings': {
Expand All @@ -74,7 +81,7 @@ tape('CLI', function (t) {
},
'sources': {
'Contract.sol': {
'content': 'pragma solidity >=0.5.0; contract Contract { function f() pure public {} }'
'content': pragma + 'contract Contract { function f() ' + pure + ' public {} }'
}
}
};
Expand All @@ -85,7 +92,10 @@ tape('CLI', function (t) {
spt.stdin.on('finish', function () {
spt.stderr.empty();
spt.stdout.match(/Contract.sol/);
spt.stdout.match(/userdoc/);
if (semver.gt(pkg.version, '0.4.6')) {
// TODO: is it legit to skip this for <=0.4.6?
spt.stdout.match(/userdoc/);
}
spt.succeeds();
spt.end();
});
Expand Down