From 0315fa981bc0d391aa3f45e195af4444d81d203a Mon Sep 17 00:00:00 2001 From: Kamil Strzelecki Date: Fri, 16 May 2025 13:35:52 +0200 Subject: [PATCH] Removed Algorithms dependency --- Package.resolved | 24 +++---------------- Package.swift | 12 ---------- Sources/Probing/Errors/ProbingErrors.swift | 3 +-- .../Helpers/Array+Product.swift | 18 ++++++++++++++ .../Suites/EffectTests.swift | 1 - .../Suites/IndependentEffectsTests.swift | 1 - .../Suites/NestedEffectsTests.swift | 3 +-- .../Suites/ProbingOptionsTests.swift | 1 - 8 files changed, 23 insertions(+), 40 deletions(-) create mode 100644 Tests/ProbeTestingTests/Helpers/Array+Product.swift diff --git a/Package.resolved b/Package.resolved index 59bd1e3..9051c7c 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "3c4f50eb2486121f00c308626fcdd9c864894f1af2662c1319872a67f76ae93c", + "originHash" : "2d6c8f9a49998eeeee25872d971d637bcc871153998138008826624e814a9650", "pins" : [ { "identity" : "principle", @@ -15,26 +15,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/NSFatalError/PrincipleMacros", "state" : { - "revision" : "6381001399379bcbe787f20f13ff5a3b9ff3ef7c", - "version" : "1.0.4" - } - }, - { - "identity" : "swift-algorithms", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-algorithms", - "state" : { - "revision" : "87e50f483c54e6efd60e885f7f5aa946cee68023", - "version" : "1.2.1" - } - }, - { - "identity" : "swift-numerics", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-numerics.git", - "state" : { - "revision" : "e0ec0f5f3af6f3e4d5e7a19d2af26b481acb6ba8", - "version" : "1.0.3" + "revision" : "b2671db08bc28ee2336bd33517a524de4abeb92a", + "version" : "1.0.6" } }, { diff --git a/Package.swift b/Package.swift index c5a44ba..ccefc00 100644 --- a/Package.swift +++ b/Package.swift @@ -82,10 +82,6 @@ let package = Package( .package( url: "https://github.com/swiftlang/swift-syntax", "600.0.0" ..< "602.0.0" - ), - .package( - url: "https://github.com/apple/swift-algorithms", - from: "1.2.0" ) ], targets: [ @@ -105,10 +101,6 @@ let package = Package( .product( name: "PrincipleConcurrency", package: "Principle" - ), - .product( - name: "Algorithms", - package: "swift-algorithms" ) ] ) @@ -122,10 +114,6 @@ let package = Package( .product( name: "PrincipleCollections", package: "Principle" - ), - .product( - name: "Algorithms", - package: "swift-algorithms" ) ] ) + macroTargets( diff --git a/Sources/Probing/Errors/ProbingErrors.swift b/Sources/Probing/Errors/ProbingErrors.swift index e56dcd9..b9a900a 100644 --- a/Sources/Probing/Errors/ProbingErrors.swift +++ b/Sources/Probing/Errors/ProbingErrors.swift @@ -6,7 +6,6 @@ // Copyright © 2025 Kamil Strzelecki. All rights reserved. // -import Algorithms import PrincipleCollections internal enum ProbingErrors {} @@ -216,7 +215,7 @@ extension ProbingErrors { apiMisuseDescription( subsystem: "probe", attempt: "install probe", - backtraces: [backtrace, preexisting].compacted() + backtraces: [backtrace, preexisting].lazy.compactMap(\.self) ) } } diff --git a/Tests/ProbeTestingTests/Helpers/Array+Product.swift b/Tests/ProbeTestingTests/Helpers/Array+Product.swift new file mode 100644 index 0000000..012ccc6 --- /dev/null +++ b/Tests/ProbeTestingTests/Helpers/Array+Product.swift @@ -0,0 +1,18 @@ +// +// Array+Product.swift +// Probing +// +// Created by Kamil Strzelecki on 16/05/2025. +// Copyright © 2025 Kamil Strzelecki. All rights reserved. +// + +internal func product( + _ first: some Sequence, + _ second: some Sequence +) -> [(A, B)] { + first.flatMap { first in + second.lazy.map { second in + (first, second) + } + } +} diff --git a/Tests/ProbeTestingTests/Suites/EffectTests.swift b/Tests/ProbeTestingTests/Suites/EffectTests.swift index 1515edd..1ee02f8 100644 --- a/Tests/ProbeTestingTests/Suites/EffectTests.swift +++ b/Tests/ProbeTestingTests/Suites/EffectTests.swift @@ -8,7 +8,6 @@ @testable import ProbeTesting @testable import Probing -import Algorithms import Testing internal class EffectTests { diff --git a/Tests/ProbeTestingTests/Suites/IndependentEffectsTests.swift b/Tests/ProbeTestingTests/Suites/IndependentEffectsTests.swift index 443639f..0b8c37c 100644 --- a/Tests/ProbeTestingTests/Suites/IndependentEffectsTests.swift +++ b/Tests/ProbeTestingTests/Suites/IndependentEffectsTests.swift @@ -8,7 +8,6 @@ @testable import ProbeTesting @testable import Probing -import Algorithms import Testing internal final class IndependentEffectsTests: EffectTests { diff --git a/Tests/ProbeTestingTests/Suites/NestedEffectsTests.swift b/Tests/ProbeTestingTests/Suites/NestedEffectsTests.swift index 052e2b2..9e6a8c1 100644 --- a/Tests/ProbeTestingTests/Suites/NestedEffectsTests.swift +++ b/Tests/ProbeTestingTests/Suites/NestedEffectsTests.swift @@ -8,7 +8,6 @@ @testable import ProbeTesting @testable import Probing -import Algorithms import Testing internal final class NestedEffectsTests: EffectTests { @@ -94,7 +93,7 @@ internal final class NestedEffectsTests: EffectTests { } @Test( - arguments: Array(product(1 ..< 3, 1 ..< 3)), + arguments: product(1 ..< 3, 1 ..< 3), 1 ..< 3 ) func testRunningToProbe( diff --git a/Tests/ProbeTestingTests/Suites/ProbingOptionsTests.swift b/Tests/ProbeTestingTests/Suites/ProbingOptionsTests.swift index 8ee3afd..2e3a0bd 100644 --- a/Tests/ProbeTestingTests/Suites/ProbingOptionsTests.swift +++ b/Tests/ProbeTestingTests/Suites/ProbingOptionsTests.swift @@ -8,7 +8,6 @@ @testable import ProbeTesting @testable import Probing -import Algorithms import PrincipleConcurrency import Testing