Skip to content

Commit

Permalink
Use consistent formatting for discardableResult
Browse files Browse the repository at this point in the history
  • Loading branch information
jmp committed Jan 31, 2021
1 parent 89b4707 commit 22235be
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
6 changes: 4 additions & 2 deletions Sources/AssertThat/Extensions/Bool.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import XCTest

public extension Assertion where Subject == Bool {
@discardableResult func isTrue(file: StaticString = #filePath, line: UInt = #line) -> Self {
@discardableResult
func isTrue(file: StaticString = #filePath, line: UInt = #line) -> Self {
XCTAssertTrue(subject, file: file, line: line)
return self
}

@discardableResult func isFalse(file: StaticString = #filePath, line: UInt = #line) -> Self {
@discardableResult
func isFalse(file: StaticString = #filePath, line: UInt = #line) -> Self {
XCTAssertFalse(subject, file: file, line: line)
return self
}
Expand Down
6 changes: 4 additions & 2 deletions Sources/AssertThat/Extensions/Optional.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import XCTest

public extension Assertion where Subject == Any? {
@discardableResult func isNil(file: StaticString = #filePath, line: UInt = #line) -> Self {
@discardableResult
func isNil(file: StaticString = #filePath, line: UInt = #line) -> Self {
XCTAssertNil(subject, file: file, line: line)
return self
}

@discardableResult func isNotNil(file: StaticString = #filePath, line: UInt = #line) -> Self {
@discardableResult
func isNotNil(file: StaticString = #filePath, line: UInt = #line) -> Self {
XCTAssertNotNil(subject, file: file, line: line)
return self
}
Expand Down
13 changes: 3 additions & 10 deletions Sources/AssertThat/Extensions/StringProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,7 @@ public extension Assertion where Subject: StringProtocol {
}

@discardableResult
func matches(
_ pattern: String,
file: StaticString = #filePath,
line: UInt = #line
) -> Self {
func matches(_ pattern: String, file: StaticString = #filePath, line: UInt = #line) -> Self {
XCTAssertTrue(
subject.range(of: pattern, options: .regularExpression, range: nil, locale: nil) != nil,
"\"\(subject)\" does not match \"\(pattern)\"",
Expand All @@ -74,11 +70,8 @@ public extension Assertion where Subject: StringProtocol {
return self
}

@discardableResult func doesNotMatch(
_ pattern: String,
file: StaticString = #filePath,
line: UInt = #line
) -> Self {
@discardableResult
func doesNotMatch(_ pattern: String, file: StaticString = #filePath, line: UInt = #line) -> Self {
XCTAssertFalse(
subject.range(of: pattern, options: .regularExpression, range: nil, locale: nil) != nil,
"\"\(subject)\" matches \"\(pattern)\"",
Expand Down

0 comments on commit 22235be

Please sign in to comment.