Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,22 @@ jobs:
run: make test-linux SWIFT_VERSION=${{ matrix.swift }}

wasm:
name: SwiftWasm
name: Wasm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bytecodealliance/actions/wasmtime/setup@v1
- uses: swiftwasm/setup-swiftwasm@v1
with:
swift-version: "wasm-5.9.2-RELEASE"
- name: Build tests
# Extend the stack size to avoid stack overflow in the test suites
run: swift build --triple wasm32-unknown-wasi --build-tests -Xlinker -z -Xlinker stack-size=$((1024 * 1024))
- name: Run tests
run: wasmtime .build/debug/swift-custom-dumpPackageTests.wasm
- name: Install Swift and Swift SDK for WebAssembly
run: |
PREFIX=/opt/swift
set -ex
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"
sudo mkdir -p $PREFIX; sudo tar -xzf /tmp/swift.tar.gz -C $PREFIX --strip-component 1
$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
echo "$PREFIX/usr/bin" >> $GITHUB_PATH

- name: Build
run: swift build --swift-sdk wasm32-unknown-wasi -Xlinker -z -Xlinker stack-size=$((1024 * 1024))

windows:
name: Windows
Expand Down Expand Up @@ -117,4 +120,4 @@ jobs:
with:
api-level: 29
arch: x86_64
script: ~/test-toolchain.sh
script: ~/test-toolchain.sh
4 changes: 4 additions & 0 deletions Sources/CustomDump/Internal/Mirror.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ extension Mirror {

func isMirrorEqual(_ lhs: Any, _ rhs: Any) -> Bool {
guard let lhs = lhs as? any Equatable else {
let lhsType = type(of: lhs)
if lhsType is AnyClass, lhsType == type(of: rhs), lhs as AnyObject === rhs as AnyObject {
return true
}
let lhsMirror = Mirror(customDumpReflecting: lhs)
let rhsMirror = Mirror(customDumpReflecting: rhs)
guard
Expand Down
9 changes: 9 additions & 0 deletions Tests/CustomDumpTests/DiffTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,15 @@ final class DiffTests: XCTestCase {
"""
)
}

func testRecursion() {
class Object {
var child: Object?
}
let object = Object()
object.child = object
XCTAssertNil(diff(object, object))
}
}

private class Shared: _CustomDiffObject, Equatable {
Expand Down