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
02c68046
Commit
02c68046
authored
Jan 19, 2021
by
aniket-engg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests for custom optimize option
parent
8d59edf1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
10 deletions
+29
-10
compiler.ts
libs/remix-tests/src/compiler.ts
+13
-8
run.ts
libs/remix-tests/src/run.ts
+2
-2
testRunner.cli.spec.ts
libs/remix-tests/tests/testRunner.cli.spec.ts
+14
-0
No files found.
libs/remix-tests/src/compiler.ts
View file @
02c68046
...
@@ -126,15 +126,20 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts:
...
@@ -126,15 +126,20 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts:
async
.
waterfall
([
async
.
waterfall
([
function
loadCompiler
(
next
)
{
function
loadCompiler
(
next
)
{
compiler
=
new
RemixCompiler
()
compiler
=
new
RemixCompiler
()
const
{
currentCompilerUrl
,
evmVersion
,
optimize
,
runs
}
=
compilerConfig
if
(
compilerConfig
)
{
evmVersion
?
compiler
.
set
(
'evmVersion'
,
evmVersion
)
:
const
{
currentCompilerUrl
,
evmVersion
,
optimize
,
runs
}
=
compilerConfig
optimize
?
compiler
.
set
(
'optimize'
,
optimize
)
:
evmVersion
?
compiler
.
set
(
'evmVersion'
,
evmVersion
)
:
null
runs
?
compiler
.
set
(
'runs'
,
runs
)
:
''
optimize
?
compiler
.
set
(
'optimize'
,
optimize
)
:
null
if
(
currentCompilerUrl
)
{
runs
?
compiler
.
set
(
'runs'
,
runs
)
:
null
compiler
.
loadRemoteVersion
(
currentCompilerUrl
)
if
(
currentCompilerUrl
)
{
compiler
.
event
.
register
(
'compilerLoaded'
,
this
,
function
(
version
)
{
compiler
.
loadRemoteVersion
(
currentCompilerUrl
)
compiler
.
event
.
register
(
'compilerLoaded'
,
this
,
function
(
version
)
{
next
()
});
}
else
{
compiler
.
onInternalCompilerLoaded
()
next
()
next
()
}
);
}
}
else
{
}
else
{
compiler
.
onInternalCompilerLoaded
()
compiler
.
onInternalCompilerLoaded
()
next
()
next
()
...
...
libs/remix-tests/src/run.ts
View file @
02c68046
...
@@ -99,8 +99,8 @@ commander
...
@@ -99,8 +99,8 @@ commander
}
}
if
(
commander
.
optimize
)
{
if
(
commander
.
optimize
)
{
compilerConfig
.
optimize
=
commander
.
optimize
compilerConfig
.
optimize
=
commander
.
optimize
log
.
info
(
`Optimization is
${
compilerConfig
.
optimize
?
'enabled'
:
'disabled'
}
`
)
log
.
info
(
`Optimization is
${
compilerConfig
.
optimize
?
'enabled'
:
'disabled'
}
`
)
}
}
const
web3
=
new
Web3
()
const
web3
=
new
Web3
()
...
...
libs/remix-tests/tests/testRunner.cli.spec.ts
View file @
02c68046
...
@@ -77,5 +77,18 @@ Commands:
...
@@ -77,5 +77,18 @@ Commands:
// macth fail test details
// macth fail test details
expect
(
res
.
stdout
.
toString
().
trim
()).
toMatch
(
/error: okFailTest fails/
)
expect
(
res
.
stdout
.
toString
().
trim
()).
toMatch
(
/error: okFailTest fails/
)
})
})
test
(
'remix-tests running a test file by enabling optimization'
,
()
=>
{
const
res
=
spawnSync
(
executablePath
,
[
'--optimize'
,
'true'
,
resolve
(
__dirname
+
'/examples_0/assert_ok_test.sol'
)])
// match initial lines
expect
(
res
.
stdout
.
toString
().
trim
().
includes
(
'Optimization is enabled'
)).
toBeTruthy
()
expect
(
res
.
stdout
.
toString
().
trim
()).
toMatch
(
/:: Running remix-tests - Unit testing for solidity ::/
)
expect
(
res
.
stdout
.
toString
().
trim
()).
toMatch
(
/creation of library remix_tests.sol:Assert pending.../
)
// match test result
expect
(
res
.
stdout
.
toString
().
trim
()).
toMatch
(
/Ok pass test/
)
expect
(
res
.
stdout
.
toString
().
trim
()).
toMatch
(
/Ok fail test/
)
// macth fail test details
expect
(
res
.
stdout
.
toString
().
trim
()).
toMatch
(
/error: okFailTest fails/
)
})
})
})
})
})
\ No newline at end of file
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