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
6c726eeb
...
6c726eebedd4a8cd768c29420338c6bfa6009247
authored
2012-05-26 11:09:29 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
updated assertion processing system
1 parent
37cbe2c3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
6 deletions
modules/tester.js
modules/tester.js
View file @
6c726ee
...
...
@@ -82,6 +82,7 @@ var Tester = function Tester(casper, options) {
// special printing
switch
(
failure
.
type
)
{
case
'assertEquals'
:
case
'assertEvalEquals'
:
this
.
comment
(
' got: '
+
utils
.
serialize
(
failure
.
values
.
subject
));
this
.
comment
(
' expected: '
+
utils
.
serialize
(
failure
.
values
.
expected
));
break
;
...
...
@@ -163,9 +164,20 @@ var Tester = function Tester(casper, options) {
* @param Function fn A function to be evaluated in remote DOM
* @param String message Test description
* @param Object params Object containing the parameters to inject into the function (optional)
* @param Object|null context Assertion context object (Optional)
*/
this
.
assertEval
=
function
assertEval
(
fn
,
message
,
params
,
context
)
{
return
this
.
assert
(
casper
.
evaluate
(
fn
,
params
),
message
,
context
);
this
.
assertEval
=
this
.
assertEvaluate
=
function
assertEval
(
fn
,
message
,
params
,
context
)
{
return
this
.
processAssertionResult
(
utils
.
mergeObjects
({
success
:
casper
.
evaluate
(
fn
,
params
),
type
:
"assertEval"
,
details
:
"function didn't evaluate to true"
,
message
:
message
,
file
:
this
.
currentTestFile
,
values
:
{
fn
:
fn
,
params
:
params
}
},
context
||
{}));
};
/**
...
...
@@ -174,11 +186,22 @@ var Tester = function Tester(casper, options) {
*
* @param Function fn The function to be evaluated in remote DOM
* @param Boolean expected The expected value
* @param String message Test description
* @param Object params Object containing the parameters to inject into the function (optional)
* @param String|null message Test description
* @param Object|null params Object containing the parameters to inject into the function (optional)
* @param Object|null context Assertion context object (Optional)
*/
this
.
assertEvalEquals
=
this
.
assertEvalEqual
=
function
assertEvalEquals
(
fn
,
expected
,
message
,
context
)
{
return
this
.
assertEquals
(
casper
.
evaluate
(
fn
,
context
),
expected
,
message
);
this
.
assertEvalEquals
=
this
.
assertEvalEqual
=
function
assertEvalEquals
(
fn
,
expected
,
message
,
params
,
context
)
{
return
this
.
processAssertionResult
(
utils
.
mergeObjects
({
success
:
this
.
testEquals
(
casper
.
evaluate
(
fn
,
params
),
expected
),
type
:
"assertEvalEquals"
,
details
:
f
(
"test failed; expected: %s; got: %s"
,
expected
,
subject
),
message
:
message
,
file
:
this
.
currentTestFile
,
values
:
{
subject
:
subject
,
expected
:
expected
}
},
context
||
{}));
};
/**
...
...
Please
register
or
sign in
to post a comment