Skip to content

Commit a3b92f8

Browse files
authored
Remove unknown context from PredicateTests.Object type name (#1368)
1 parent 1fe187b commit a3b92f8

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

Tests/FoundationEssentialsTests/PredicateTests.swift

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,27 @@ import Foundation
2222
import RegexBuilder
2323
#endif
2424

25+
// These types are non-private and in the global scope to ensure a consistent string type name for the debugDescription() test
26+
struct PredicateTestObject {
27+
var a: Int
28+
var b: String
29+
var c: Double
30+
var d: Int
31+
var e: Character
32+
var f: Bool
33+
var g: [Int]
34+
var h: Date = .now
35+
var i: Any = 3
36+
}
37+
38+
struct PredicateTestObject2 {
39+
var a: Bool
40+
}
41+
2542
@Suite("Predicate")
2643
private struct PredicateTests {
27-
struct Object {
28-
var a: Int
29-
var b: String
30-
var c: Double
31-
var d: Int
32-
var e: Character
33-
var f: Bool
34-
var g: [Int]
35-
var h: Date = .now
36-
var i: Any = 3
37-
}
38-
39-
struct Object2 {
40-
var a: Bool
41-
}
44+
typealias Object = PredicateTestObject
45+
typealias Object2 = PredicateTestObject2
4246

4347
@Test func basic() throws {
4448
let compareTo = 2
@@ -375,7 +379,7 @@ private struct PredicateTests {
375379
let predicateName = _typeName(Predicate<Object>.self)
376380
#expect(
377381
debugDescription ==
378-
"\(predicateName)(variable: (Variable(#)), expression: NilCoalesce(lhs: OptionalFlatMap(wrapped: ConditionalCast(input: KeyPath(root: Variable(#), keyPath: \\Object.i), desiredType: Swift.Int), variable: Variable(#), transform: Equal(lhs: Variable(#), rhs: Value<Swift.Int>(3))), rhs: Equal(lhs: KeyPath(root: Variable(#), keyPath: \\Object.h), rhs: Value<\(dateName)>(\(date.debugDescription)))))"
382+
"\(predicateName)(variable: (Variable(#)), expression: NilCoalesce(lhs: OptionalFlatMap(wrapped: ConditionalCast(input: KeyPath(root: Variable(#), keyPath: \\PredicateTestObject.i), desiredType: Swift.Int), variable: Variable(#), transform: Equal(lhs: Variable(#), rhs: Value<Swift.Int>(3))), rhs: Equal(lhs: KeyPath(root: Variable(#), keyPath: \\PredicateTestObject.h), rhs: Value<\(dateName)>(\(date.debugDescription)))))"
379383
)
380384
}
381385

0 commit comments

Comments
 (0)