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
b6cdea12
Commit
b6cdea12
authored
Nov 19, 2019
by
aniket-engg
Committed by
Aniket
Nov 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
suggested changes
parent
10aa7322
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
7 deletions
+9
-7
runTestSources.ts
remix-tests/src/runTestSources.ts
+1
-2
testRunner.ts
remix-tests/src/testRunner.ts
+7
-5
types.ts
remix-tests/src/types.ts
+1
-0
No files found.
remix-tests/src/runTestSources.ts
View file @
b6cdea12
...
@@ -4,11 +4,10 @@ require('colors')
...
@@ -4,11 +4,10 @@ require('colors')
import
{
compileContractSources
}
from
'./compiler'
import
{
compileContractSources
}
from
'./compiler'
import
{
deployAll
}
from
'./deployer'
import
{
deployAll
}
from
'./deployer'
import
{
runTest
}
from
'./testRunner'
import
{
runTest
}
from
'./testRunner'
import
{
TestResultInterface
,
AstNode
}
from
'./types'
import
Web3
=
require
(
'web3'
)
import
Web3
=
require
(
'web3'
)
import
{
Provider
}
from
'remix-simulator'
import
{
Provider
}
from
'remix-simulator'
import
{
FinalResult
,
SrcIfc
,
compilationInterface
,
ASTInterface
,
Options
}
from
'./types'
import
{
FinalResult
,
SrcIfc
,
compilationInterface
,
ASTInterface
,
Options
,
TestResultInterface
,
AstNode
}
from
'./types'
const
createWeb3Provider
=
async
function
()
{
const
createWeb3Provider
=
async
function
()
{
let
web3
=
new
Web3
()
let
web3
=
new
Web3
()
...
...
remix-tests/src/testRunner.ts
View file @
b6cdea12
...
@@ -4,7 +4,7 @@ import Web3 = require('web3')
...
@@ -4,7 +4,7 @@ import Web3 = require('web3')
import
{
RunListInterface
,
TestCbInterface
,
TestResultInterface
,
ResultCbInterface
,
import
{
RunListInterface
,
TestCbInterface
,
TestResultInterface
,
ResultCbInterface
,
CompiledContract
,
AstNode
,
Options
,
FunctionDescription
,
UserDocumentation
}
from
'./types'
CompiledContract
,
AstNode
,
Options
,
FunctionDescription
,
UserDocumentation
}
from
'./types'
function
getFunctionFullName
(
signature
:
string
,
methodIdentifiers
:
any
)
{
function
getFunctionFullName
(
signature
:
string
,
methodIdentifiers
:
Record
<
string
,
string
>
)
{
for
(
const
method
in
methodIdentifiers
)
{
for
(
const
method
in
methodIdentifiers
)
{
if
(
signature
.
replace
(
'0x'
,
''
)
===
methodIdentifiers
[
method
].
replace
(
'0x'
,
''
))
{
if
(
signature
.
replace
(
'0x'
,
''
)
===
methodIdentifiers
[
method
].
replace
(
'0x'
,
''
))
{
return
method
return
method
...
@@ -13,7 +13,7 @@ function getFunctionFullName (signature: string, methodIdentifiers: any) {
...
@@ -13,7 +13,7 @@ function getFunctionFullName (signature: string, methodIdentifiers: any) {
return
null
return
null
}
}
function
getOverridedSender
(
userdoc
:
UserDocumentation
,
signature
:
string
,
methodIdentifiers
:
any
)
{
function
getOverridedSender
(
userdoc
:
UserDocumentation
,
signature
:
string
,
methodIdentifiers
:
Record
<
string
,
string
>
)
{
let
fullName
:
any
=
getFunctionFullName
(
signature
,
methodIdentifiers
)
let
fullName
:
any
=
getFunctionFullName
(
signature
,
methodIdentifiers
)
let
match
:
RegExp
=
/sender: account-+
(\d)
/g
let
match
:
RegExp
=
/sender: account-+
(\d)
/g
let
accountIndex
:
any
=
userdoc
.
methods
[
fullName
]
?
match
.
exec
(
userdoc
.
methods
[
fullName
].
notice
)
:
null
let
accountIndex
:
any
=
userdoc
.
methods
[
fullName
]
?
match
.
exec
(
userdoc
.
methods
[
fullName
].
notice
)
:
null
...
@@ -27,12 +27,14 @@ function getOverridedSender (userdoc: UserDocumentation, signature: string, meth
...
@@ -27,12 +27,14 @@ function getOverridedSender (userdoc: UserDocumentation, signature: string, meth
*/
*/
function
getAvailableFunctions
(
fileAST
:
AstNode
,
testContractName
:
string
)
{
function
getAvailableFunctions
(
fileAST
:
AstNode
,
testContractName
:
string
)
{
var
funcList
:
string
[]
=
[]
let
funcList
:
string
[]
=
[]
if
(
fileAST
.
nodes
&&
fileAST
.
nodes
.
length
>
0
)
{
if
(
fileAST
.
nodes
&&
fileAST
.
nodes
.
length
>
0
)
{
const
contractAST
:
any
[]
=
fileAST
.
nodes
.
filter
(
node
=>
node
.
name
===
testContractName
&&
node
.
nodeType
===
'ContractDefinition'
)
const
contractAST
:
AstNode
[]
=
fileAST
.
nodes
.
filter
(
node
=>
node
.
name
===
testContractName
&&
node
.
nodeType
===
'ContractDefinition'
)
const
funcNodes
:
any
[]
=
contractAST
[
0
].
nodes
.
filter
(
node
=>
node
.
kind
===
'function'
&&
node
.
nodeType
===
"FunctionDefinition"
)
if
(
contractAST
.
length
>
0
&&
contractAST
[
0
].
nodes
)
{
const
funcNodes
:
AstNode
[]
=
contractAST
[
0
].
nodes
.
filter
(
node
=>
node
.
kind
===
'function'
&&
node
.
nodeType
===
"FunctionDefinition"
)
funcList
=
funcNodes
.
map
(
node
=>
node
.
name
)
funcList
=
funcNodes
.
map
(
node
=>
node
.
name
)
}
}
}
return
funcList
;
return
funcList
;
}
}
...
...
remix-tests/src/types.ts
View file @
b6cdea12
...
@@ -163,6 +163,7 @@ export interface FunctionDescription {
...
@@ -163,6 +163,7 @@ export interface FunctionDescription {
payable
?:
boolean
payable
?:
boolean
/** true if function is either pure or view, false otherwise. Default is false */
/** true if function is either pure or view, false otherwise. Default is false */
constant
?:
boolean
constant
?:
boolean
signature
?:
string
}
}
export
interface
EventDescription
{
export
interface
EventDescription
{
...
...
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