Skip to content

Commit daf25ec

Browse files
authored
Resolve Swift Testing API breakage (#149)
Updates usages of `#expect` that included a custom string interpolation in a `Comment` to use `Command.init(rawValue:)`.
1 parent 399bbf7 commit daf25ec

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

Tests/MMIOInterposableTests/Assertions.swift

+5-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ func assertMMIOAlignment<Value>(
2020
let alignment = UInt(MemoryLayout<Value>.alignment)
2121
#expect(
2222
address.isMultiple(of: alignment),
23-
"""
24-
Invalid load or store of type '\(Value.self)' from unaligned address \
25-
'\(hex: address)'
26-
""",
23+
Comment(
24+
rawValue: """
25+
Invalid load or store of type '\(Value.self)' from unaligned address \
26+
'\(hex: address)'
27+
"""),
2728
sourceLocation: sourceLocation)
2829
}
2930

Tests/MMIOTests/Assertions.swift

+20-18
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@ func assertExtract<Storage>(
2323
let actual = storage[bits: bitRanges]
2424
#expect(
2525
actual == expected,
26-
"""
27-
Extracting value \
28-
from '\(hex: storage)' \
29-
at bit ranges \(bitRanges
30-
.map { "\($0.lowerBound)..<\($0.upperBound)" }
31-
.joined(separator: ", "))] \
32-
resulted in '\(hex: actual)', \
33-
but expected '\(hex: expected)'
34-
""",
26+
Comment(
27+
rawValue: """
28+
Extracting value \
29+
from '\(hex: storage)' \
30+
at bit ranges \(bitRanges
31+
.map { "\($0.lowerBound)..<\($0.upperBound)" }
32+
.joined(separator: ", "))] \
33+
resulted in '\(hex: actual)', \
34+
but expected '\(hex: expected)'
35+
"""),
3536
sourceLocation: sourceLocation)
3637
}
3738

@@ -46,14 +47,15 @@ func assertInsert<Storage>(
4647
actual[bits: bitRanges] = value
4748
#expect(
4849
actual == expected,
49-
"""
50-
Inserting '\(hex: value)' \
51-
into '\(hex: storage)' \
52-
at bit ranges [\(bitRanges
53-
.map { "\($0.lowerBound)..<\($0.upperBound)" }
54-
.joined(separator: ", "))] \
55-
resulted in '\(hex: actual)', \
56-
but expected to get '\(hex: expected)'
57-
""",
50+
Comment(
51+
rawValue: """
52+
Inserting '\(hex: value)' \
53+
into '\(hex: storage)' \
54+
at bit ranges [\(bitRanges
55+
.map { "\($0.lowerBound)..<\($0.upperBound)" }
56+
.joined(separator: ", "))] \
57+
resulted in '\(hex: actual)', \
58+
but expected to get '\(hex: expected)'
59+
"""),
5860
sourceLocation: sourceLocation)
5961
}

0 commit comments

Comments
 (0)