You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
When we are specifically testing a method to succeed, wrap it inside a BKYAssertDoesNotThrow.
func testMakeBlockSuccess() {
let blockFactory = BlockFactory()
blockFactory.load(fromDefaultFiles: .colorDefault)
let block = BKYAssertDoesNotThrow { try blockFactory.makeBlock(name: "colour_picker") }
XCTAssertNotNil(block)
}
For all other cases (ie. setup code), call the method normally and mark the test with throws.
func testWorkspaceAddBlock() throws {
let workspace = Workspace()
// Don't need to wrap this call since it's just setup code
let block = try BlockBuilder(name: "test").makeBlock()
// Wrap with BKYAssertDoesNotThrow() here since this is being tested.
BKYAssertDoesNotThrow { try workspace.addBlockTree(block) }
}
The text was updated successfully, but these errors were encountered:
All
try!
calls should be replaced withtry
.The calls then need to be refactored according to the following rules:
try
call inside aBKYAssertThrow
.BKYAssertDoesNotThrow
.throws
.The text was updated successfully, but these errors were encountered: