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
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@ jobs:
strategy:
matrix:
xcode:
- 12.4
- 12.5
- '13.0'
steps:
- uses: actions/checkout@v2
- name: Select Xcode ${{ matrix.xcode }}
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
- name: Print Swift version
run: swift --version
- name: Run tests
- name: Run tests (Swift)
run: make test-swift
- name: Run tests (platforms)
run: make test-platforms

linux:
name: Ubuntu
Expand Down
67 changes: 67 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/CustomDump_watchOS.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CustomDump"
BuildableName = "CustomDump"
BlueprintName = "CustomDump"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CustomDump"
BuildableName = "CustomDump"
BlueprintName = "CustomDump"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
91 changes: 91 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/swift-custom-dump.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CustomDump"
BuildableName = "CustomDump"
BlueprintName = "CustomDump"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CustomDumpTests"
BuildableName = "CustomDumpTests"
BlueprintName = "CustomDumpTests"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CustomDumpTests"
BuildableName = "CustomDumpTests"
BlueprintName = "CustomDumpTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CustomDump"
BuildableName = "CustomDump"
BlueprintName = "CustomDump"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
42 changes: 41 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
test-all: test-linux test-swift
PLATFORM_IOS = iOS Simulator,name=iPhone 11 Pro Max
PLATFORM_MACOS = macOS
PLATFORM_TVOS = tvOS Simulator,name=Apple TV 4K (at 1080p)
PLATFORM_WATCHOS = watchOS Simulator,name=Apple Watch Series 4 - 44mm

test-all: test-linux test-swift test-platforms

test-linux:
docker run \
Expand All @@ -11,6 +16,41 @@ test-linux:
test-swift:
swift test \
--parallel
swift build \
--configuration release

test-platforms:
xcodebuild test \
-scheme swift-custom-dump \
-destination platform="$(PLATFORM_IOS)"
xcodebuild \
-scheme swift-custom-dump \
-configuration Release \
-destination platform="$(PLATFORM_IOS)"

xcodebuild test \
-scheme swift-custom-dump \
-destination platform="$(PLATFORM_MACOS)"
xcodebuild \
-scheme swift-custom-dump \
-configuration Release \
-destination platform="$(PLATFORM_MACOS)"

xcodebuild test \
-scheme swift-custom-dump \
-destination platform="$(PLATFORM_TVOS)"
xcodebuild \
-scheme swift-custom-dump \
-configuration Release \
-destination platform="$(PLATFORM_TVOS)"

xcodebuild \
-scheme CustomDump_watchOS \
-destination platform="$(PLATFORM_WATCHOS)"
xcodebuild \
-scheme CustomDump_watchOS \
-configuration Release \
-destination platform="$(PLATFORM_WATCHOS)"

format:
swift format --in-place --recursive .
Expand Down
44 changes: 23 additions & 21 deletions Sources/CustomDump/Conformances/CoreMotion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,30 @@
}
}
}
#endif

// @available(iOS, unavailable)
// @available(macOS, unavailable)
// @available(tvOS, unavailable)
// @available(watchOS 7.2, *)
// extension CMFallDetectionEvent.UserResolution: CustomDumpStringConvertible {
// public var customDumpDescription: String {
// switch self {
// case .confirmed:
// return "CMFallDetectionEvent.UserResolution.confirmed"
// case .dismissed:
// return "CMFallDetectionEvent.UserResolution.dismissed"
// case .rejected:
// return "CMFallDetectionEvent.UserResolution.rejected"
// case .unresponsive:
// return "CMFallDetectionEvent.UserResolution.unresponsive"
// @unknown default:
// return
// "CMFallDetectionEvent.UserResolution.(@unknown default, rawValue: \(self.rawValue))"
// }
// }
// }
#if compiler(>=5.5)
@available(iOS, unavailable)
@available(macOS, unavailable)
@available(tvOS, unavailable)
@available(watchOS 7.2, *)
extension CMFallDetectionEvent.UserResolution: CustomDumpStringConvertible {
public var customDumpDescription: String {
switch self {
case .confirmed:
return "CMFallDetectionEvent.UserResolution.confirmed"
case .dismissed:
return "CMFallDetectionEvent.UserResolution.dismissed"
case .rejected:
return "CMFallDetectionEvent.UserResolution.rejected"
case .unresponsive:
return "CMFallDetectionEvent.UserResolution.unresponsive"
@unknown default:
return
"CMFallDetectionEvent.UserResolution.(@unknown default, rawValue: \(self.rawValue))"
}
}
}
#endif

