Go to file
Zach Eriksen 2e17aaa2c0 Updated tests 2021-05-09 10:07:16 -05:00
.swiftpm/xcode/package.xcworkspace/xcshareddata Initial Commit 2021-05-09 09:09:07 -05:00
Sources/Yarn Yarn.init 2021-05-09 10:05:32 -05:00
Tests/YarnTests Updated tests 2021-05-09 10:07:16 -05:00
.gitignore Initial Commit 2021-05-09 09:09:07 -05:00
LICENSE Yarn.init 2021-05-09 10:05:32 -05:00
Package.resolved Yarn.init 2021-05-09 10:05:32 -05:00
Package.swift Yarn.init 2021-05-09 10:05:32 -05:00
README.md Yarn.init 2021-05-09 10:05:32 -05:00

README.md

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