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
40ba6855
Commit
40ba6855
authored
Aug 14, 2020
by
aniket-engg
Committed by
Aniket
Aug 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ok method expectvsreturn handled and tests added for ok and equalUint
parent
35bd3f74
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
0 deletions
+57
-0
testRunner.ts
libs/remix-tests/src/testRunner.ts
+4
-0
assert_test.sol
libs/remix-tests/tests/examples_0/assert_test.sol
+21
-0
testRunner.spec.ts
libs/remix-tests/tests/testRunner.spec.ts
+32
-0
No files found.
libs/remix-tests/src/testRunner.ts
View file @
40ba6855
...
@@ -247,6 +247,10 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
...
@@ -247,6 +247,10 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
if
(
eIndex
>=
0
)
{
if
(
eIndex
>=
0
)
{
const
testEvent
=
web3
.
eth
.
abi
.
decodeParameters
(
assertionEvents
[
eIndex
].
params
,
event
.
raw
.
data
)
const
testEvent
=
web3
.
eth
.
abi
.
decodeParameters
(
assertionEvents
[
eIndex
].
params
,
event
.
raw
.
data
)
if
(
!
testEvent
[
0
])
{
if
(
!
testEvent
[
0
])
{
if
(
eIndex
===
0
)
{
// for 'Assert.ok' method
testEvent
[
2
]
=
'false'
testEvent
[
3
]
=
'true'
}
const
resp
:
TestResultInterface
=
{
const
resp
:
TestResultInterface
=
{
type
:
'testFailure'
,
type
:
'testFailure'
,
value
:
changeCase
.
sentenceCase
(
func
.
name
),
value
:
changeCase
.
sentenceCase
(
func
.
name
),
...
...
libs/remix-tests/tests/examples_0/assert_test.sol
0 → 100644
View file @
40ba6855
import "remix_tests.sol"; // this import is automatically injected by Remix.
contract AssertTest {
function okPassTest() public {
Assert.ok(true, "okPassTest fails");
}
function okFailTest() public {
Assert.ok(false, "okFailTest fails");
}
function equalUintPassTest() public {
Assert.equal(uint(1), uint(1), "equalUintPassTest fails");
}
function equalUintFailTest() public {
Assert.equal(uint(1), uint(2), "equalUintFailTest fails");
}
}
\ No newline at end of file
libs/remix-tests/tests/testRunner.spec.ts
View file @
40ba6855
...
@@ -100,6 +100,38 @@ describe('testRunner', () => {
...
@@ -100,6 +100,38 @@ describe('testRunner', () => {
}
}
describe
(
'#runTest'
,
()
=>
{
describe
(
'#runTest'
,
()
=>
{
describe
(
'assert library methods test'
,
()
=>
{
const
filename
:
string
=
__dirname
+
'/examples_0/assert_test.sol'
beforeAll
((
done
)
=>
{
compileAndDeploy
(
filename
,
(
_err
:
Error
|
null
|
undefined
,
compilationData
:
object
,
contracts
:
any
,
asts
:
any
,
accounts
:
string
[])
=>
{
runTest
(
'AssertTest'
,
contracts
.
AssertTest
,
compilationData
[
filename
][
'AssertTest'
],
asts
[
filename
],
{
accounts
},
testCallback
,
resultsCallback
(
done
))
})
})
afterAll
(()
=>
{
tests
=
[]
})
it
(
'should have 2 passing test'
,
()
=>
{
assert
.
equal
(
results
.
passingNum
,
2
)
})
it
(
'should have 2 failing test'
,
()
=>
{
assert
.
equal
(
results
.
failureNum
,
2
)
})
it
(
'should return'
,
()
=>
{
deepEqualExcluding
(
tests
,
[
{
type
:
'accountList'
,
value
:
accounts
},
{
type
:
'contract'
,
value
:
'AssertTest'
,
filename
:
__dirname
+
'/examples_0/assert_test.sol'
},
{
type
:
'testPass'
,
value
:
'Ok pass test'
,
context
:
'AssertTest'
},
{
type
:
'testFailure'
,
value
:
'Ok fail test'
,
errMsg
:
'okFailTest fails'
,
context
:
'AssertTest'
,
expected
:
'true'
,
returned
:
'false'
},
{
type
:
'testPass'
,
value
:
'Equal uint pass test'
,
context
:
'AssertTest'
},
{
type
:
'testFailure'
,
value
:
'Equal uint fail test'
,
errMsg
:
'equalUintFailTest fails'
,
context
:
'AssertTest'
,
expected
:
'2'
,
returned
:
'1'
}
],
[
'time'
])
})
})
describe
(
'test with beforeAll'
,
()
=>
{
describe
(
'test with beforeAll'
,
()
=>
{
const
filename
:
string
=
__dirname
+
'/examples_1/simple_storage_test.sol'
const
filename
:
string
=
__dirname
+
'/examples_1/simple_storage_test.sol'
...
...
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