From e7626131a25bad66759abb112b5d9b77f3588f74 Mon Sep 17 00:00:00 2001 From: Franco Victorio Date: Tue, 1 Sep 2020 15:32:13 -0300 Subject: [PATCH 1/2] Join version constraints with a space --- src/ASTBuilder.js | 9 ++++++++- test/ast.js | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ASTBuilder.js b/src/ASTBuilder.js index 7d4c68a..818aed1 100644 --- a/src/ASTBuilder.js +++ b/src/ASTBuilder.js @@ -108,9 +108,16 @@ const transformAST = { }, PragmaDirective(ctx) { + // this converts something like >= 0.5.0 <0.7.0 + // in >=0.5.0 <0.7.0 + const value = ctx + .pragmaValue() + .children[0].children.map(x => toText(x)) + .join(" ") + return { name: toText(ctx.pragmaName()), - value: toText(ctx.pragmaValue()) + value } }, diff --git a/test/ast.js b/test/ast.js index 77d3bff..f56645a 100644 --- a/test/ast.js +++ b/test/ast.js @@ -79,7 +79,7 @@ describe('AST', () => { "~0.3.11",, "~1.3", "~10", "=0.0.1", "=0.6", "=1", "<=1.1.1", "<=11.11", "<=111", - "<0.5.11"] + "<0.5.11", ">=0.6.7 <0.7.0"] versions.forEach(function (version) { it("PragmaDirective " + version, function() { var ast = parser.parse("pragma solidity " + version + ";") From 3174bc3775015699156e9c654610aa6ca6dd1c43 Mon Sep 17 00:00:00 2001 From: Franco Victorio Date: Tue, 1 Sep 2020 15:36:07 -0300 Subject: [PATCH 2/2] Run linter and tests in travis --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index efb0983..1bbb11e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,7 @@ language: node_js node_js: - - "8" + - "10" + +script: + - npm run eslint + - npm test