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
b95a20a9
Unverified
Commit
b95a20a9
authored
Jun 21, 2018
by
Iuri Matias
Committed by
GitHub
Jun 21, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13 from ethereum/yann300-patch-3
Allow returning more than one Assert per function
parents
9fbe6965
3ebe6fbd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
16 deletions
+6
-16
testRunner.js
src/testRunner.js
+6
-16
No files found.
src/testRunner.js
View file @
b95a20a9
...
@@ -59,37 +59,27 @@ function runTest (testName, testObject, testCallback, resultsCallback) {
...
@@ -59,37 +59,27 @@ function runTest (testName, testObject, testCallback, resultsCallback) {
method
.
send
().
on
(
'receipt'
,
function
(
receipt
)
{
method
.
send
().
on
(
'receipt'
,
function
(
receipt
)
{
try
{
try
{
let
time
=
Math
.
ceil
((
Date
.
now
()
-
startTime
)
/
1000.0
)
let
time
=
Math
.
ceil
((
Date
.
now
()
-
startTime
)
/
1000.0
)
// if (func.type === 'test') {
let
topic
=
Web3
.
utils
.
sha3
(
'AssertionEvent(bool,string)'
)
let
topic
=
Web3
.
utils
.
sha3
(
'AssertionEvent(bool,string)'
)
let
matchingEvents
=
[]
for
(
let
i
in
receipt
.
events
)
{
for
(
let
i
in
receipt
.
events
)
{
let
event
=
receipt
.
events
[
i
]
let
event
=
receipt
.
events
[
i
]
if
(
event
.
raw
.
topics
.
indexOf
(
topic
)
>=
0
)
{
if
(
event
.
raw
.
topics
.
indexOf
(
topic
)
>=
0
)
{
matchingEvents
.
push
(
web3
.
eth
.
abi
.
decodeParameters
([
'bool'
,
'string'
],
event
.
raw
.
data
))
var
testEvent
=
web3
.
eth
.
abi
.
decodeParameters
([
'bool'
,
'string'
],
event
.
raw
.
data
)
}
if
(
testEvent
[
0
])
{
}
if
(
matchingEvents
.
length
===
0
)
{
return
next
()
}
let
result
=
matchingEvents
[
0
]
if
(
result
[
0
])
{
testCallback
({
type
:
'testPass'
,
value
:
changeCase
.
sentenceCase
(
func
.
name
),
time
:
time
,
context
:
testName
})
testCallback
({
type
:
'testPass'
,
value
:
changeCase
.
sentenceCase
(
func
.
name
),
time
:
time
,
context
:
testName
})
passingNum
+=
1
passingNum
+=
1
}
else
{
}
else
{
testCallback
({
type
:
'testFailure'
,
value
:
changeCase
.
sentenceCase
(
func
.
name
),
time
:
time
,
errMsg
:
resul
t
[
1
],
context
:
testName
})
testCallback
({
type
:
'testFailure'
,
value
:
changeCase
.
sentenceCase
(
func
.
name
),
time
:
time
,
errMsg
:
testEven
t
[
1
],
context
:
testName
})
failureNum
+=
1
failureNum
+=
1
}
}
// }
}
}
return
next
()
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
'error!'
)
console
.
log
(
'error!'
)
console
.
dir
(
err
)
console
.
dir
(
err
)
return
next
(
err
)
return
next
(
err
)
}
}
next
()
}).
on
(
'error'
,
function
(
err
)
{
}).
on
(
'error'
,
function
(
err
)
{
next
(
err
)
next
(
err
)
})
})
...
...
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