-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStringExtensionsTests.swift
53 lines (46 loc) · 1.36 KB
/
StringExtensionsTests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// StringExtensionsTests.swift
// NetflixCloneTests
//
// Created by J. Vitor Neves on 05/10/24.
//
import Testing
@testable import NetflixClone
struct StringExtensionsTests {
@Test("Check capitalizes First")
@available(macOS 15, *)
func testCapitalizesFirst() {
let testCases: [(input: String, expected: String)] = [
("hello", "Hello"),
("world", "World"),
("swift", "Swift"),
("TEST", "Test"),
("", ""),
("hElLo WoRlD", "Hello world"),
("123hello", "123hello"),
("#hashtag", "#hashtag"),
("@user", "@user")
]
for testCase in testCases {
let result = testCase.input.capitalizesFirst()
#expect(result == testCase.expected)
}
}
@Test
@available(macOS 15, *)
func testCapitalizesFirstWithSingleCharacter() {
#expect(String("a").capitalizesFirst() == "A")
#expect("Z".capitalizesFirst() == "Z")
}
@Test
@available(macOS 15, *)
func testCapitalizesFirstWithNumbers() {
#expect("123hello".capitalizesFirst() == "123hello")
}
@Test
@available(macOS 15, *)
func testCapitalizesFirstWithSpecialCharacters() {
#expect("#hashtag".capitalizesFirst() == "#hashtag")
#expect("@user".capitalizesFirst() == "@user")
}
}