Trust

Swift – DCI Pattern Test Library

Support SPM



  • How to use ?

struct User {
    let name: String = "gitaeklee"
    let email: String = "[email protected]"
}

extension User: Trust { }

    func sum(a: Int, b: Int) -> Int {
        return a + b
    }
    
    func testDCI() {
        let _ = User().describe("user object", { object in
            object.context("with 300 and 200", { context in
                context.it("returns 500", { it in
                    XCTAssertEqual(it.email, "[email protected]")
                    XCTAssertEqual(it.name, "gitaeklee")
                    XCTAssertEqual(sum(a: 300, b: 200), 500)
                })
            })
        })
    }

OUTPUT LOG

@Describe: user object 
	 @Context: with 300 and 200
		 @It: returns 500 
     

GitHub

View Github