Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
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
张蕾
Geth-Modification
Commits
ddc17196
Commit
ddc17196
authored
Feb 03, 2015
by
Marek Kotewicz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests && fixes for utils methods
parent
fdcc1af4
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
101 additions
and
4 deletions
+101
-4
ethereum.js
dist/ethereum.js
+1
-1
ethereum.js.map
dist/ethereum.js.map
+1
-1
ethereum.min.js
dist/ethereum.min.js
+1
-1
utils.js
lib/utils.js
+1
-1
utils.extractDisplayName.js
test/utils.extractDisplayName.js
+42
-0
utils.extractTypeName.js
test/utils.extractTypeName.js
+55
-0
No files found.
dist/ethereum.js
View file @
ddc17196
...
@@ -1269,7 +1269,7 @@ var extractDisplayName = function (name) {
...
@@ -1269,7 +1269,7 @@ var extractDisplayName = function (name) {
var
extractTypeName
=
function
(
name
)
{
var
extractTypeName
=
function
(
name
)
{
/// TODO: make it invulnerable
/// TODO: make it invulnerable
var
length
=
name
.
indexOf
(
'('
);
var
length
=
name
.
indexOf
(
'('
);
return
length
!==
-
1
?
name
.
substr
(
length
+
1
,
name
.
length
-
1
-
(
length
+
1
))
:
""
;
return
length
!==
-
1
?
name
.
substr
(
length
+
1
,
name
.
length
-
1
-
(
length
+
1
))
.
replace
(
' '
,
''
)
:
""
;
};
};
/// Filters all function from input abi
/// Filters all function from input abi
...
...
dist/ethereum.js.map
View file @
ddc17196
This diff is collapsed.
Click to expand it.
dist/ethereum.min.js
View file @
ddc17196
This diff is collapsed.
Click to expand it.
lib/utils.js
View file @
ddc17196
...
@@ -84,7 +84,7 @@ var extractDisplayName = function (name) {
...
@@ -84,7 +84,7 @@ var extractDisplayName = function (name) {
var
extractTypeName
=
function
(
name
)
{
var
extractTypeName
=
function
(
name
)
{
/// TODO: make it invulnerable
/// TODO: make it invulnerable
var
length
=
name
.
indexOf
(
'('
);
var
length
=
name
.
indexOf
(
'('
);
return
length
!==
-
1
?
name
.
substr
(
length
+
1
,
name
.
length
-
1
-
(
length
+
1
))
:
""
;
return
length
!==
-
1
?
name
.
substr
(
length
+
1
,
name
.
length
-
1
-
(
length
+
1
))
.
replace
(
' '
,
''
)
:
""
;
};
};
/// Filters all function from input abi
/// Filters all function from input abi
...
...
test/utils.extractDisplayName.js
0 → 100644
View file @
ddc17196
var
assert
=
require
(
'assert'
);
var
utils
=
require
(
'../lib/utils.js'
);
describe
(
'utils'
,
function
()
{
describe
(
'extractDisplayName'
,
function
()
{
it
(
'should extract display name from method with no params'
,
function
()
{
// given
var
test
=
'helloworld()'
;
// when
var
displayName
=
utils
.
extractDisplayName
(
test
);
// then
assert
.
equal
(
displayName
,
'helloworld'
);
});
it
(
'should extract display name from method with one param'
,
function
()
{
// given
var
test
=
'helloworld1(int)'
;
// when
var
displayName
=
utils
.
extractDisplayName
(
test
);
// then
assert
.
equal
(
displayName
,
'helloworld1'
);
});
it
(
'should extract display name from method with two params'
,
function
()
{
// given
var
test
=
'helloworld2(int,string)'
;
// when
var
displayName
=
utils
.
extractDisplayName
(
test
);
// then
assert
.
equal
(
displayName
,
'helloworld2'
);
});
});
});
test/utils.extractTypeName.js
0 → 100644
View file @
ddc17196
var
assert
=
require
(
'assert'
);
var
utils
=
require
(
'../lib/utils.js'
);
describe
(
'utils'
,
function
()
{
describe
(
'extractTypeName'
,
function
()
{
it
(
'should extract type name from method with no params'
,
function
()
{
// given
var
test
=
'helloworld()'
;
// when
var
typeName
=
utils
.
extractTypeName
(
test
);
// then
assert
.
equal
(
typeName
,
''
);
});
it
(
'should extract type name from method with one param'
,
function
()
{
// given
var
test
=
'helloworld1(int)'
;
// when
var
typeName
=
utils
.
extractTypeName
(
test
);
// then
assert
.
equal
(
typeName
,
'int'
);
});
it
(
'should extract type name from method with two params'
,
function
()
{
// given
var
test
=
'helloworld2(int,string)'
;
// when
var
typeName
=
utils
.
extractTypeName
(
test
);
// then
assert
.
equal
(
typeName
,
'int,string'
);
});
it
(
'should extract type name from method with spaces between params'
,
function
()
{
// given
var
test
=
'helloworld3(int, string)'
;
// when
var
typeName
=
utils
.
extractTypeName
(
test
);
// then
assert
.
equal
(
typeName
,
'int,string'
);
});
});
});
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