Created
December 2, 2012 16:46
-
-
Save dkinzer/4189737 to your computer and use it in GitHub Desktop.
Test passing arguments to Caper#assertEval()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url = 'http://casperjs.org'; | |
var casper = require('casper').create(); | |
var t = casper.test; | |
var Test = { | |
oneArgument : { | |
number : { | |
'five' : 5, | |
'four' : 4 | |
} | |
}, | |
twoArguments : { | |
'five' : 5, | |
'four' : 4 | |
} | |
}; | |
casper.start(url, function() { | |
t.comment('') | |
t.comment('Test passing arguments to assertEval:'); | |
t.comment('-------------------------------------'); | |
t.comment('') | |
var message = 'assertEval can be passed one argument.'; | |
t.assertEval(Test.evalWithOneArgument, message, Test.oneArgument); | |
message = 'assertEval can be passed multiple arguments.'; | |
t.assertEval(Test.evalWithTwoArguments, message, Test.twoArguments); | |
t.comment(''); | |
}); | |
Test.evalWithOneArgument = function (number) { | |
return number.five > number.four; | |
} | |
Test.evalWithTwoArguments = function(five, four) { | |
return five > four; | |
} | |
casper.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment