Skip to content

Commit

Permalink
Merge pull request #93 from kkebo/refactor-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kkebo authored Jun 20, 2024
2 parents b9d5faf + 0766058 commit 3f48481
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
5 changes: 2 additions & 3 deletions Tests/HTMLEntitiesTests/HTMLEntitiesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ private struct Entry: Decodable {
var codepoints: [UInt32]
}

// swift-format-ignore: NeverForceUnwrap
@Test func namedCharRef() throws {
let dict = try JSONDecoder()
.decode(
[String: Entry].self,
from: Data(contentsOf: Bundle.module.url(forResource: "entities", withExtension: "json")!)
from: Data(contentsOf: #require(Bundle.module.url(forResource: "entities", withExtension: "json")))
)

for (key, value) in dict {
switch namedChars[String(key.dropFirst())]! {
switch try #require(namedChars[String(key.dropFirst())]) {
case (let c1, "\0"): #expect(value.codepoints == [c1.value])
case (let c1, let c2): #expect(value.codepoints == [c1.value, c2.value])
}
Expand Down
1 change: 0 additions & 1 deletion Tests/TokenizerTests/HTML5LibTestsParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ enum TestParseError: Error {
case invalidTokenFormat([ExpectedTokenField?])
}

// swift-format-ignore: NeverForceUnwrap
func parseTestCases(from data: consuming Data) throws -> [TestCase] {
try JSONDecoder().decode(TestFile.self, from: data).tests.flatMap { try $0.into() }
}

0 comments on commit 3f48481

Please sign in to comment.