Yarn/README.md

47 lines
823 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Yarn
*Boolean Expectations*
## Usage
```swift
import Yarn
```
### Example
```swift
func someFunction() throws -> Bool {
true
}
Yarn.expectFunctionToReturnTrue(someFunction)
Yarn.expectClosureToReturnFalse {
false
}
```
### Example Output
```
5/9/21, 10:02 AM [yarn.console.log.expectation] ✅: expectFunctionToReturnTrue
5/9/21, 10:02 AM [yarn.console.log.expectation] ❌: expectClosureToReturnFalse
```
### Example Error
```swift
func someThrowingFunction() throws -> Bool {
throw Yarn.SomeError.expectedError
}
Yarn.expectFunctionToThrowAnError(someThrowingFunction)
```
### Error Output
```
5/9/21, 10:02 AM [yarn.console.log.expectation] 🚨: expectFunctionToThrowAnError
{
SomeError(message: "expectedError"): The operation couldnt be completed. (Yarn.Yarn.SomeError error 1.)
}
```