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
1ece2283
Commit
1ece2283
authored
Nov 12, 2019
by
aniket-engg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more types improved
parent
fa74b2e6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
compiler.ts
remix-tests/src/compiler.ts
+8
-7
No files found.
remix-tests/src/compiler.ts
View file @
1ece2283
...
@@ -75,7 +75,7 @@ const isBrowser = !(typeof (window) === 'undefined' || userAgent.indexOf(' elect
...
@@ -75,7 +75,7 @@ const isBrowser = !(typeof (window) === 'undefined' || userAgent.indexOf(' elect
// TODO: replace this with remix's own compiler code
// TODO: replace this with remix's own compiler code
export
function
compileFileOrFiles
(
filename
:
string
,
isDirectory
:
boolean
,
opts
:
any
,
cb
:
Function
)
{
export
function
compileFileOrFiles
(
filename
:
string
,
isDirectory
:
boolean
,
opts
:
any
,
cb
:
Function
)
{
let
compiler
:
any
let
compiler
:
any
le
t
accounts
:
any
[]
=
opts
.
accounts
||
[]
cons
t
accounts
:
any
[]
=
opts
.
accounts
||
[]
const
sources
:
SrcIfc
=
{
const
sources
:
SrcIfc
=
{
'tests.sol'
:
{
content
:
require
(
'../sol/tests.sol.js'
)
},
'tests.sol'
:
{
content
:
require
(
'../sol/tests.sol.js'
)
},
'remix_tests.sol'
:
{
content
:
require
(
'../sol/tests.sol.js'
)
},
'remix_tests.sol'
:
{
content
:
require
(
'../sol/tests.sol.js'
)
},
...
@@ -130,19 +130,20 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts:
...
@@ -130,19 +130,20 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts:
}
}
}
}
export
function
compileContractSources
(
sources
:
SrcIfc
,
versionUrl
:
any
,
usingWorker
:
any
,
importFileCb
:
any
,
opts
:
any
,
cb
:
Function
)
{
export
function
compileContractSources
(
sources
:
SrcIfc
,
versionUrl
:
any
,
usingWorker
:
boolean
,
importFileCb
:
any
,
opts
:
any
,
cb
:
Function
)
{
let
compiler
,
filepath
:
string
let
compiler
,
filepath
:
string
le
t
accounts
=
opts
.
accounts
||
[]
cons
t
accounts
=
opts
.
accounts
||
[]
// Iterate over sources keys. Inject test libraries. Inject test library import statements.
// Iterate over sources keys. Inject test libraries. Inject test library import statements.
if
(
!
(
'remix_tests.sol'
in
sources
)
&&
!
(
'tests.sol'
in
sources
))
{
if
(
!
(
'remix_tests.sol'
in
sources
)
&&
!
(
'tests.sol'
in
sources
))
{
sources
[
'remix_tests.sol'
]
=
{
content
:
require
(
'../sol/tests.sol.js'
)
}
sources
[
'remix_tests.sol'
]
=
{
content
:
require
(
'../sol/tests.sol.js'
)
}
sources
[
'remix_accounts.sol'
]
=
{
content
:
writeTestAccountsContract
(
accounts
)
}
sources
[
'remix_accounts.sol'
]
=
{
content
:
writeTestAccountsContract
(
accounts
)
}
}
}
const
s
=
/^
(
import
)\s[
'"
](
remix_tests.sol|tests.sol
)[
'"
]
;/gm
const
testFileImportRegEx
:
RegExp
=
/^
(
import
)\s[
'"
](
remix_tests.sol|tests.sol
)[
'"
]
;/gm
let
includeTestLibs
=
'
\
nimport
\'
remix_tests.sol
\'
;
\
n'
let
includeTestLibs
:
string
=
'
\
nimport
\'
remix_tests.sol
\'
;
\
n'
for
(
let
file
in
sources
)
{
for
(
let
file
in
sources
)
{
const
c
=
sources
[
file
].
content
const
c
:
string
=
sources
[
file
].
content
if
(
file
.
in
dexOf
(
'_test.sol'
)
>
0
&&
c
&&
regexIndexOf
(
c
,
s
)
<
0
)
{
if
(
file
.
in
cludes
(
'_test.sol'
)
&&
c
&&
regexIndexOf
(
c
,
testFileImportRegEx
)
<
0
)
{
sources
[
file
].
content
=
includeTestLibs
.
concat
(
c
)
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