Skip to content

Commit c6c6ecd

Browse files
authored
Merge pull request #127 from ethereum/solcjs-standard
Fix --standard-json on solcjs
2 parents 0bb4853 + 5e70070 commit c6c6ecd

File tree

3 files changed

+31
-12
lines changed

3 files changed

+31
-12
lines changed

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ branches:
88
matrix:
99
fast_finish: true
1010
include:
11-
- os: linux
12-
node_js: '4'
13-
env: CXX=g++-4.8 TEST_SUITE=test
1411
- os: linux
1512
node_js: '6'
1613
env: CXX=g++-4.8 TEST_SUITE=test

solcjs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,8 @@ function abort (msg) {
5151
}
5252

5353
if (argv['standard-json']) {
54-
var size = fs.fstatSync(process.stdin.fd).size;
55-
56-
if (size <= 0) {
57-
abort('Empty input was read');
58-
}
59-
60-
var input = fs.readSync(process.stdin.fd, size)[0];
61-
62-
console.log(solc.compileStandardWrapper(input));
54+
var input = fs.readFileSync(process.stdin.fd);
55+
console.log(solc.compile(input.toString('utf8')))
6356
process.exit(0);
6457
} else if (files.length === 0) {
6558
console.error('Must provide a file');

test/cli.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,33 @@ tape('CLI', function (t) {
6262
spt.succeeds();
6363
spt.end();
6464
});
65+
66+
t.test('standard json', function (st) {
67+
var input = {
68+
'language': 'Solidity',
69+
'settings': {
70+
'outputSelection': {
71+
'*': {
72+
'*': [ 'evm.bytecode', 'userdoc' ]
73+
}
74+
}
75+
},
76+
'sources': {
77+
'Contract.sol': {
78+
'content': 'pragma solidity ^0.5.0; contract Contract { function f() pure public {} }'
79+
}
80+
}
81+
};
82+
var spt = spawn(st, './solcjs --standard-json');
83+
spt.stdin.setEncoding('utf-8');
84+
spt.stdin.write(JSON.stringify(input));
85+
spt.stdin.end();
86+
spt.stdin.on('finish', function () {
87+
spt.stderr.empty();
88+
spt.stdout.match(/Contract.sol/);
89+
spt.stdout.match(/userdoc/);
90+
spt.succeeds();
91+
spt.end();
92+
});
93+
});
6594
});

0 commit comments

Comments
 (0)