Skip to content

Commit

Permalink
Support solc.license
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Jul 18, 2017
1 parent be72a15 commit 5ae0ef1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
const tape = require('tape');
const solc = require('../index.js');

tape('Version and license', function (t) {
t.test('check version', function (st) {
st.equal(typeof solc.version(), 'string');
st.end();
});
t.test('check license', function (st) {
st.ok(typeof solc.license() === 'undefined' || typeof solc.license() === 'string');
st.end();
});
});

tape('Compilation', function (t) {
t.test('single files can be compiled', function (st) {
var output = solc.compile('contract x { function g() {} }');
Expand Down
9 changes: 9 additions & 0 deletions wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,17 @@ function setupMethods (soljson) {

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

var license = function () {
// return undefined
};

if ('_license' in soljson) {
license = soljson.cwrap('license', 'string', []);
}

return {
version: version,
license: license,
compile: compile,
compileStandard: compileStandard,
compileStandardWrapper: compileStandardWrapper,
Expand Down

0 comments on commit 5ae0ef1

Please sign in to comment.