Implemented the "bitBucket" static constant for the URL+Constants extension in the Foundation library.

This commit is contained in:
Javier Cicchelli 2024-03-17 16:38:47 +01:00
parent 8312bae8d3
commit ab81347b22
3 changed files with 58 additions and 2 deletions

View File

@ -0,0 +1,29 @@
//
// URL+Constants.swift
// ReviewsFoundationKit
//
// Created by Javier Cicchelli on 17/03/2024.
// Copyright © 2024 Röck+Cöde VoF. All rights reserved.
//
import Foundation
extension URL {
// MARK: Constants
public static let bitBucket: URL = {
if #available(iOS 16.0, *) {
.init(filePath: .FilePath.bitBucket)
} else {
.init(fileURLWithPath: .FilePath.bitBucket)
}
}()
}
// MARK: - String+Constants
private extension String {
enum FilePath {
static let bitBucket = "/dev/null"
}
}

View File

@ -6,7 +6,7 @@
// Copyright © 2024 Röck+Cöde VoF. All rights reserved.
//
import ReviewsFoundation
import ReviewsFoundationKit
import XCTest
final class String_ConstantsTests: XCTestCase {
@ -15,7 +15,7 @@ final class String_ConstantsTests: XCTestCase {
private var sut: String!
// MARK: Constants tests
func testEmpty() throws {
func testEmpty() {
// GIVEN
sut = .empty

View File

@ -0,0 +1,27 @@
//
// URL+ConstantsTests.swift
// ReviewsFoundationTest
//
// Created by Javier Cicchelli on 17/03/2024.
// Copyright © 2024 Röck+Cöde VoF. All rights reserved.
//
import Foundation
import ReviewsFoundationKit
import XCTest
final class URL_ConstantsTests: XCTestCase {
// MARK: Properties
private var sut: URL!
// MARK: Constants tests
func testBitBucket() {
sut = .bitBucket
// WHEN
// THEN
XCTAssertEqual(sut.absoluteString, "file:///dev/null")
}
}