Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
7d23991a
...
7d23991a0923fd7f8247395376040bc78162166b
authored
2011-12-23 15:28:46 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added unit tests for util's fileExt()
1 parent
08de888d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
lib/utils.js
tests/suites/utils.js
lib/utils.js
View file @
7d23991
...
...
@@ -159,7 +159,7 @@ function dump(value) {
*/
function
fileExt
(
file
)
{
try
{
return
file
.
split
(
'.'
).
pop
().
toLowerCase
();
return
file
.
split
(
'.'
).
pop
().
toLowerCase
()
.
trim
()
;
}
catch
(
e
)
{
return
''
;
}
...
...
tests/suites/utils.js
View file @
7d23991
(
function
(
t
)
{
t
.
comment
(
'fileExt()'
);
var
testCases
=
{
'foo.ext'
:
'ext'
,
'FOO.EXT'
:
'ext'
,
'a.ext'
:
'ext'
,
'.ext'
:
'ext'
,
'toto.'
:
''
,
' plop.ext '
:
'ext'
};
for
(
var
testCase
in
testCases
)
{
t
.
assertEquals
(
fileExt
(
testCase
),
testCases
[
testCase
],
'fileExt() extract file extension'
);
}
t
.
comment
(
'mergeObjects()'
);
var
testCases
=
[
testCases
=
[
{
obj1
:
{
a
:
1
},
obj2
:
{
b
:
2
},
merged
:
{
a
:
1
,
b
:
2
}
},
...
...
Please
register
or
sign in
to post a comment