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
3dacdccf
Commit
3dacdccf
authored
Aug 30, 2018
by
0mkar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
path runTestFiles for injecting import statements, update readme
parent
0412ea4a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
4 deletions
+11
-4
README.md
remix-tests/README.md
+1
-1
simple_storage2_test.sol
remix-tests/examples/simple_storage2_test.sol
+1
-1
compiler.js
remix-tests/src/compiler.js
+9
-2
No files found.
remix-tests/README.md
View file @
3dacdccf
...
@@ -101,7 +101,7 @@ params:
...
@@ -101,7 +101,7 @@ params:
*
`{ type: 'testPass', value: '<name of testing function>', time: <time taken>, context: '<TestName>'}`
*
`{ type: 'testPass', value: '<name of testing function>', time: <time taken>, context: '<TestName>'}`
*
`{ type: 'testFailure', value: '<name of testing function>', time: <time taken>, context: '<TestName>', errMsg: '<message in the Assert>' }`
*
`{ type: 'testFailure', value: '<name of testing function>', time: <time taken>, context: '<TestName>', errMsg: '<message in the Assert>' }`
`resultCallback(object)`
`resultCallback(
err,
object)`
*
`passingNum`
- number of passing tests
*
`passingNum`
- number of passing tests
*
`failureNum`
- number of failing tests
*
`failureNum`
- number of failing tests
*
`timePassed`
- time it took for all the tests to run (in seconds)
*
`timePassed`
- time it took for all the tests to run (in seconds)
...
...
remix-tests/examples/simple_storage2_test.sol
View file @
3dacdccf
pragma solidity ^0.4.7;
pragma solidity ^0.4.7;
import "remix_test.sol";
import "remix_test
s
.sol";
import "./simple_storage.sol";
import "./simple_storage.sol";
contract MyTest2 {
contract MyTest2 {
...
...
remix-tests/src/compiler.js
View file @
3dacdccf
...
@@ -18,7 +18,6 @@ function compileFileOrFiles (filename, isDirectory, cb) {
...
@@ -18,7 +18,6 @@ function compileFileOrFiles (filename, isDirectory, cb) {
'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'
)
}
}
}
// signale.debug(sources)
// TODO: for now assumes filepath dir contains all tests, later all this
// TODO: for now assumes filepath dir contains all tests, later all this
// should be replaced with remix's & browser solidity compiler code
// should be replaced with remix's & browser solidity compiler code
...
@@ -63,9 +62,17 @@ function compileFileOrFiles (filename, isDirectory, cb) {
...
@@ -63,9 +62,17 @@ function compileFileOrFiles (filename, isDirectory, cb) {
function
compileContractSources
(
sources
,
importFileCb
,
cb
)
{
function
compileContractSources
(
sources
,
importFileCb
,
cb
)
{
let
compiler
,
filepath
let
compiler
,
filepath
if
(
!
sources
[
'remix_tests.sol'
])
{
// Iterate over sources keys. Inject test libraries. Inject test library import statements.
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'
)
}
}
}
const
s
=
/^
(
import
)\s[
'"
](
remix_tests.sol|tests.sol
)[
'"
]
;/gm
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
\'
;'
)
}
}
async
.
waterfall
([
async
.
waterfall
([
function
loadCompiler
(
next
)
{
function
loadCompiler
(
next
)
{
...
...
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