Skip to content

Commit

Permalink
feat: Testing that TEST flag is set in test targets
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-coye committed Dec 21, 2023
1 parent 893ade6 commit 86ab8ea
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion kDriveCore/Utils/Logging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public enum Logging {
private static func initNetworkLogging() {
#if DEBUG && !TEST
if !Bundle.main.isExtension {
// Atlantis.start(hostName: ProcessInfo.processInfo.environment["hostname"])
Atlantis.start(hostName: ProcessInfo.processInfo.environment["hostname"])
}
#endif
}
Expand Down
36 changes: 36 additions & 0 deletions kDriveTestShared/TestsPreconditions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
Infomaniak Mail - iOS App
Copyright (C) 2022 Infomaniak Network SA
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import XCTest

/// Sanity checks of SWIFT_ACTIVE_COMPILATION_CONDITIONS
final class TestsPreconditions: XCTestCase {
func testTestFlagIsSet() {
// WHEN
#if !TEST
XCTFail("the TEST flag is expected to be set in test target")
#endif
}

func testDebugFlagIsSet() {
// WHEN
#if !DEBUG
XCTFail("the DEBUG flag is expected to be set in test target")
#endif
}
}

0 comments on commit 86ab8ea

Please sign in to comment.