diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-02-04 03:12:56 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-02-04 03:12:56 +0800 |
commit | ddc17196da36c1ad660b70f33f8b4eaaccdbdda8 (patch) | |
tree | 09a3246661cbf776f9250bc051569e011ea44d74 /test | |
parent | fdcc1af4e22c65d4b920b6143918d54c66ab0d08 (diff) | |
download | go-tangerine-ddc17196da36c1ad660b70f33f8b4eaaccdbdda8.tar go-tangerine-ddc17196da36c1ad660b70f33f8b4eaaccdbdda8.tar.gz go-tangerine-ddc17196da36c1ad660b70f33f8b4eaaccdbdda8.tar.bz2 go-tangerine-ddc17196da36c1ad660b70f33f8b4eaaccdbdda8.tar.lz go-tangerine-ddc17196da36c1ad660b70f33f8b4eaaccdbdda8.tar.xz go-tangerine-ddc17196da36c1ad660b70f33f8b4eaaccdbdda8.tar.zst go-tangerine-ddc17196da36c1ad660b70f33f8b4eaaccdbdda8.zip |
tests && fixes for utils methods
Diffstat (limited to 'test')
-rw-r--r-- | test/utils.extractDisplayName.js | 42 | ||||
-rw-r--r-- | test/utils.extractTypeName.js | 55 |
2 files changed, 97 insertions, 0 deletions
diff --git a/test/utils.extractDisplayName.js b/test/utils.extractDisplayName.js new file mode 100644 index 000000000..148653ab2 --- /dev/null +++ b/test/utils.extractDisplayName.js @@ -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'); + }); + }); +}); diff --git a/test/utils.extractTypeName.js b/test/utils.extractTypeName.js new file mode 100644 index 000000000..2b4bbe767 --- /dev/null +++ b/test/utils.extractTypeName.js @@ -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'); + }); + + }); +}); |