Unverified Commit b2b18d49 authored by William Entriken's avatar William Entriken Committed by GitHub

Compile if solidity is fixed version, fixes #1011

parent e6d2fd78
...@@ -26,12 +26,12 @@ function compileFileOrFiles (filename, isDirectory, cb) { ...@@ -26,12 +26,12 @@ function compileFileOrFiles (filename, isDirectory, cb) {
filepath = (isDirectory ? filename : path.dirname(filename)) filepath = (isDirectory ? filename : path.dirname(filename))
fs.readdirSync(filepath).forEach(file => { fs.readdirSync(filepath).forEach(file => {
// only process .sol files // only process .sol files named *_test.sol
if (file.split('.').pop() === 'sol') { if (/_test.sol$/.test(file)) {
let c = fs.readFileSync(path.join(filepath, file)).toString() let c = fs.readFileSync(path.join(filepath, file)).toString()
const s = /^(import)\s['"](remix_tests.sol|tests.sol)['"];/gm const s = /^(import)\s['"](remix_tests.sol|tests.sol)['"];/gm
if (file.indexOf('_test.sol') > 0 && c.regexIndexOf(s) < 0) { if (!s.test(c)) {
c = c.replace(/(pragma solidity \^\d+\.\d+\.\d+;)/, '$1\nimport \'remix_tests.sol\';') c = c.replace(/(pragma solidity \^?\d+\.\d+\.\d+;)/, '$1\nimport \'remix_tests.sol\';')
} }
sources[file] = { content: c } sources[file] = { content: c }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment