Skip to content

Commit

Permalink
public check method, needed for #389
Browse files Browse the repository at this point in the history
  • Loading branch information
jberkel committed Nov 16, 2016
1 parent e177a1d commit bb3b705
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion SQLite/Core/Connection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ public final class Connection {
return success!
}

@discardableResult func check(_ resultCode: Int32, statement: Statement? = nil) throws -> Int32 {
@discardableResult public func check(_ resultCode: Int32, statement: Statement? = nil) throws -> Int32 {
guard let error = Result(errorCode: resultCode, connection: self, statement: statement) else {
return resultCode
}
Expand Down
7 changes: 7 additions & 0 deletions SQLiteTests/ConnectionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -338,4 +338,11 @@ class ConnectionTests : SQLiteTestCase {
AssertThrows(try stmt.run())
}

func test_check_with_successCode_returnsCode() {
try! XCTAssertEqual(SQLITE_OK, db.check(SQLITE_OK))
}

func test_check_with_errorCode_throws() {
XCTAssertThrowsError(try db.check(SQLITE_CONSTRAINT))
}
}

0 comments on commit bb3b705

Please # to comment.