extension CMMotionActivityConfidence: CustomDumpStringConvertible {
Expand Down
37 changes: 18 additions & 19 deletions Sources/CustomDump/Conformances/GameKit.swift
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
#if canImport(GameKit)
import GameKit

#if compiler(>=5.5)
@available(iOS 14, macOS 11, macCatalyst 14, tvOS 14, *)
extension GKAccessPoint.Location: CustomDumpStringConvertible {
public var customDumpDescription: String {
switch self {
case .bottomLeading:
return "GKAccessPoint.Location.bottomLeading"
case .bottomTrailing:
return "GKAccessPoint.Location.bottomTrailing"
case .topLeading:
return "GKAccessPoint.Location.topLeading"
case .topTrailing:
return "GKAccessPoint.Location.topTrailing"
@unknown default:
return "GKAccessPoint.Location.(@unknown default, rawValue: \(self.rawValue))"
#if !os(watchOS)
#if compiler(>=5.5)
@available(iOS 14, macOS 11, macCatalyst 14, tvOS 14, *)
extension GKAccessPoint.Location: CustomDumpStringConvertible {
public var customDumpDescription: String {
switch self {
case .bottomLeading:
return "GKAccessPoint.Location.bottomLeading"
case .bottomTrailing:
return "GKAccessPoint.Location.bottomTrailing"
case .topLeading:
return "GKAccessPoint.Location.topLeading"
case .topTrailing:
return "GKAccessPoint.Location.topTrailing"
@unknown default:
return "GKAccessPoint.Location.(@unknown default, rawValue: \(self.rawValue))"
}
}
}
}
#endif
#endif

#if !os(watchOS)
@available(iOS 5, macCatalyst 13, macOS 10.8, tvOS 9, *)
@available(watchOS, unavailable)
extension GKPlayer.PhotoSize: CustomDumpStringConvertible {
public var customDumpDescription: String {
switch self {
Expand Down
1 change: 0 additions & 1 deletion Sources/CustomDump/Diff.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
/// unchanged lines.
/// - Returns: A string describing any difference detected between values, or `nil` if no difference
/// is detected.
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
public func diff<T>(_ lhs: T, _ rhs: T, format: DiffFormat = .default) -> String? {
var visitedItems: Set<ObjectIdentifier> = []

Expand Down
22 changes: 12 additions & 10 deletions Tests/CustomDumpTests/DiffTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -469,16 +469,18 @@ final class DiffTests: XCTestCase {
}

func testNestedCustomMirror() {
XCTAssertNoDifference(
diff(
NestedDate(date: Date(timeIntervalSince1970: 0)),
NestedDate(date: Date(timeIntervalSince1970: 1))
),
"""
- NestedDate(date: Date(1970-01-01T00:00:00.000Z))
+ NestedDate(date: Date(1970-01-01T00:00:01.000Z))
"""
)
#if compiler(>=5.4)
XCTAssertNoDifference(
diff(
NestedDate(date: Date(timeIntervalSince1970: 0)),
NestedDate(date: Date(timeIntervalSince1970: 1))
),
"""
- NestedDate(date: Date(1970-01-01T00:00:00.000Z))
+ NestedDate(date: Date(1970-01-01T00:00:01.000Z))
"""
)
#endif
}

func testMultilineString() {
Expand Down
Loading