mirror of https://github.com/ethereum/go-ethereum
parent
fdcc1af4e2
commit
ddc17196da
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,42 @@ |
||||
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'); |
||||
}); |
||||
}); |
||||
}); |
@ -0,0 +1,55 @@ |
||||
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'); |
||||
}); |
||||
|
||||
}); |
||||
}); |
Loading…
Reference in new issue