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
776c633a
...
776c633a789778b8c6fd20db0c400b618904fbb8
authored
2013-01-05 16:14:05 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added tests for version comparison utils
1 parent
99463643
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
1 deletions
tests/suites/utils.js
tests/suites/utils.js
View file @
776c633
...
...
@@ -306,4 +306,63 @@ t.comment('unique()');
});
})();
t
.
done
(
112
);
t
.
comment
(
'cmpVersion() tests'
);
(
function
()
{
t
.
assertEquals
(
utils
.
cmpVersion
(
'1.0.0'
,
'2.0.0'
),
-
1
,
'cmpVersion() can compare version strings'
);
t
.
assertEquals
(
utils
.
cmpVersion
(
'1.0.0-DEV'
,
'2.0.0-BOOM'
),
-
1
,
'cmpVersion() can compare version strings'
);
t
.
assertEquals
(
utils
.
cmpVersion
(
'1.0.0'
,
'1.1.0'
),
-
1
,
'cmpVersion() can compare version strings'
);
t
.
assertEquals
(
utils
.
cmpVersion
(
'1.1.0'
,
'1.0.0'
),
1
,
'cmpVersion() can compare version strings'
);
t
.
assertEquals
(
utils
.
cmpVersion
(
'0.0.3'
,
'0.0.4'
),
-
1
,
'cmpVersion() can compare version strings'
);
t
.
assertEquals
(
utils
.
cmpVersion
(
'0.0.3'
,
'1.0.3'
),
-
1
,
'cmpVersion() can compare version strings'
);
t
.
assertEquals
(
utils
.
cmpVersion
(
'0.1'
,
'1.0.3.8'
),
-
1
,
'cmpVersion() can compare version strings'
);
t
.
assertEquals
(
utils
.
cmpVersion
({
major
:
1
,
minor
:
2
,
patch
:
3
},
{
major
:
1
,
minor
:
2
,
patch
:
4
}),
-
1
,
'cmpVersion() can compare version objects'
);
t
.
assertEquals
(
utils
.
cmpVersion
({
major
:
2
,
minor
:
0
,
patch
:
3
},
{
major
:
1
,
minor
:
0
,
patch
:
4
}),
1
,
'cmpVersion() can compare version objects'
);
t
.
assertEquals
(
utils
.
cmpVersion
({
major
:
0
,
minor
:
0
,
patch
:
3
},
{
major
:
1
,
minor
:
0
,
patch
:
3
}),
-
1
,
'cmpVersion() can compare version objects'
);
t
.
done
();
})();
t
.
comment
(
'gteVersion() tests'
);
(
function
()
{
t
.
assert
(
utils
.
gteVersion
(
'1.1.0'
,
'1.0.0'
),
'gteVersion() checks for a greater or equal version'
);
t
.
assertNot
(
utils
.
gteVersion
(
'1.0.0'
,
'1.1.0'
),
'gteVersion() checks for a greater or equal version'
);
t
.
assert
(
utils
.
gteVersion
({
major
:
1
,
minor
:
1
,
patch
:
0
},
{
major
:
1
,
minor
:
0
,
patch
:
0
}),
'gteVersion() checks for a greater or equal version'
);
t
.
assertNot
(
utils
.
gteVersion
({
major
:
1
,
minor
:
0
,
patch
:
0
},
{
major
:
1
,
minor
:
1
,
patch
:
0
}),
'gteVersion() checks for a greater or equal version'
);
t
.
done
();
})();
t
.
comment
(
'ltVersion() tests'
);
(
function
()
{
t
.
assert
(
utils
.
ltVersion
(
'1.0.0'
,
'1.1.0'
),
'ltVersion() checks for a lesser version'
);
t
.
assertNot
(
utils
.
ltVersion
(
'1.1.0'
,
'1.0.0'
),
'ltVersion() checks for a lesser version'
);
t
.
assert
(
utils
.
ltVersion
({
major
:
1
,
minor
:
0
,
patch
:
0
},
{
major
:
1
,
minor
:
1
,
patch
:
0
}),
'ltVersion() checks for a lesser version'
);
t
.
assertNot
(
utils
.
ltVersion
({
major
:
1
,
minor
:
1
,
patch
:
0
},
{
major
:
1
,
minor
:
0
,
patch
:
0
}),
'ltVersion() checks for a lesser version'
);
t
.
done
();
})();
t
.
done
(
130
);
...
...
Please
register
or
sign in
to post a comment