Skip to content

Commit e1c9501

Browse files
committed
Update code formatting and implementation
1 parent fe5e21f commit e1c9501

File tree

5 files changed

+39
-48
lines changed

5 files changed

+39
-48
lines changed

.gitignore

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,23 @@
1-
# Swift Package Manager
2-
.build/
3-
.swiftpm/
4-
Package.resolved
1+
*~
52

6-
# Xcode
7-
*.xcodeproj/
8-
*.xcworkspace/
9-
xcuserdata/
3+
Package.resolved
104
DerivedData/
11-
*.hmap
12-
*.ipa
13-
*.dSYM.zip
14-
*.dSYM
15-
16-
# macOS
17-
.DS_Store
18-
19-
# AI tools
20-
CLAUDE.md
21-
.claude
22-
.cursor/
23-
.aider*
5+
Thumbs.db
246

25-
# IDE
26-
.vscode/
27-
.idea/
7+
# Dot files/directories (opt-in only)
8+
/.*
9+
!/.github
10+
!/.gitignore
11+
!/.spi.yml
12+
!/.swift-format
13+
!/.swiftformat
14+
!/.swiftlint.yml
2815

29-
# Temporary files
30-
*.tmp
31-
*.swp
32-
*~
16+
# Documentation (opt-in for top-level .md files only)
17+
/*.md
18+
!README.md
19+
!LICENSE.md
20+
!CHANGELOG.md
21+
!CONTRIBUTING.md
22+
!CODE_OF_CONDUCT.md
23+
!SECURITY.md

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ print(email.domain.name) // "example.com"
5959
// Parse with display name
6060
let named = try RFC_5322.EmailAddress("John Doe <[email protected]>")
6161
print(named.displayName) // "John Doe"
62-
print(named.addressValue) // "[email protected]"
62+
print(named.address) // "[email protected]"
6363

6464
// Create from components
6565
let addr = try RFC_5322.EmailAddress(
@@ -149,7 +149,7 @@ public struct EmailAddress: Hashable, Sendable {
149149
public init(_ string: String) throws
150150

151151
public var stringValue: String // Full format with display name
152-
public var addressValue: String // Just the email address part
152+
public var address: String // Just the email address part
153153
public func toRFC5321() throws -> RFC_5321.EmailAddress
154154
}
155155
```

Tests/RFC_5322 Tests/RFC_5322.EmailAddress Tests.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ struct `RFC_5322.EmailAddress Tests` {
2727
#expect(email.displayName == "John Doe")
2828
#expect(email.localPart.description == "john")
2929
#expect(email.domain.name == "example.com")
30-
#expect(email.addressValue == "[email protected]")
30+
#expect(email.address == "[email protected]")
3131
}
3232

3333
@Test
3434
func `Parse email with quoted display name`() throws {
3535
let email = try RFC_5322.EmailAddress("\"Doe, John\" <[email protected]>")
3636
#expect(email.displayName == "Doe, John")
37-
#expect(email.addressValue == "[email protected]")
37+
#expect(email.address == "[email protected]")
3838
}
3939

4040
// MARK: - Creation from Components
@@ -83,14 +83,14 @@ struct `RFC_5322.EmailAddress Tests` {
8383
func `Exclamation mark (!) is accepted in local-part`() throws {
8484
let email = try RFC_5322.EmailAddress("[email protected]")
8585
#expect(email.localPart.description == "user!tag")
86-
#expect(email.addressValue == "[email protected]")
86+
#expect(email.address == "[email protected]")
8787
}
8888

8989
@Test
9090
func `Pipe character (|) is accepted in local-part`() throws {
9191
let email = try RFC_5322.EmailAddress("user|[email protected]")
9292
#expect(email.localPart.description == "user|tag")
93-
#expect(email.addressValue == "user|[email protected]")
93+
#expect(email.address == "user|[email protected]")
9494
}
9595

9696
@Test
@@ -114,7 +114,7 @@ struct `RFC_5322.EmailAddress Tests` {
114114

115115
for address in testAddresses {
116116
let email = try RFC_5322.EmailAddress(address)
117-
#expect(email.addressValue == address)
117+
#expect(email.address == address)
118118
}
119119
}
120120

@@ -149,16 +149,16 @@ struct `RFC_5322.EmailAddress Tests` {
149149
#expect(formatted == "\"Doe, John\" <[email protected]>")
150150
}
151151

152-
// MARK: - addressValue Property
152+
// MARK: - address Property
153153

154154
@Test
155-
func `addressValue returns email without display name`() throws {
155+
func `address returns email without display name`() throws {
156156
let email = try RFC_5322.EmailAddress(
157157
displayName: "John Doe",
158158
localPart: .init("john"),
159159
domain: .init("example.com")
160160
)
161-
#expect(email.addressValue == "[email protected]")
161+
#expect(email.address == "[email protected]")
162162
}
163163

164164
// MARK: - Validation Errors

Tests/RFC_5322 Tests/RFC_5322.Message Tests.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ struct `RFC_5322.Message Tests` {
2727
body: .init("Hello, World!".utf8)
2828
)
2929

30-
#expect(message.from.addressValue == "[email protected]")
30+
#expect(message.from.address == "[email protected]")
3131
#expect(message.to.count == 1)
32-
#expect(message.to[0].addressValue == "[email protected]")
32+
#expect(message.to[0].address == "[email protected]")
3333
#expect(message.subject == "Test Message")
3434
#expect(message.messageId == "<[email protected]>")
3535
#expect(String(decoding: message.body, as: UTF8.self) == "Hello, World!")
@@ -51,9 +51,9 @@ struct `RFC_5322.Message Tests` {
5151
)
5252

5353
#expect(message.to.count == 3)
54-
#expect(message.to[0].addressValue == "[email protected]")
55-
#expect(message.to[1].addressValue == "[email protected]")
56-
#expect(message.to[2].addressValue == "[email protected]")
54+
#expect(message.to[0].address == "[email protected]")
55+
#expect(message.to[1].address == "[email protected]")
56+
#expect(message.to[2].address == "[email protected]")
5757
}
5858

5959
@Test
@@ -69,7 +69,7 @@ struct `RFC_5322.Message Tests` {
6969
)
7070

7171
#expect(message.cc?.count == 1)
72-
#expect(message.cc?[0].addressValue == "[email protected]")
72+
#expect(message.cc?[0].address == "[email protected]")
7373
}
7474

7575
@Test
@@ -85,7 +85,7 @@ struct `RFC_5322.Message Tests` {
8585
)
8686

8787
#expect(message.bcc?.count == 1)
88-
#expect(message.bcc?[0].addressValue == "[email protected]")
88+
#expect(message.bcc?[0].address == "[email protected]")
8989
}
9090

9191
@Test
@@ -100,7 +100,7 @@ struct `RFC_5322.Message Tests` {
100100
body: .init(utf8: "Test")
101101
)
102102

103-
#expect(message.replyTo?.addressValue == "[email protected]")
103+
#expect(message.replyTo?.address == "[email protected]")
104104
}
105105

106106
// MARK: - Additional Headers

Tests/RFC_5322 Tests/ReadmeVerificationTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct `README Verification Tests` {
2222
func `README Line 59-62: Parse with display name`() throws {
2323
let named = try RFC_5322.EmailAddress("John Doe <[email protected]>")
2424
#expect(named.displayName == "John Doe")
25-
#expect(named.addressValue == "[email protected]")
25+
#expect(named.address == "[email protected]")
2626
}
2727

2828
@Test
@@ -104,7 +104,7 @@ struct `README Verification Tests` {
104104

105105
#expect(message.cc?.count == 1)
106106
#expect(message.bcc?.count == 1)
107-
#expect(message.replyTo?.addressValue == "[email protected]")
107+
#expect(message.replyTo?.address == "[email protected]")
108108
#expect(message.additionalHeaders.count == 2)
109109
}
110110

0 commit comments

Comments
 (0)