Skip to content

Commit

Permalink
chore: update tests to swift testing
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahKamara committed Oct 24, 2024
1 parent dcb3b4a commit 39338c0
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 49 deletions.
15 changes: 7 additions & 8 deletions Tests/CompoundPredicateTests/ArithmeticTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import XCTesting
import Testing
import Foundation


@XCTesting
@Suite
/// Tests for Arithmetic (+, -, \*, /, %) and Unary Minus (-) Operators
struct ArithmeticTests {
Expand Down Expand Up @@ -118,8 +117,8 @@ struct ArithmeticTests {
}
}

extension PredicateExpressions.Variable: Equatable {
public static func == (lhs: Self, rhs: Self) -> Bool {
lhs.key == rhs.key
}
}
//extension PredicateExpressions.Variable: Equatable {
// public static func == (lhs: Self, rhs: Self) -> Bool {
// lhs.key == rhs.key
// }
//}
22 changes: 3 additions & 19 deletions Tests/CompoundPredicateTests/BasicTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTesting
import Testing
@testable import CompoundPredicate
import Foundation

@XCTesting
@Suite
struct BasicTests {
@Test
Expand Down Expand Up @@ -92,23 +92,7 @@ struct BasicTests {
let lhs = Predicate<Bool>({ CustomPredicate(variable: $0) })
let rhs = Predicate<Bool>({ CustomPredicate(variable: $0) })

await confirmation(expectedCount: 2) { confirm in
NotificationCenter.default.addObserver(
forName: .foundationExtensionsRuntimeWarning,
object: nil,
queue: .main
) { notification in
let runtimeWarnMsg = try? #require(notification.userInfo?["message"] as? String)

guard let runtimeWarnMsg else { return }

#expect(runtimeWarnMsg.contains("\(CustomPredicate.self) is not a supported Predicate."))

print("CALLED")
confirm()
}

XCTExpectFailure("Cannot combine unsupported Predicate", strict: true)
withKnownIssue {
_ = [lhs, rhs].disjunction()
}
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/CompoundPredicateTests/BooleanLogicTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTesting
import Testing
import CompoundPredicate
import Foundation

@XCTesting
@Suite
struct BooleanLogicTests {
@Test
Expand Down
4 changes: 2 additions & 2 deletions Tests/CompoundPredicateTests/CastingTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTesting
import Testing
import CompoundPredicate
import Foundation

@XCTesting
@Suite
struct CastingTests {
@Test
Expand Down
4 changes: 2 additions & 2 deletions Tests/CompoundPredicateTests/ComparisonTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTesting
import Testing
import Foundation


@XCTesting
@Suite
struct ComparisonTests {
@Test(arguments: [PredicateExpressions.ComparisonOperator.greaterThan, .greaterThanOrEqual, .lessThan, .lessThanOrEqual])
Expand Down
6 changes: 3 additions & 3 deletions Tests/CompoundPredicateTests/ConditionalTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import XCTesting
import Testing
import Foundation


@XCTesting
@Suite
struct ConditionalLogicTests {
@Test
Expand Down Expand Up @@ -31,3 +30,4 @@ struct ConditionalLogicTests {
#expect(testReplaced.test == replacement)
}
}

4 changes: 2 additions & 2 deletions Tests/CompoundPredicateTests/OptionalTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTesting
import Testing
import CompoundPredicate
import Foundation

@XCTesting
@Suite
struct OptionalTests {
@Test
Expand Down
5 changes: 2 additions & 3 deletions Tests/CompoundPredicateTests/RangeTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import XCTesting
import Testing
import Foundation


@XCTesting
@Suite
struct RangeTests {
@Test
Expand Down
4 changes: 2 additions & 2 deletions Tests/CompoundPredicateTests/SequenceOperationTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTesting
import Testing
import CompoundPredicate
import Foundation

@XCTesting
@Suite
struct SequenceOperationTests {
@Test
Expand Down
4 changes: 2 additions & 2 deletions Tests/CompoundPredicateTests/StringComparisonTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTesting
import Testing
import CompoundPredicate
import Foundation

@XCTesting
@Suite
struct StringComparisonTests {
@Test
Expand Down
4 changes: 2 additions & 2 deletions Tests/CompoundPredicateTests/SubscriptAndMemberTests.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import XCTesting
import Testing
@testable import CompoundPredicate
import Foundation

@XCTesting
@Suite
struct SubscriptAndMemberTests {
@Test
Expand Down
13 changes: 11 additions & 2 deletions Tests/CompoundPredicateTests/Utility/Utility.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Foundation

// MARK: Person
struct Person: PredicateCodableKeyPathProviding {
static var predicateCodableKeyPaths: [String : PartialKeyPath<Person>] = [
struct Person: Sendable, PredicateCodableKeyPathProviding {
static var predicateCodableKeyPaths: [String : any PartialKeyPath<Person> & Sendable] = [
"Person.name": \.name,
"Person.age": \.age,
"Person.isStarred": \.isStarred,
Expand Down Expand Up @@ -148,3 +148,12 @@ fileprivate struct Unknown: CustomStringConvertible {
}
}





extension PredicateExpressions.Variable: @retroactive Equatable {
public static func == (lhs: Self, rhs: Self) -> Bool {
lhs.key == rhs.key
}
}

0 comments on commit 39338c0

Please sign in to comment.