Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
7825caa1
Commit
7825caa1
authored
Sep 12, 2018
by
Jakub Bogacz
Committed by
Nicolás Venturo
Sep 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit test specific to Address utils (#1251) (#1316)
parent
b79196f9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
AddressImpl.sol
contracts/mocks/AddressImpl.sol
+15
-0
Address.test.js
test/Address.test.js
+20
-0
No files found.
contracts/mocks/AddressImpl.sol
0 → 100644
View file @
7825caa1
pragma solidity ^0.4.24;
import "../utils/Address.sol";
contract AddressImpl {
function isContract(address account)
external
view
returns (bool)
{
return Address.isContract(account);
}
}
test/Address.test.js
0 → 100644
View file @
7825caa1
const
AddressImpl
=
artifacts
.
require
(
'AddressImpl'
);
const
SimpleToken
=
artifacts
.
require
(
'SimpleToken'
);
require
(
'chai'
)
.
should
();
contract
(
'Address'
,
function
([
_
,
anyone
])
{
beforeEach
(
async
function
()
{
this
.
mock
=
await
AddressImpl
.
new
();
});
it
(
'should return false for account address'
,
async
function
()
{
(
await
this
.
mock
.
isContract
(
anyone
)).
should
.
equal
(
false
);
});
it
(
'should return true for contract address'
,
async
function
()
{
const
contract
=
await
SimpleToken
.
new
();
(
await
this
.
mock
.
isContract
(
contract
.
address
)).
should
.
equal
(
true
);
});
});
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