Yarn

1.0.0

🧶 Boolean Expectations
0xLeif/Yarn

What's New

Yarn.v1_0_0

2021-05-09T15:06:26Z

Yarn.v1_0_0

Boolean Expectations

Usage

import Yarn

Example

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

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 couldn’t be completed. (Yarn.Yarn.SomeError error 1.)
}

Yarn

Boolean Expectations

Usage

import Yarn

Example

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

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 couldn’t be completed. (Yarn.Yarn.SomeError error 1.)
}

Description

  • Swift Tools 5.3.0
View More Packages from this Author

Dependencies

Last updated: Sun Sep 04 2022 00:18:14 GMT-0500 (GMT-05:00)