Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Run unit tests inside Xcode playground
//: [Previous](@previous)
import Foundation
import XCTest
struct TodoItem {
let title: String
let dueBy: Date?
init(title: String) {
self.title = title
self.dueBy = nil
}
}
class TodoTests: XCTestCase {
override func setUp() {
super.setUp()
}
override func tearDown() {
super.tearDown()
}
func testTodo() {
let taskTitle = "finish laundry"
let todo = TodoItem(title: taskTitle)
XCTAssertEqual(todo.title, taskTitle)
}
}
TodoTests.defaultTestSuite().run()

TodoTests.defaultTestSuite().run()
Should be:
TodoTests.defaultTestSuite.run()

Thanks for the playground!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment