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
9f223cf7
...
9f223cf764999a0672e9bbf3ff9e4f359f2c22aa
authored
2012-03-07 19:55:44 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixes #55 - Modify tester.findTestFiles to return in predictable order
1 parent
252dbe7f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
22 deletions
modules/tester.js
tests/suites/tester.js
modules/tester.js
View file @
9f223cf
...
...
@@ -394,6 +394,8 @@ var Tester = function(casper, options) {
});
return
entries
.
filter
(
function
(
entry
)
{
return
utils
.
isJsFile
(
fs
.
absolute
(
fs
.
pathJoin
(
dir
,
entry
)));
}).
sort
(
function
(
a
,
b
)
{
return
a
>
b
;
});
};
...
...
tests/suites/tester.js
View file @
9f223cf
var
t
=
casper
.
test
;
t
.
comment
(
'Tester.testEquals()'
);
t
.
assert
(
casper
.
tes
t
.
testEquals
(
null
,
null
),
'Tester.testEquals() null equality'
);
t
.
assertNot
(
casper
.
tes
t
.
testEquals
(
null
,
undefined
),
'Tester.testEquals() null vs. undefined inequality'
);
t
.
assert
(
casper
.
tes
t
.
testEquals
(
"hi"
,
"hi"
),
'Tester.testEquals() string equality'
);
t
.
assertNot
(
casper
.
tes
t
.
testEquals
(
"hi"
,
"ih"
),
'Tester.testEquals() string inequality'
);
t
.
assert
(
casper
.
tes
t
.
testEquals
(
5
,
5
),
'Tester.testEquals() number equality'
);
t
.
assertNot
(
casper
.
tes
t
.
testEquals
(
"5"
,
5
),
'Tester.testEquals() number equality without implicit cast'
);
t
.
assert
(
casper
.
tes
t
.
testEquals
(
5
,
5.0
),
'Tester.testEquals() number equality with cast'
);
t
.
assertNot
(
casper
.
tes
t
.
testEquals
(
5
,
10
),
'Tester.testEquals() number inequality'
);
t
.
assert
(
casper
.
tes
t
.
testEquals
([],
[]),
'Tester.testEquals() empty array equality'
);
t
.
assert
(
casper
.
tes
t
.
testEquals
([
1
,
2
],
[
1
,
2
]),
'Tester.testEquals() array equality'
);
t
.
assert
(
casper
.
tes
t
.
testEquals
([
1
,
2
,[
1
,
2
,
function
(){}]],
[
1
,
2
,[
1
,
2
,
function
(){}]]),
'Tester.testEquals() complex array equality'
);
t
.
assertNot
(
casper
.
tes
t
.
testEquals
([
1
,
2
,[
1
,
2
,
function
(
a
){}]],
[
1
,
2
,[
1
,
2
,
function
(
b
){}]]),
'Tester.testEquals() complex array inequality'
);
t
.
assertNot
(
casper
.
tes
t
.
testEquals
([
1
,
2
],
[
2
,
1
]),
'Tester.testEquals() shuffled array inequality'
);
t
.
assertNot
(
casper
.
tes
t
.
testEquals
([
1
,
2
],
[
1
,
2
,
3
]),
'Tester.testEquals() array length inequality'
);
t
.
assert
(
casper
.
tes
t
.
testEquals
({},
{}),
'Tester.testEquals() empty object equality'
);
t
.
assert
(
casper
.
tes
t
.
testEquals
({
a
:
1
,
b
:
2
},
{
a
:
1
,
b
:
2
}),
'Tester.testEquals() object length equality'
);
t
.
assert
(
casper
.
tes
t
.
testEquals
({
a
:
1
,
b
:
2
},
{
b
:
2
,
a
:
1
}),
'Tester.testEquals() shuffled object keys equality'
);
t
.
assertNot
(
casper
.
tes
t
.
testEquals
({
a
:
1
,
b
:
2
},
{
a
:
1
,
b
:
3
}),
'Tester.testEquals() object inequality'
);
t
.
assert
(
casper
.
tes
t
.
testEquals
({
1
:{
name
:
"bob"
,
age
:
28
},
2
:{
name
:
"john"
,
age
:
26
}},
{
1
:{
name
:
"bob"
,
age
:
28
},
2
:{
name
:
"john"
,
age
:
26
}}),
'Tester.testEquals() complex object equality'
);
t
.
assertNot
(
casper
.
tes
t
.
testEquals
({
1
:{
name
:
"bob"
,
age
:
28
},
2
:{
name
:
"john"
,
age
:
26
}},
{
1
:{
name
:
"bob"
,
age
:
28
},
2
:{
name
:
"john"
,
age
:
27
}}),
'Tester.testEquals() complex object inequality'
);
t
.
assert
(
casper
.
tes
t
.
testEquals
(
function
(
x
){
return
x
;},
function
(
x
){
return
x
;}),
'Tester.testEquals() function equality'
);
t
.
assertNot
(
casper
.
tes
t
.
testEquals
(
function
(
x
){
return
x
;},
function
(
y
){
return
y
+
2
;}),
'Tester.testEquals() function inequality'
);
t
.
assert
(
t
.
testEquals
(
null
,
null
),
'Tester.testEquals() null equality'
);
t
.
assertNot
(
t
.
testEquals
(
null
,
undefined
),
'Tester.testEquals() null vs. undefined inequality'
);
t
.
assert
(
t
.
testEquals
(
"hi"
,
"hi"
),
'Tester.testEquals() string equality'
);
t
.
assertNot
(
t
.
testEquals
(
"hi"
,
"ih"
),
'Tester.testEquals() string inequality'
);
t
.
assert
(
t
.
testEquals
(
5
,
5
),
'Tester.testEquals() number equality'
);
t
.
assertNot
(
t
.
testEquals
(
"5"
,
5
),
'Tester.testEquals() number equality without implicit cast'
);
t
.
assert
(
t
.
testEquals
(
5
,
5.0
),
'Tester.testEquals() number equality with cast'
);
t
.
assertNot
(
t
.
testEquals
(
5
,
10
),
'Tester.testEquals() number inequality'
);
t
.
assert
(
t
.
testEquals
([],
[]),
'Tester.testEquals() empty array equality'
);
t
.
assert
(
t
.
testEquals
([
1
,
2
],
[
1
,
2
]),
'Tester.testEquals() array equality'
);
t
.
assert
(
t
.
testEquals
([
1
,
2
,[
1
,
2
,
function
(){}]],
[
1
,
2
,[
1
,
2
,
function
(){}]]),
'Tester.testEquals() complex array equality'
);
t
.
assertNot
(
t
.
testEquals
([
1
,
2
,[
1
,
2
,
function
(
a
){}]],
[
1
,
2
,[
1
,
2
,
function
(
b
){}]]),
'Tester.testEquals() complex array inequality'
);
t
.
assertNot
(
t
.
testEquals
([
1
,
2
],
[
2
,
1
]),
'Tester.testEquals() shuffled array inequality'
);
t
.
assertNot
(
t
.
testEquals
([
1
,
2
],
[
1
,
2
,
3
]),
'Tester.testEquals() array length inequality'
);
t
.
assert
(
t
.
testEquals
({},
{}),
'Tester.testEquals() empty object equality'
);
t
.
assert
(
t
.
testEquals
({
a
:
1
,
b
:
2
},
{
a
:
1
,
b
:
2
}),
'Tester.testEquals() object length equality'
);
t
.
assert
(
t
.
testEquals
({
a
:
1
,
b
:
2
},
{
b
:
2
,
a
:
1
}),
'Tester.testEquals() shuffled object keys equality'
);
t
.
assertNot
(
t
.
testEquals
({
a
:
1
,
b
:
2
},
{
a
:
1
,
b
:
3
}),
'Tester.testEquals() object inequality'
);
t
.
assert
(
t
.
testEquals
({
1
:{
name
:
"bob"
,
age
:
28
},
2
:{
name
:
"john"
,
age
:
26
}},
{
1
:{
name
:
"bob"
,
age
:
28
},
2
:{
name
:
"john"
,
age
:
26
}}),
'Tester.testEquals() complex object equality'
);
t
.
assertNot
(
t
.
testEquals
({
1
:{
name
:
"bob"
,
age
:
28
},
2
:{
name
:
"john"
,
age
:
26
}},
{
1
:{
name
:
"bob"
,
age
:
28
},
2
:{
name
:
"john"
,
age
:
27
}}),
'Tester.testEquals() complex object inequality'
);
t
.
assert
(
t
.
testEquals
(
function
(
x
){
return
x
;},
function
(
x
){
return
x
;}),
'Tester.testEquals() function equality'
);
t
.
assertNot
(
t
.
testEquals
(
function
(
x
){
return
x
;},
function
(
y
){
return
y
+
2
;}),
'Tester.testEquals() function inequality'
);
t
.
done
();
...
...
Please
register
or
sign in
to post a comment