Class assertions.Expect
Base class for non-fatal assertions
Defined in: assertions.js.
Constructor Summary
new assertions.Expect
(aStartFrame)
The Expect class implements non-fatal assertions, and can be used in cases when a failing test shouldn't abort the current test function.
Method Summary
Constructor Detail
new assertions.Expect(aStartFrame)
The Expect class implements non-fatal assertions, and can be used in cases
when a failing test shouldn't abort the current test function. That allows
to execute multiple tests in a row.
- Parameters:
- {object} aStartFrame Optional, Default: Components.stack
- Frame to use for logging the test result. If a start frame has been specified, we walk down the stack until a frame with the same filename as the start frame has been found. The next file in the stack will be the frame to use for logging the result.
Method Detail
pass(aMessage)
: boolean
Perform an always passing test
Parameters:
{string} | aMessage | Message to show for the test result. |
Returns:
{boolean} | Always returns true. |
fail(aMessage)
: boolean
Perform an always failing test
Parameters:
{string} | aMessage | Message to show for the test result. |
Returns:
{boolean} | Always returns false. |
ok(aValue, aMessage)
: boolean
Test if the value pass
Parameters:
{boolean|string|number|object} | aValue | Value to test. |
{string} | aMessage | Message to show for the test result. |
Returns:
{boolean} | Result of the test. |
equal(aValue, aExpected, aMessage)
: boolean
Test if both specified values are identical.
Parameters:
{boolean|string|number|object} | aValue | Value to test. |
{boolean|string|number|object} | aExpected | Value to strictly compare with. |
{string} | aMessage | Message to show for the test result |
Returns:
{boolean} | Result of the test. |
notEqual(aValue, aExpected, aMessage)
: boolean
Test if both specified values are not identical.
Parameters:
{boolean|string|number|object} | aValue | Value to test. |
{boolean|string|number|object} | aExpected | Value to strictly compare with. |
{string} | aMessage | Message to show for the test result |
Returns:
{boolean} | Result of the test. |
match(aString, aRegex, aMessage)
: boolean
Test if the regular expression matches the string.
Parameters:
{string} | aString | String to test. |
{RegEx} | aRegex | Regular expression to use for testing that a match exists. |
{string} | aMessage | Message to show for the test result |
Returns:
{boolean} | Result of the test. |
notMatch(aString, aRegex, aMessage)
: boolean
Test if the regular expression does not match the string.
Parameters:
{string} | aString | String to test. |
{RegEx} | aRegex | Regular expression to use for testing that a match does not exist. |
{string} | aMessage | Message to show for the test result |
Returns:
{boolean} | Result of the test. |