testing.asserts

Classes


Public Protected Private

Global Functions

goog.testing.asserts.callWithoutLogging(fn)
Runs a function in an environment where test failures are not logged. This is useful for testing test code, where failures can be a normal part of a test.
Arguments:
fn : function() : void
Function to run without logging failures.
code »
goog.testing.asserts.contains_(containercontained) boolean
Tells whether the array contains the given element.
Arguments:
container : goog.testing.asserts.ArrayLike
The array to find the element in.
contained : *
Element to find.
Returns: boolean  Whether the element is in the array.
code »
goog.testing.asserts.findDifferences(expectedactualopt_equalityPredicate) ?string
Determines if two items of any type match, and formulates an error message if not.
Arguments:
expected : *
Expected argument to match.
actual : *
Argument as a result of performing the test.
opt_equalityPredicate : (function(string, *, *): ?string)=
An optional function that can be used to check equality of variables. It accepts 3 arguments: type-of-variables, var1, var2 (in that order) and returns an error message if the variables are not equal, goog.testing.asserts.EQUALITY_PREDICATE_VARS_ARE_EQUAL if the variables are equal, or goog.testing.asserts.EQUALITY_PREDICATE_CANT_PROCESS if the predicate couldn't check the input variables. The function will be called only if the types of var1 and var2 are identical.
Returns: ?string  Null on success, error message on failure.
code »
goog.testing.asserts.getDefaultErrorMsg_(expectedactual) string
No description.
Arguments:
expected : *
The expected value.
actual : *
The actual value.
Returns: string  A failure message of the values don't match.
code »
goog.testing.asserts.indexOf_(containercontained) number
Finds the position of the first occurrence of an element in a container.
Arguments:
container : goog.testing.asserts.ArrayLike
The array to find the element in.
contained : *
Element to find.
Returns: number  Index of the first occurrence or -1 if not found.
code »
goog.testing.asserts.isArrayIndexProp_(prop) boolean
Helper function for assertObjectEquals.
Arguments:
prop : string
A property name.
Returns: boolean  If the property name is an array index.
code »
goog.testing.asserts.numberRoughEqualityPredicate_(var1var2tolerance) boolean
Compares equality of two numbers, allowing them to differ up to a given tolerance.
Arguments:
var1 : number
A number.
var2 : number
A number.
tolerance : number
the maximum allowed difference.
Returns: boolean  Whether the two variables are sufficiently close.
code »
goog.testing.asserts.raiseException(commentopt_message)
Raises a JsUnit exception with the given comment.
Arguments:
comment : string
A summary for the exception.
opt_message : string=
A description of the exception.
code »
goog.testing.asserts.toArray_(arrayLike) !Array
Converts an array like object to array or clones it if it's already array.
Arguments:
arrayLike : goog.testing.asserts.ArrayLike
The collection.
Returns: !Array  Copy of the collection as array.
code »

Global Properties

goog.testing.asserts.ArrayLike :
No description.
Code »
goog.testing.asserts.EQUALITY_PREDICATE_CANT_PROCESS :
The return value of the equality predicate passed to findDifferences below, in cases where the predicate can't test the input variables for equality.
Code »
goog.testing.asserts.EQUALITY_PREDICATE_VARS_ARE_EQUAL :
The return value of the equality predicate passed to findDifferences below, in cases where the input vriables are equal.
Code »
goog.testing.asserts.primitiveRoughEqualityPredicates_ :
No description.
Code »

Package testing

Package Reference