|
Sydney | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--Assert
Defined in assert.js
Field Summary | |
var |
Expected
|
var |
actual
|
Constructor Summary | |
Assert
()
|
Method Summary | |
void
|
assertArraysEqual(<Array> expected, <Array> actual, <string> msg)
Asserts that two arrays contain equal objects in the same order. |
void
|
assertArraysIdentical(<Array> expected, <Array> actual, <string> msg)
Asserts that two arrays contain identical objects in the same order. |
void
|
assertDefined(<Object> object, <string> msg)
Checks to see if object is something other than
undefined and throws an
AssertionFailedError if not.
|
void
|
assertEqual(<Object> expected, <Object> actual, <string> msg)
Checks to see if expected and actual are
equal.
|
void
|
assertFalse(<boolean> condition, <string> msg)
Checks to see if condition is false and calls
fail() if not.
|
void
|
assertIdentical(<Object> expected, <Object> actual, <string> msg)
Checks to see if expected and actual are
identical.
|
void
|
assertNotIdentical(<Object> expected, <Object> actual, <string> msg)
Checks to see if expected and actual are
identical and throws an {$link AssertionFailedError} if so.
|
void
|
assertNotNull(<Object> object, <string> msg)
Checks to see if object is something other than
null and throws an
AssertionFailedError if not.
|
void
|
assertNull(<Object> object, <string> msg)
Checks to see if object is identical to
null and throws an
AssertionFailedError if not.
|
void
|
assertTrue(<boolean> condition, <string> msg)
Checks to see if condition is true and calls
fail() if not.
|
void
|
assertUndefined(<Object> object, <string> msg)
Checks to see if object is identical to
undefined and throws an
AssertionFailedError if not.
|
void
|
fail(<string> msg)
Causes the running test to fail. |
Field Detail |
var Expected
var actual
Constructor Detail |
function Assert()
Method Detail |
void assertArraysEqual(<Array> expected, <Array> actual, <string> msg)
this.assertEqual(expected.length, actual.length, msg)
and then calls this.assertEqual(expected[i], actual[i], msg)
for each i
between 0
and
expected.length
.
expected
- the array of expected values
actual
- the array of actual values
msg
- (Optional) - a message to display if expected
and actual
are of different lengths or if any corresponding pair of elements in expected
and actual
do not match. The default value is the same as the default message for assertEqual()
.
void assertArraysIdentical(<Array> expected, <Array> actual, <string> msg)
assertArraysEqual()
but calls
assertIdentical()
instead of assertEqual()
. To assert that two objects refer to the same
array reference, use assertIdentical()
instead.
expected
- the array of expected values
actual
- the array of actual values
msg
- (Optional) - a message to display if expected
and actual
are of different lengths or if any corresponding pair of elements in expected
and actual
do not match. The default value is the same as the default message for assertIdentical()
.
void assertDefined(<Object> object, <string> msg)
object
is something other than
undefined
and throws an
AssertionFailedError
if not.
object
- the thing that should be defined
msg
- (Optional) - the message to display if object
is undefined
. Defaults to the empty string.
AssertionFailedError
void assertEqual(<Object> expected, <Object> actual, <string> msg)
expected
and actual
are
equal. Note that the string "5"
is equal to the integer
5
according to the JavaScript spec. To avoid type
coercion, use assertIdentical()
.
expected
- the expected value of actual
actual
- the value to test
msg
- (Optional) - the message to display if actual
is not equal to expected
. Defaults to "<" + actual + "> not equal to <" + expected + ">"
.
AssertionFailedError
void assertFalse(<boolean> condition, <string> msg)
condition
is false
and calls
fail()
if not. This is a convenience function to
avoid this.assertTrue(!condition, msg)
and (hopefully) aid
readability.
condition
- the boolean condition to check. If condition
is true, an AssertionFailedError
will be thrown.
msg
- (Optional) - a message to display if condition
is true
. Defaults to the empty string.
AssertionFailedError
void assertIdentical(<Object> expected, <Object> actual, <string> msg)
expected
and actual
are
identical.
expected
- the expected value of actual
actual
- the value to test
msg
- (Optional) - the message to display if actual
is not identical to expected
. Defaults to "<" + actual + "> not identical to <" + expected + ">"
.
AssertionFailedError
void assertNotIdentical(<Object> expected, <Object> actual, <string> msg)
expected
and actual
are
identical and throws an {$link AssertionFailedError}
if so.
expected
- the expected value of actual
actual
- the value to test
msg
- (Optional) - the message to display if actual
is identical to expected
. Defaults to "<" + actual + "> identical to <" + expected + ">"
.
AssertionFailedError
void assertNotNull(<Object> object, <string> msg)
object
is something other than
null
and throws an
AssertionFailedError
if not.
object
- the thing that should be non-null
msg
- (Optional) - the message to display if object
is null
. Defaults to the empty string.
AssertionFailedError
void assertNull(<Object> object, <string> msg)
object
is identical to
null
and throws an
AssertionFailedError
if not.
object
- the thing that should be null
msg
- (Optional) - the message to display if object
is not null
. Defaults to the empty string.
AssertionFailedError
void assertTrue(<boolean> condition, <string> msg)
condition
is true
and calls
fail()
if not.
condition
- the boolean condition to check. If condition
is false, an AssertionFailedError
will be thrown.
msg
- (Optional) - a message to display if condition
is false
. Defaults to the empty string.
AssertionFailedError
void assertUndefined(<Object> object, <string> msg)
object
is identical to
undefined
and throws an
AssertionFailedError
if not.
object
- the thing that should be undefined
msg
- (Optional) - the message to display if object
is not undefined
. Defaults to the empty string.
AssertionFailedError
void fail(<string> msg)
msg
is given then it
will be given as the reason for the failure.
msg
- (Optional) - the message to associate with the failure. Defaults to the empty string.
AssertionFailedError
|
Sydney | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |