Skip to content

Commit 3e7027d

Browse files
authored
Merge pull request #121 from ethereum/license
Support solc.license
2 parents be72a15 + 5ae0ef1 commit 3e7027d

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

test/package.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
const tape = require('tape');
22
const solc = require('../index.js');
33

4+
tape('Version and license', function (t) {
5+
t.test('check version', function (st) {
6+
st.equal(typeof solc.version(), 'string');
7+
st.end();
8+
});
9+
t.test('check license', function (st) {
10+
st.ok(typeof solc.license() === 'undefined' || typeof solc.license() === 'string');
11+
st.end();
12+
});
13+
});
14+
415
tape('Compilation', function (t) {
516
t.test('single files can be compiled', function (st) {
617
var output = solc.compile('contract x { function g() {} }');

wrapper.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,17 @@ function setupMethods (soljson) {
178178

179179
var version = soljson.cwrap('version', 'string', []);
180180

181+
var license = function () {
182+
// return undefined
183+
};
184+
185+
if ('_license' in soljson) {
186+
license = soljson.cwrap('license', 'string', []);
187+
}
188+
181189
return {
182190
version: version,
191+
license: license,
183192
compile: compile,
184193
compileStandard: compileStandard,
185194
compileStandardWrapper: compileStandardWrapper,

0 commit comments

Comments
 (0)