Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
a049c101
Unverified
Commit
a049c101
authored
Nov 21, 2018
by
yann300
Committed by
GitHub
Nov 21, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1067 from LianaHus/include_remix_test_sol
include test libraries import statements into sources anyway
parents
0afe8e3e
43fd1f97
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
compiler.js
remix-tests/src/compiler.js
+4
-2
No files found.
remix-tests/src/compiler.js
View file @
a049c101
...
...
@@ -42,8 +42,9 @@ function compileFileOrFiles (filename, isDirectory, opts, cb) {
if
(
file
.
split
(
'.'
).
pop
()
===
'sol'
)
{
let
c
=
fs
.
readFileSync
(
path
.
join
(
filepath
,
file
)).
toString
()
const
s
=
/^
(
import
)\s[
'"
](
remix_tests.sol|tests.sol
)[
'"
]
;/gm
let
includeTestLibs
=
'
\
nimport
\'
remix_tests.sol
\'
;
\
n'
if
(
file
.
indexOf
(
'_test.sol'
)
>
0
&&
c
.
regexIndexOf
(
s
)
<
0
)
{
c
=
c
.
replace
(
/
(
pragma solidity
\^?\d
+
\.\d
+
\.\d
+;
)
/
,
'$1
\
nimport
\'
remix_tests.sol
\'
;'
)
c
=
includeTestLibs
.
concat
(
c
)
}
sources
[
file
]
=
{
content
:
c
}
}
...
...
@@ -82,10 +83,11 @@ function compileContractSources (sources, importFileCb, opts, cb) {
sources
[
'remix_accounts.sol'
]
=
{
content
:
writeTestAccountsContract
(
accounts
)
}
}
const
s
=
/^
(
import
)\s[
'"
](
remix_tests.sol|tests.sol
)[
'"
]
;/gm
let
includeTestLibs
=
'
\
nimport
\'
remix_tests.sol
\'
;
\
n'
for
(
let
file
in
sources
)
{
const
c
=
sources
[
file
].
content
if
(
file
.
indexOf
(
'_test.sol'
)
>
0
&&
c
&&
c
.
regexIndexOf
(
s
)
<
0
)
{
sources
[
file
].
content
=
c
.
replace
(
/
(
pragma solidity
\^\d
+
\.\d
+
\.\d
+;
)
/
,
'$1
\
nimport
\'
remix_tests.sol
\'
;'
)
sources
[
file
].
content
=
includeTestLibs
.
concat
(
c
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment