Skip to content

ChouTi is a repository of Swift packages that provides frameworks, utilities and extensions to enhance development on iOS and macOS.

License

Notifications You must be signed in to change notification settings

honghaoz/ChouTi

Repository files navigation

ChouTi

build swift platforms

ChouTi is a repository of Swift packages that provides frameworks, utilities and extensions to enhance development on iOS and macOS.

Installation

Swift Package Manager

Add the following to your Package.swift file:

dependencies: [
  // add the package to your package dependencies
  .package(url: "https://github.com/honghaoz/ChouTi", from: "0.0.4"),
],
targets: [
  // add products to your target dependencies
  .target(
    name: "MyTarget",
    dependencies: [
      .product(name: "ChouTi", package: "ChouTi"),
    ]
  ),
  .testTarget(
    name: "MyTargetTests",
    dependencies: [
      .product(name: "ChouTiTest", package: "ChouTi"),
    ]
  ),
]

Packages

ChouTi

codecov

ChouTi is a Swift framework that provides common utilities and extensions to enhance development on iOS and macOS.

import ChouTi

...

ChouTiTest

codecov

ChouTiTest is a Swift testing framework for writing tests with simple, expressive syntax.

import ChouTiTest

class SomeTests: XCTestCase {

  func testExample() throws {

    // boolean
    expect(expression).to(beTrue())
    expect(expression) == true
    expect(expression).to(beFalse())
    expect(expression) == false
    expect(expression).toNot(beTrue())
    expect(expression) != true

    // collection
    expect(expression).to(beEmpty())
    expect(expression).toNot(beEmpty())

    // equal
    expect(expression).to(beEqual(to: 2))
    expect(expression) == 2
    expect(expression).toNot(beEqual(to: 2))
    expect(expression) != 2
    expect(expression).to(beApproximatelyEqual(to: 2, within: 1e-6))
    expect(expression).toNot(beApproximatelyEqual(to: 2, within: 1e-6))

    // identical
    expect(expression).to(beIdentical(to: object))
    expect(expression) === object

    // nil
    expect(expression).to(beNil())
    expect(expression) == nil
    expect(expression).toNot(beNil())
    expect(expression) != nil

    // unwrap
    try expect(unwrap(expression)) == expectedValue

    // error
    expect(try expression()).to(throwError(SomeError.error))
    expect(try expression()).toNot(throwError(SomeError.error))

    // error type
    expect(try expression()).to(throwErrorOfType(SomeError.self))

    // any error
    expect(try expression()).to(throwAnError())

    // eventually
    expect(expression).toEventually(beTrue())
    expect(expression).toEventually(beEmpty())
    expect(expression).toEventually(beEqual(to: 2))
    expect(expression).toEventually(beIdentical(to: object))

    expect(expression).toEventuallyNot(beTrue())
    expect(expression).toEventuallyNot(beEmpty())
  }
}

About

ChouTi is a repository of Swift packages that provides frameworks, utilities and extensions to enhance development on iOS and macOS.

Topics

Resources

License

Stars

Watchers

Forks