Skip to content

Commit 6892c9f

Browse files
committed
Apply swift-format formatting
1 parent 9ca0dde commit 6892c9f

File tree

8 files changed

+49
-40
lines changed

8 files changed

+49
-40
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ Thumbs.db
2323
!CODE_OF_CONDUCT.md
2424
!SECURITY.md
2525
!**/*.docc/**/*.md
26+
27+
28+
# SwiftLint Remote Config Cache
29+
.swiftlint/RemoteConfigCache

Sources/W3C CSSOM/Serialization/IdentifierSerialization.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ func serializeIdentifier(_ identifier: String) -> String {
9999
private func isValidIdentifierCharacter(_ scalar: Unicode.Scalar) -> Bool {
100100
let value = scalar.value
101101

102-
return (value >= 0x0041 && value <= 0x005A) || // A-Z
103-
(value >= 0x0061 && value <= 0x007A) || // a-z
104-
(value >= 0x0030 && value <= 0x0039) || // 0-9
105-
value == 0x002D || // -
106-
value == 0x005F || // _
107-
value >= 0x0080 // non-ASCII
102+
return (value >= 0x0041 && value <= 0x005A) // A-Z
103+
|| (value >= 0x0061 && value <= 0x007A) // a-z
104+
|| (value >= 0x0030 && value <= 0x0039) // 0-9
105+
|| value == 0x002D // -
106+
|| value == 0x005F // _
107+
|| value >= 0x0080 // non-ASCII
108108
}
109109

110110
/// Escapes a Unicode scalar as a code point.

Sources/W3C CSSOM/Serialization/String.swift

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
public struct CSSString: Sendable, Hashable {
2626
/// The raw string value (before serialization)
2727
public let value: String
28-
//
29-
// /// Quote style enum (deprecated, kept for backward compatibility)
30-
// @available(*, deprecated, message: "Per CSSOM spec, strings are always serialized with double quotes")
31-
// public enum Quotes: Sendable, Hashable {
32-
// case single
33-
// case double
34-
// }
28+
//
29+
// /// Quote style enum (deprecated, kept for backward compatibility)
30+
// @available(*, deprecated, message: "Per CSSOM spec, strings are always serialized with double quotes")
31+
// public enum Quotes: Sendable, Hashable {
32+
// case single
33+
// case double
34+
// }
3535

3636
/// Creates a new CSS string value
3737
///
@@ -42,19 +42,19 @@ public struct CSSString: Sendable, Hashable {
4242
public init(_ value: String) {
4343
self.value = value
4444
}
45-
//
46-
// /// Creates a new CSS string value (deprecated API for backward compatibility)
47-
// ///
48-
// /// - Parameters:
49-
// /// - value: The raw string value
50-
// /// - quotes: Ignored - CSSOM always uses double quotes
51-
// ///
52-
// /// - Note: This initializer is provided for backward compatibility. Per CSSOM specification,
53-
// /// strings are always serialized with double quotes. The `quotes` parameter is ignored.
54-
// @available(*, deprecated, message: "Per CSSOM spec, strings are always serialized with double quotes. Use init(_:) instead.")
55-
// public init(_ value: String, quotes: Quotes) {
56-
// self.value = value
57-
// }
45+
//
46+
// /// Creates a new CSS string value (deprecated API for backward compatibility)
47+
// ///
48+
// /// - Parameters:
49+
// /// - value: The raw string value
50+
// /// - quotes: Ignored - CSSOM always uses double quotes
51+
// ///
52+
// /// - Note: This initializer is provided for backward compatibility. Per CSSOM specification,
53+
// /// strings are always serialized with double quotes. The `quotes` parameter is ignored.
54+
// @available(*, deprecated, message: "Per CSSOM spec, strings are always serialized with double quotes. Use init(_:) instead.")
55+
// public init(_ value: String, quotes: Quotes) {
56+
// self.value = value
57+
// }
5858

5959
/// Creates an empty CSS string value
6060
public static let empty = CSSString("")

Tests/W3C CSSOM Tests/Identifiers/CustomIdent Tests.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// Tests for CSSOM CustomIdent type
55

66
import Testing
7+
78
@testable import W3C_CSSOM
89

910
// MARK: - Basic Functionality
@@ -14,7 +15,7 @@ struct `CustomIdent - Initialization` {
1415
("my-animation", "my-animation"),
1516
("slideIn", "slideIn"),
1617
("header-main", "header-main"),
17-
("_private", "_private")
18+
("_private", "_private"),
1819
])
1920
func `custom ident renders correctly`(value: String, expected: String) {
2021
let ident = CustomIdent(value)
@@ -100,15 +101,15 @@ struct `CustomIdent - Hashable Conformance` {
100101
let set: Set<CustomIdent> = [
101102
CustomIdent("a"),
102103
CustomIdent("b"),
103-
CustomIdent("a") // duplicate
104+
CustomIdent("a"), // duplicate
104105
]
105106
#expect(set.count == 2)
106107
}
107108

108109
@Test func `idents can be used as dictionary keys`() {
109110
let dict: [CustomIdent: String] = [
110111
CustomIdent("header"): "Header content",
111-
CustomIdent("footer"): "Footer content"
112+
CustomIdent("footer"): "Footer content",
112113
]
113114
#expect(dict[CustomIdent("header")] == "Header content")
114115
}

Tests/W3C CSSOM Tests/Identifiers/DashedIdent Tests.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// Tests for CSSOM DashedIdent type (CSS Custom Properties)
55

66
import Testing
7+
78
@testable import W3C_CSSOM
89

910
// MARK: - Basic Functionality
@@ -13,7 +14,7 @@ struct `DashedIdent - Initialization` {
1314
@Test(arguments: [
1415
("primary-color", "--primary-color"),
1516
("font-size", "--font-size"),
16-
("my-var", "--my-var")
17+
("my-var", "--my-var"),
1718
])
1819
func `dashed ident auto-prefixes with double dash`(value: String, expected: String) {
1920
let ident = DashedIdent(value)
@@ -141,15 +142,15 @@ struct `DashedIdent - Hashable Conformance` {
141142
let set: Set<DashedIdent> = [
142143
DashedIdent("a"),
143144
DashedIdent("b"),
144-
DashedIdent("a") // duplicate
145+
DashedIdent("a"), // duplicate
145146
]
146147
#expect(set.count == 2)
147148
}
148149

149150
@Test func `idents can be used as dictionary keys`() {
150151
let dict: [DashedIdent: String] = [
151152
DashedIdent("primary-color"): "#007bff",
152-
DashedIdent("secondary-color"): "#6c757d"
153+
DashedIdent("secondary-color"): "#6c757d",
153154
]
154155
#expect(dict[DashedIdent("primary-color")] == "#007bff")
155156
}

Tests/W3C CSSOM Tests/Identifiers/Ident Tests.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// Tests for CSSOM Ident type (Base identifier)
55

66
import Testing
7+
78
@testable import W3C_CSSOM
89

910
// MARK: - Basic Functionality
@@ -14,7 +15,7 @@ struct `Ident - Initialization` {
1415
("test", "test"),
1516
("my-ident", "my-ident"),
1617
("_private", "_private"),
17-
("value123", "value123")
18+
("value123", "value123"),
1819
])
1920
func `ident renders correctly`(value: String, expected: String) {
2021
let ident = Ident(value)
@@ -102,15 +103,15 @@ struct `Ident - Hashable Conformance` {
102103
let set: Set<Ident> = [
103104
Ident("a"),
104105
Ident("b"),
105-
Ident("a") // duplicate
106+
Ident("a"), // duplicate
106107
]
107108
#expect(set.count == 2)
108109
}
109110

110111
@Test func `idents can be used as dictionary keys`() {
111112
let dict: [Ident: String] = [
112113
Ident("display"): "block",
113-
Ident("position"): "absolute"
114+
Ident("position"): "absolute",
114115
]
115116
#expect(dict[Ident("display")] == "block")
116117
}

Tests/W3C CSSOM Tests/Serialization/String Tests.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// Tests for CSSOM CSSString type
55

66
import Testing
7+
78
@testable import W3C_CSSOM
89

910
// MARK: - Basic Functionality
@@ -14,7 +15,7 @@ struct `CSSString - CSSOM Serialization` {
1415
@Test(arguments: [
1516
("Hello, world!", "\"Hello, world!\""),
1617
("Content", "\"Content\""),
17-
("", "\"\"")
18+
("", "\"\""),
1819
])
1920
func `string renders correctly`(text: String, expected: String) {
2021
let str = CSSString(text)
@@ -156,7 +157,7 @@ struct `CSSString - Edge Cases` {
156157
let str = CSSString(longText)
157158
#expect(str.description.hasPrefix("\""))
158159
#expect(str.description.hasSuffix("\""))
159-
#expect(str.description.count == 1002) // 1000 chars + 2 quotes
160+
#expect(str.description.count == 1002) // 1000 chars + 2 quotes
160161
}
161162

162163
@Test func `string with all escape characters`() {
@@ -186,7 +187,7 @@ struct `CSSString - CSS Property Usage` {
186187

187188
@Test func `string in quotes property`() {
188189
let open = CSSString("\u{201C}") // left double quotation mark
189-
let close = CSSString("\u{201D}") // right double quotation mark
190+
let close = CSSString("\u{201D}") // right double quotation mark
190191
let property = "quotes: \(open) \(close)"
191192
#expect(property == "quotes: \"\u{201C}\" \"\u{201D}\"")
192193
}
@@ -220,7 +221,7 @@ struct `CSSString - Hashable Conformance` {
220221
let set: Set<CSSString> = [
221222
CSSString("a"),
222223
CSSString("b"),
223-
CSSString("a") // duplicate
224+
CSSString("a"), // duplicate
224225
]
225226
#expect(set.count == 2)
226227
}

Tests/W3C CSSOM Tests/Serialization/Url Tests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// Tests for CSSOM Url type
55

66
import Testing
7+
78
@testable import W3C_CSSOM
89

910
// MARK: - Basic Functionality
@@ -16,7 +17,7 @@ struct `Url - CSSOM Serialization` {
1617
("images/background.png", "url(\"images/background.png\")"),
1718
("https://example.com/image.jpg", "url(\"https://example.com/image.jpg\")"),
1819
("../assets/logo.svg", "url(\"../assets/logo.svg\")"),
19-
("/absolute/path.png", "url(\"/absolute/path.png\")")
20+
("/absolute/path.png", "url(\"/absolute/path.png\")"),
2021
])
2122
func `url renders correctly`(path: String, expected: String) {
2223
let url = Url(path)

0 commit comments

Comments
 (0)