core.
Result
¶type core.Result = Success
title: Array<String>
duration: Duration
log: Array<LogEntry>
Failure
title: Array<String>
exception: Any
duration: Duration
log: Array<LogEntry>
Ignored
title: Array<String>
implements
Equality, Setter<Result>, ToString, Extractor, Cata
methods
-- Creating instances
new Result.Success(Array<String>, Duration, Array<LogEntry>) -> Result
new Result.Failure(Array<String>, Any, Duration, Array<LogEntry>) -> Result
new Result.Ignored(Array<String>) -> Result
Success.create: { ρ | Success } -> Result
Failure.create: { ρ | Failure } -> Result
Ignored.create: { ρ | Ignored } -> Result
Success.set: { ρ | α >: Success } -> Result
Failure.set: { ρ | α >: Failure } -> Result
Ignored.set: { ρ | α >: Ignored } -> Result
-- Comparing and testing
equals: @Result => Result -> Boolean
isSuccess: @Result => Boolean
isFailure: @Result => Boolean
isIgnored: @Result => Boolean
-- Converting to other types
toString: @Result => Void -> String
-- Transforming results
cata: @Result => Pattern -> α
where type Pattern
Success: (Array<String>, Duration, Array<LogEntry>) -> α
Failure: (Array<String>, Any, Duration, Array<LogEntry>) -> α
Ignored: Array<String> -> α
-- Extracting information
fullTitle: @Result => Void -> String
name: @Result => Void -> String
Represents the results of each tests.
Result.
create
(values)¶Returns: | Constructs a new Result instance. |
---|
Success.create: { ρ | Success } -> Result
Failure.create: { ρ | Failure } -> Result
Ignored.create: { ρ | Ignored } -> Result
Result.
set
(values)¶Returns: | A shallow copy of the Result with the given fields updated. |
---|
@Success => { ρ | α >: Success } -> Result
@Failure => { ρ | α >: Failure } -> Result
@Ignored => { ρ | α >: Ignored } -> Result
Result.
equals
(aResult)¶Returns: | true if both Result objects are the same object. |
---|
@Result => Result -> Boolean
Compares two Result objects using reference equality.
Result.
isSuccess
¶Boolean
true
if the Result object has a Success
tag.
Result.
isFailure
¶Boolean
true
if the Result object has a Failure
tag.
Result.
isIgnored
¶Boolean
true
if the Result object has an Ignored
tag.
Result.
toString
()¶Returns: | A textual representation of the Result object |
---|
@Result => Void -> String
Result.
cata
(aPattern)¶Returns: | The transformation for the Result’s tag. |
---|
@Result => Pattern -> α
type Pattern
Success: (Array<String>, Duration, Array<LogEntry>) -> α
Failure: (Array<String>, Any, Duration, Array<LogEntry>) -> α
Ignored: Array<String> -> α
The catamorphism function provides a form of pattern matching and structure-based transformation for the Result ADT. Your code should provide a transformation for each one of the possible cases in the ADT, and the values will be passed as arguments to the function you provide.
Note
If you’re using the Sparkler library for Sweet.js, it’s also possible to pattern match on the Signal objects directly, since they implement the Extractor interface.
Result.
fullTitle
()¶Returns: | The full title of the Test that yielded this result |
---|
@Result => Void -> String
Returns a space-separated string containing the entire path to the test that resulted in this result, starting from the root.
Result.
name
()¶Returns: | The name of the test that yielded this result. |
---|
@Result => Void -> String