From ad2770264f233e0571fd3c751fcf77cd23cbb695 Mon Sep 17 00:00:00 2001 From: Niklas Nickel Date: Wed, 25 May 2022 00:32:30 +0200 Subject: [PATCH] Make import XCTest only active in debug mode --- Package.swift | 3 +-- Sources/SI/Precondition.swift | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Package.swift b/Package.swift index b38162d..562a5f9 100644 --- a/Package.swift +++ b/Package.swift @@ -15,8 +15,7 @@ let package = Package( targets: [ .target( name: "SI", - dependencies: [], - exclude: ["Tests"]), + dependencies: []), .testTarget( name: "SITests", diff --git a/Sources/SI/Precondition.swift b/Sources/SI/Precondition.swift index ff081b7..aa7accd 100644 --- a/Sources/SI/Precondition.swift +++ b/Sources/SI/Precondition.swift @@ -4,9 +4,9 @@ /// At runtime while performing an XCTest, it will be changed to a different function in order to evaluate its output. /// Adapted from Nikolaj Schumacher (@nschum) +#if DEBUG import XCTest -#if DEBUG func precondition(_ condition: @autoclosure () -> Bool, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line) { preconditionClosure(condition(), message(), file, line) }