This PR refers to the work done on setting the `Core` target as well as implemented some basic features as extension to a pair of `Swift` primitive types. To give further details about this work: - [x] defined the `Core` target; - [x] implemented the **empty** static property and the **isNotEmpty()** function in the `String+Empty` extension; - [x] implemented the **init(_: )** initialiser fo strings in the `Bool+Init` extension; Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Reviewed-on: #1
56 lines
997 B
Swift
56 lines
997 B
Swift
//
|
|
// String+EmptyTests.swift
|
|
// Core
|
|
//
|
|
// Created by Javier Cicchelli on 15/04/2023.
|
|
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
|
//
|
|
|
|
import Core
|
|
import XCTest
|
|
|
|
final class String_EmptyTests: XCTestCase {
|
|
|
|
// MARK: Tests
|
|
|
|
func test_empty() {
|
|
// GIVEN
|
|
let string = String.empty
|
|
|
|
// WHEN
|
|
// THEN
|
|
XCTAssertEqual(string, "")
|
|
}
|
|
|
|
func test_isNotEmpty_withEmptyString() {
|
|
// GIVEN
|
|
let string = String.empty
|
|
|
|
// WHEN
|
|
let result = string.isNotEmpty()
|
|
|
|
// THEN
|
|
XCTAssertFalse(result)
|
|
}
|
|
|
|
func test_isNotEmpty_withFilledString() {
|
|
// GIVEN
|
|
let string = String.Test.string
|
|
|
|
// WHEN
|
|
let result = string.isNotEmpty()
|
|
|
|
// THEN
|
|
XCTAssertTrue(result)
|
|
}
|
|
|
|
}
|
|
|
|
// MARK: - String+Constants
|
|
|
|
private extension String {
|
|
enum Test {
|
|
static let string = "Some test string..."
|
|
}
|
|
}
|