From e1c80b170543adf56dffae9790b023053c72a9b0 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Sat, 16 Mar 2024 02:13:20 +0100 Subject: [PATCH] Implemented the "empty" static constant for the String+Constants extension in the Foundation library. --- .../Sources/Extensions/String+Constants.swift | 18 +++++++++++++ .../Extensions/String+ConstantsTests.swift | 27 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 Libraries/Foundation/Kit/Sources/Extensions/String+Constants.swift create mode 100644 Libraries/Foundation/Test/Tests/Extensions/String+ConstantsTests.swift diff --git a/Libraries/Foundation/Kit/Sources/Extensions/String+Constants.swift b/Libraries/Foundation/Kit/Sources/Extensions/String+Constants.swift new file mode 100644 index 0000000..ab80392 --- /dev/null +++ b/Libraries/Foundation/Kit/Sources/Extensions/String+Constants.swift @@ -0,0 +1,18 @@ +// +// String+Constants.swift +// ReviewsFoundation +// +// Created by Javier Cicchelli on 16/03/2024. +// Copyright © 2024 Röck+Cöde VoF. All rights reserved. +// + +import Foundation + +public extension String { + + // MARK: Constants + + /// A representation of an empty string. + static let empty: String = "" + +} diff --git a/Libraries/Foundation/Test/Tests/Extensions/String+ConstantsTests.swift b/Libraries/Foundation/Test/Tests/Extensions/String+ConstantsTests.swift new file mode 100644 index 0000000..fcd80c7 --- /dev/null +++ b/Libraries/Foundation/Test/Tests/Extensions/String+ConstantsTests.swift @@ -0,0 +1,27 @@ +// +// String+ConstantsTests.swift +// ReviewsFoundationTest +// +// Created by Javier Cicchelli on 16/03/2024. +// Copyright © 2024 Röck+Cöde VoF. All rights reserved. +// + +import ReviewsFoundation +import XCTest + +final class String_ConstantsTests: XCTestCase { + + // MARK: Properties + private var sut: String! + + // MARK: Constants tests + func testEmpty() throws { + // GIVEN + sut = .empty + + // WHEN + // THEN + XCTAssertTrue(sut.isEmpty) + } + +}