Skip to content

Commit d37f785

Browse files
authored
Merge branch 'main' into android-ci
2 parents 8b7119a + cc158b5 commit d37f785

File tree

6 files changed

+37
-4
lines changed

6 files changed

+37
-4
lines changed

.github/assert-no-difference.png

170 KB
Loading

.github/expect.png

176 KB
Loading

.github/workflows/ci.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
run: make test-linux SWIFT_VERSION=${{ matrix.swift }}
4444

4545
wasm:
46-
name: SwiftWasm
46+
name: Wasm
4747
runs-on: ubuntu-latest
4848
steps:
4949
- uses: actions/checkout@v4
@@ -52,10 +52,11 @@ jobs:
5252
run: |
5353
PREFIX=/opt/swift
5454
set -ex
55-
curl -f -o /tmp/swift.tar.gz "https://download.swift.org/swift-6.0.2-release/ubuntu2204/swift-6.0.2-RELEASE/swift-6.0.2-RELEASE-ubuntu22.04.tar.gz"
55+
curl -f -o /tmp/swift.tar.gz "https://download.swift.org/swift-6.0.3-release/ubuntu2204/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE-ubuntu22.04.tar.gz"
5656
sudo mkdir -p $PREFIX; sudo tar -xzf /tmp/swift.tar.gz -C $PREFIX --strip-component 1
57-
$PREFIX/usr/bin/swift sdk install https://github.com/swiftwasm/swift/releases/download/swift-wasm-6.0.2-RELEASE/swift-wasm-6.0.2-RELEASE-wasm32-unknown-wasi.artifactbundle.zip --checksum 6ffedb055cb9956395d9f435d03d53ebe9f6a8d45106b979d1b7f53358e1dcb4
57+
$PREFIX/usr/bin/swift sdk install https://github.com/swiftwasm/swift/releases/download/swift-wasm-6.0.3-RELEASE/swift-wasm-6.0.3-RELEASE-wasm32-unknown-wasi.artifactbundle.zip --checksum 31d3585b06dd92de390bacc18527801480163188cd7473f492956b5e213a8618
5858
echo "$PREFIX/usr/bin" >> $GITHUB_PATH
59+
5960
- name: Build
6061
run: swift build --swift-sdk wasm32-unknown-wasi -Xlinker -z -Xlinker stack-size=$((1024 * 1024))
6162
- name: Run tests
@@ -85,4 +86,4 @@ jobs:
8586
steps:
8687
- uses: actions/checkout@v4
8788
- name: "Test Swift Package on Android"
88-
uses: skiptools/swift-android-action@v2
89+
uses: skiptools/swift-android-action@v2

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,25 @@ For a real world use case we modified Apple's [Landmarks](https://developer.appl
253253

254254
### `expectNoDifference`
255255

256+
<table>
257+
<tr>
258+
<th>expectNoDifference</th>
259+
<th>#expect</th>
260+
</tr>
261+
<tr valign=top>
262+
<td width=50%>
263+
264+
![](.github/assert-no-difference.png)
265+
266+
</td>
267+
<td width=50%>
268+
269+
![](.github/expect.png)
270+
271+
</td>
272+
</tr>
273+
</table>
274+
256275
XCTest's `XCTAssertEqual` and Swift Testing's `#expect(_ == _)` both allow you to assert that two values are equal, and if they are not the test suite will fail with a message:
257276

258277
```swift

Sources/CustomDump/Internal/Mirror.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ extension Mirror {
2828

2929
func isMirrorEqual(_ lhs: Any, _ rhs: Any) -> Bool {
3030
guard let lhs = lhs as? any Equatable else {
31+
let lhsType = type(of: lhs)
32+
if lhsType is AnyClass, lhsType == type(of: rhs), lhs as AnyObject === rhs as AnyObject {
33+
return true
34+
}
3135
let lhsMirror = Mirror(customDumpReflecting: lhs)
3236
let rhsMirror = Mirror(customDumpReflecting: rhs)
3337
guard

Tests/CustomDumpTests/DiffTests.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,15 @@ final class DiffTests: XCTestCase {
12901290
"""
12911291
)
12921292
}
1293+
1294+
func testRecursion() {
1295+
class Object {
1296+
var child: Object?
1297+
}
1298+
let object = Object()
1299+
object.child = object
1300+
XCTAssertNil(diff(object, object))
1301+
}
12931302
}
12941303

12951304
private class Shared: _CustomDiffObject, Equatable {

0 commit comments

Comments
 (0)