From cd0dccc066bb768ba17d6f073847aa0c5c88296a Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Tue, 21 Sep 2021 08:53:23 -0400 Subject: [PATCH 1/8] Run CI tests on Mac Catalyst. --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile b/Makefile index 1429e73..5483c01 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ PLATFORM_IOS = iOS Simulator,name=iPhone 11 Pro Max PLATFORM_MACOS = macOS +PLATFORM_MAC_CATALYST = macOS,variant=Mac Catalyst PLATFORM_TVOS = tvOS Simulator,name=Apple TV 4K (at 1080p) PLATFORM_WATCHOS = watchOS Simulator,name=Apple Watch Series 4 - 44mm @@ -36,6 +37,14 @@ test-platforms: -configuration Release \ -destination platform="$(PLATFORM_MACOS)" + xcodebuild test \ + -scheme swift-custom-dump \ + -destination platform="$(PLATFORM_MAC_CATALYST)" + xcodebuild \ + -scheme swift-custom-dump \ + -configuration Release \ + -destination platform="$(PLATFORM_MAC_CATALYST)" + xcodebuild test \ -scheme swift-custom-dump \ -destination platform="$(PLATFORM_TVOS)" From 833d107e874c18b33d0e903b778982cd1cfbcbfa Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Tue, 21 Sep 2021 09:45:38 -0400 Subject: [PATCH 2/8] fix windows --- Tests/CustomDumpTests/DumpTests.swift | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Tests/CustomDumpTests/DumpTests.swift b/Tests/CustomDumpTests/DumpTests.swift index 1d21a89..b4c4036 100644 --- a/Tests/CustomDumpTests/DumpTests.swift +++ b/Tests/CustomDumpTests/DumpTests.swift @@ -715,12 +715,6 @@ final class DumpTests: XCTestCase { ) } - class SubclassedError: NSError {} - - enum BridgedError: Error { - case thisIsFine(Int) - } - func testFoundation() { var dump = "" @@ -932,6 +926,9 @@ final class DumpTests: XCTestCase { """ ) + #if !os(Windows) + class SubclassedError: NSError {} + dump = "" customDump( SubclassedError( @@ -955,6 +952,11 @@ final class DumpTests: XCTestCase { ) """ ) + #endif + + enum BridgedError: Error { + case thisIsFine(Int) + } dump = "" customDump(BridgedError.thisIsFine(94) as NSError, to: &dump) From 3c9137227cd2df118878931f31256fe49165de9c Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Tue, 21 Sep 2021 10:02:57 -0400 Subject: [PATCH 3/8] fix test --- Tests/CustomDumpTests/DumpTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/CustomDumpTests/DumpTests.swift b/Tests/CustomDumpTests/DumpTests.swift index b4c4036..676ad77 100644 --- a/Tests/CustomDumpTests/DumpTests.swift +++ b/Tests/CustomDumpTests/DumpTests.swift @@ -964,7 +964,7 @@ final class DumpTests: XCTestCase { XCTAssertNoDifference( dump, """ - DumpTests.BridgedError.thisIsFine(94) + DumpTests.(unknown context).(unknown context).BridgedError.thisIsFine(94) """ ) #else From 816c050825b9cd4456cfd110a4a7e380e63fa2dc Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Tue, 21 Sep 2021 22:37:20 -0400 Subject: [PATCH 4/8] wip --- Tests/CustomDumpTests/DumpTests.swift | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Tests/CustomDumpTests/DumpTests.swift b/Tests/CustomDumpTests/DumpTests.swift index 676ad77..bfac141 100644 --- a/Tests/CustomDumpTests/DumpTests.swift +++ b/Tests/CustomDumpTests/DumpTests.swift @@ -13,6 +13,12 @@ import XCTest import SwiftUI #endif +#if os(Windows) + let unknownContext = "." +#else + let unknownContext = ".(unknown context).(unknown context)." +#endif + @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) final class DumpTests: XCTestCase { func testAnyType() { @@ -625,7 +631,7 @@ final class DumpTests: XCTestCase { XCTAssertNoDifference( dump, """ - DumpTests.(unknown context).(unknown context).Inline.self + DumpTests\(unknownContext)Inline.self """ ) @@ -637,7 +643,7 @@ final class DumpTests: XCTestCase { XCTAssertNoDifference( dump, """ - DumpTests.(unknown context).(unknown context).Inline() + DumpTests\(unknownContext)Inline() """ ) } @@ -964,7 +970,7 @@ final class DumpTests: XCTestCase { XCTAssertNoDifference( dump, """ - DumpTests.(unknown context).(unknown context).BridgedError.thisIsFine(94) + DumpTests\(unknownContext)BridgedError.thisIsFine(94) """ ) #else From 10aae52046c8e60c0a77f1a1c78f5839be0e0e97 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Tue, 21 Sep 2021 22:44:02 -0400 Subject: [PATCH 5/8] wip --- Tests/CustomDumpTests/DumpTests.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Tests/CustomDumpTests/DumpTests.swift b/Tests/CustomDumpTests/DumpTests.swift index 54c0724..dc1f755 100644 --- a/Tests/CustomDumpTests/DumpTests.swift +++ b/Tests/CustomDumpTests/DumpTests.swift @@ -979,11 +979,16 @@ final class DumpTests: XCTestCase { dump, """ NSError( - domain: "CustomDumpTests.DumpTests.BridgedError", + domain: "CustomDumpTests.DumpTests\(unknownContext)BridgedError", code: 0, userInfo: [:] ) """ + .replacingOccurrences( + of: #"\(unknown context at \$[[:xdigit:]]+\)"#, + with: "(unknown context)", + options: .regularExpression + ) ) #endif From c152b944f1efc4b9b1591af1e60a3532a13f0bb5 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Tue, 21 Sep 2021 22:45:37 -0400 Subject: [PATCH 6/8] wip --- Tests/CustomDumpTests/DumpTests.swift | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Tests/CustomDumpTests/DumpTests.swift b/Tests/CustomDumpTests/DumpTests.swift index dc1f755..0818e8e 100644 --- a/Tests/CustomDumpTests/DumpTests.swift +++ b/Tests/CustomDumpTests/DumpTests.swift @@ -976,7 +976,11 @@ final class DumpTests: XCTestCase { #else // Can't unwrap bridged Errors on Linux: https://bugs.swift.org/browse/SR-15191 XCTAssertNoDifference( - dump, + dump.replacingOccurrences( + of: #"\(unknown context at \$[[:xdigit:]]+\)"#, + with: "(unknown context)", + options: .regularExpression + ), """ NSError( domain: "CustomDumpTests.DumpTests\(unknownContext)BridgedError", @@ -984,11 +988,6 @@ final class DumpTests: XCTestCase { userInfo: [:] ) """ - .replacingOccurrences( - of: #"\(unknown context at \$[[:xdigit:]]+\)"#, - with: "(unknown context)", - options: .regularExpression - ) ) #endif From c1506f06e25f9831eba2718b4b470ed7eb2461aa Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Tue, 21 Sep 2021 22:50:17 -0400 Subject: [PATCH 7/8] test --- Tests/CustomDumpTests/DumpTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/CustomDumpTests/DumpTests.swift b/Tests/CustomDumpTests/DumpTests.swift index 0818e8e..fef9d00 100644 --- a/Tests/CustomDumpTests/DumpTests.swift +++ b/Tests/CustomDumpTests/DumpTests.swift @@ -14,7 +14,7 @@ import XCTest #endif #if os(Windows) - let unknownContext = "." + let unknownContext = ".(unknown context).(unknown context)." #else let unknownContext = ".(unknown context).(unknown context)." #endif From 2fc8ec9430b8eee8049b009482d76b88ec2b80de Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Tue, 21 Sep 2021 22:54:28 -0400 Subject: [PATCH 8/8] fix --- Tests/CustomDumpTests/DumpTests.swift | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Tests/CustomDumpTests/DumpTests.swift b/Tests/CustomDumpTests/DumpTests.swift index fef9d00..7653eaf 100644 --- a/Tests/CustomDumpTests/DumpTests.swift +++ b/Tests/CustomDumpTests/DumpTests.swift @@ -13,12 +13,6 @@ import XCTest import SwiftUI #endif -#if os(Windows) - let unknownContext = ".(unknown context).(unknown context)." -#else - let unknownContext = ".(unknown context).(unknown context)." -#endif - @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) final class DumpTests: XCTestCase { func testAnyType() { @@ -631,7 +625,7 @@ final class DumpTests: XCTestCase { XCTAssertNoDifference( dump, """ - DumpTests\(unknownContext)Inline.self + DumpTests.(unknown context).(unknown context).Inline.self """ ) @@ -643,7 +637,7 @@ final class DumpTests: XCTestCase { XCTAssertNoDifference( dump, """ - DumpTests\(unknownContext)Inline() + DumpTests.(unknown context).(unknown context).Inline() """ ) } @@ -970,7 +964,7 @@ final class DumpTests: XCTestCase { XCTAssertNoDifference( dump, """ - DumpTests\(unknownContext)BridgedError.thisIsFine(94) + DumpTests.(unknown context).(unknown context).BridgedError.thisIsFine(94) """ ) #else @@ -983,7 +977,7 @@ final class DumpTests: XCTestCase { ), """ NSError( - domain: "CustomDumpTests.DumpTests\(unknownContext)BridgedError", + domain: "CustomDumpTests.DumpTests.(unknown context).(unknown context).BridgedError", code: 0, userInfo: [:] )