Class assertions.Expect
Base class for non-fatal assertions
Defined in: assertions.js.
Constructor Attributes | Constructor Name and Description |
---|---|
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 Attributes | Method Name and Description |
---|---|
equal(aValue, aExpected, aMessage)
Test if both specified values are identical.
|
|
fail(aMessage)
Perform an always failing test
|
|
match(aString, aRegex, aMessage)
Test if the regular expression matches the string.
|
|
notEqual(aValue, aExpected, aMessage)
Test if both specified values are not identical.
|
|
notMatch(aString, aRegex, aMessage)
Test if the regular expression does not match the string.
|
|
ok(aValue, aMessage)
Test if the value pass
|
|
pass(aMessage)
Perform an always passing test
|
Class Detail
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
{boolean}
equal(aValue, aExpected, aMessage)
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.
{boolean}
fail(aMessage)
Perform an always failing test
- Parameters:
- {string} aMessage
- Message to show for the test result.
- Returns:
- {boolean} Always returns false.
{boolean}
match(aString, aRegex, aMessage)
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.
{boolean}
notEqual(aValue, aExpected, aMessage)
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.
{boolean}
notMatch(aString, aRegex, aMessage)
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.
{boolean}
ok(aValue, aMessage)
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.
{boolean}
pass(aMessage)
Perform an always passing test
- Parameters:
- {string} aMessage
- Message to show for the test result.
- Returns:
- {boolean} Always returns true.