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

update for travis/macos #229

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ branches:
# Pull request automation is not constrained to this set of branches.
only:
- master
- solcjs-standard
matrix:
fast_finish: true
include:
Expand Down
14 changes: 4 additions & 10 deletions solcjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,12 @@ function abort (msg) {

if (argv['standard-json']) {
if (!solc.supportsStandard) {
abort('Compiler does not support Standard JSON I/O');
abort('Compiler does not support Standard JSON I/O!');
}

var size = fs.fstatSync(process.stdin.fd).size;

if (size <= 0) {
abort('Empty input was read');
}

var input = fs.readSync(process.stdin.fd, size)[0];

console.log(solc.compileStandard(input));
// this locks until end of stdin is signaled with ctrl+D , works fine for piped stuff
var stdinBuffer = fs.readFileSync(0); // STDIN_FILENO = 0
console.log(solc.compileStandard(stdinBuffer.toString()));
process.exit(0);
} else if (files.length === 0) {
console.error('Must provide a file');
Expand Down
29 changes: 29 additions & 0 deletions test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,33 @@ tape('CLI', function (t) {
spt.succeeds();
spt.end();
});

t.test('standard json', function (st) {
var input = {
'language': 'Solidity',
'settings': {
'outputSelection': {
'*': {
'*': [ 'evm.bytecode', 'userdoc' ]
}
}
},
'sources': {
'Contract.sol': {
'content': 'pragma solidity ^0.4.0; contract Contract { function f() pure public {} }'
}
}
};
var spt = spawn(st, './solcjs --standard-json');
spt.stdin.setEncoding('utf-8');
spt.stdin.write(JSON.stringify(input));
spt.stdin.end();
spt.stdin.on('finish', function () {
spt.stderr.empty();
spt.stdout.match(/Contract.sol/);
spt.stdout.match(/userdoc/);
spt.succeeds();
spt.end();
});
});
});