From 90099fcf0fbea181a0eb6516585a1cded2b7063a Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 19 Apr 2026 20:43:54 -0700 Subject: [PATCH] Update tests. --- .../Tests/RSParserTests/AtomParserPerformanceTests.swift | 5 ++--- .../Tests/RSParserTests/DateParserPerformanceTests.swift | 4 ++-- .../RSParser/Tests/RSParserTests/DateParserTests.swift | 7 ++++--- .../RSParserTests/FeedParserTypePerformanceTests.swift | 5 ++--- .../Tests/RSParserTests/HTMLLinkPerformanceTests.swift | 5 ++--- .../RSParserTests/HTMLMetadataPerformanceTests.swift | 5 ++--- .../RSParserTests/JSONFeedParserPerformanceTests.swift | 5 ++--- .../Tests/RSParserTests/MD5PerformanceTests.swift | 4 ++-- .../Tests/RSParserTests/OPMLPerformanceTests.swift | 5 ++--- .../RSParserTests/RSSInJSONParserPerformanceTests.swift | 5 ++--- .../Tests/RSParserTests/RSSParserPerformanceTests.swift | 5 ++--- Modules/RSParser/Tests/RSParserTests/XMLASCIITests.swift | 8 ++++---- .../RSParser/Tests/RSParserTests/XMLEncodingTests.swift | 8 ++++---- .../RSParser/Tests/RSParserTests/XMLSAXParserTests.swift | 6 +++--- 14 files changed, 35 insertions(+), 42 deletions(-) diff --git a/Modules/RSParser/Tests/RSParserTests/AtomParserPerformanceTests.swift b/Modules/RSParser/Tests/RSParserTests/AtomParserPerformanceTests.swift index e7f8f0f76..4681a8b77 100644 --- a/Modules/RSParser/Tests/RSParserTests/AtomParserPerformanceTests.swift +++ b/Modules/RSParser/Tests/RSParserTests/AtomParserPerformanceTests.swift @@ -4,13 +4,12 @@ // // Created by Brent Simmons on 4/19/26. // -// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` -// equivalent yet. -// import XCTest import RSParser +// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` equivalent yet. + final class AtomParserPerformanceTests: XCTestCase { func testDaringFireballPerformance() { diff --git a/Modules/RSParser/Tests/RSParserTests/DateParserPerformanceTests.swift b/Modules/RSParser/Tests/RSParserTests/DateParserPerformanceTests.swift index 737427b29..e3b5b218b 100644 --- a/Modules/RSParser/Tests/RSParserTests/DateParserPerformanceTests.swift +++ b/Modules/RSParser/Tests/RSParserTests/DateParserPerformanceTests.swift @@ -4,12 +4,12 @@ // // Created by Brent Simmons on 4/19/26. // -// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` -// equivalent yet. import XCTest @testable import RSParser +// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` equivalent yet. + final class DateParserPerformanceTests: XCTestCase { /// Byte-slice hot path with a mix of pubDate and W3C formats, including one diff --git a/Modules/RSParser/Tests/RSParserTests/DateParserTests.swift b/Modules/RSParser/Tests/RSParserTests/DateParserTests.swift index 83da0f425..e2185a8a0 100644 --- a/Modules/RSParser/Tests/RSParserTests/DateParserTests.swift +++ b/Modules/RSParser/Tests/RSParserTests/DateParserTests.swift @@ -4,14 +4,15 @@ // // Created by Brent Simmons on 4/18/26. // -// Consolidated tests for `DateParser`. Every correctness test goes through -// `assertParsedDate` which exercises both public entry points — `date(from:)` -// and `date(bytes:)` — and verifies they produce identical results. import Foundation import Testing @testable import RSParser +// Every correctness test goes through `assertParsedDate` which exercises both +// public entry points — `date(from:)` and `date(bytes:)` — and verifies they +// produce identical results. + @Suite struct DateParserTests { // MARK: - Helpers diff --git a/Modules/RSParser/Tests/RSParserTests/FeedParserTypePerformanceTests.swift b/Modules/RSParser/Tests/RSParserTests/FeedParserTypePerformanceTests.swift index 45fdf9acd..c5e3dceb6 100644 --- a/Modules/RSParser/Tests/RSParserTests/FeedParserTypePerformanceTests.swift +++ b/Modules/RSParser/Tests/RSParserTests/FeedParserTypePerformanceTests.swift @@ -4,13 +4,12 @@ // // Created by Brent Simmons on 4/19/26. // -// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` -// equivalent yet. -// import XCTest import RSParser +// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` equivalent yet. + final class FeedParserTypePerformanceTests: XCTestCase { func testFeedTypePerformance() { diff --git a/Modules/RSParser/Tests/RSParserTests/HTMLLinkPerformanceTests.swift b/Modules/RSParser/Tests/RSParserTests/HTMLLinkPerformanceTests.swift index bb397382e..e9324c4fd 100644 --- a/Modules/RSParser/Tests/RSParserTests/HTMLLinkPerformanceTests.swift +++ b/Modules/RSParser/Tests/RSParserTests/HTMLLinkPerformanceTests.swift @@ -4,14 +4,13 @@ // // Created by Brent Simmons on 4/19/26. // -// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` -// equivalent yet. -// import XCTest import RSParser import RSParserObjC +// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` equivalent yet. + final class HTMLLinkPerformanceTests: XCTestCase { func testSixColorsPerformance() { diff --git a/Modules/RSParser/Tests/RSParserTests/HTMLMetadataPerformanceTests.swift b/Modules/RSParser/Tests/RSParserTests/HTMLMetadataPerformanceTests.swift index e9ede62d3..6167bb762 100644 --- a/Modules/RSParser/Tests/RSParserTests/HTMLMetadataPerformanceTests.swift +++ b/Modules/RSParser/Tests/RSParserTests/HTMLMetadataPerformanceTests.swift @@ -4,14 +4,13 @@ // // Created by Brent Simmons on 4/19/26. // -// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` -// equivalent yet. -// import XCTest import RSParser import RSParserObjC +// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` equivalent yet. + final class HTMLMetadataPerformanceTests: XCTestCase { func testDaringFireballPerformance() { diff --git a/Modules/RSParser/Tests/RSParserTests/JSONFeedParserPerformanceTests.swift b/Modules/RSParser/Tests/RSParserTests/JSONFeedParserPerformanceTests.swift index 9c245284a..2a6f06e82 100644 --- a/Modules/RSParser/Tests/RSParserTests/JSONFeedParserPerformanceTests.swift +++ b/Modules/RSParser/Tests/RSParserTests/JSONFeedParserPerformanceTests.swift @@ -4,13 +4,12 @@ // // Created by Brent Simmons on 4/19/26. // -// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` -// equivalent yet. -// import XCTest import RSParser +// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` equivalent yet. + final class JSONFeedParserPerformanceTests: XCTestCase { func testInessentialPerformance() { diff --git a/Modules/RSParser/Tests/RSParserTests/MD5PerformanceTests.swift b/Modules/RSParser/Tests/RSParserTests/MD5PerformanceTests.swift index a085fcea8..0d0147f53 100644 --- a/Modules/RSParser/Tests/RSParserTests/MD5PerformanceTests.swift +++ b/Modules/RSParser/Tests/RSParserTests/MD5PerformanceTests.swift @@ -4,12 +4,12 @@ // // Created by Brent Simmons on 4/19/26. // -// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` -// equivalent yet. import XCTest @testable import RSParser +// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` equivalent yet. + final class MD5PerformanceTests: XCTestCase { /// Benchmark the md5String hot path with feed-guid-sized inputs (calculated diff --git a/Modules/RSParser/Tests/RSParserTests/OPMLPerformanceTests.swift b/Modules/RSParser/Tests/RSParserTests/OPMLPerformanceTests.swift index 075876860..49a01aafd 100644 --- a/Modules/RSParser/Tests/RSParserTests/OPMLPerformanceTests.swift +++ b/Modules/RSParser/Tests/RSParserTests/OPMLPerformanceTests.swift @@ -4,14 +4,13 @@ // // Created by Brent Simmons on 4/19/26. // -// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` -// equivalent yet. -// import XCTest import RSParser import RSParserObjC +// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` equivalent yet. + final class OPMLPerformanceTests: XCTestCase { func testOPMLParsingPerformance() { diff --git a/Modules/RSParser/Tests/RSParserTests/RSSInJSONParserPerformanceTests.swift b/Modules/RSParser/Tests/RSParserTests/RSSInJSONParserPerformanceTests.swift index 495bfd134..3b5ec7f3d 100644 --- a/Modules/RSParser/Tests/RSParserTests/RSSInJSONParserPerformanceTests.swift +++ b/Modules/RSParser/Tests/RSParserTests/RSSInJSONParserPerformanceTests.swift @@ -4,13 +4,12 @@ // // Created by Brent Simmons on 4/19/26. // -// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` -// equivalent yet. -// import XCTest import RSParser +// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` equivalent yet. + final class RSSInJSONParserPerformanceTests: XCTestCase { func testScriptingNewsPerformance() { diff --git a/Modules/RSParser/Tests/RSParserTests/RSSParserPerformanceTests.swift b/Modules/RSParser/Tests/RSParserTests/RSSParserPerformanceTests.swift index 9f294d169..bffdf1af6 100644 --- a/Modules/RSParser/Tests/RSParserTests/RSSParserPerformanceTests.swift +++ b/Modules/RSParser/Tests/RSParserTests/RSSParserPerformanceTests.swift @@ -4,13 +4,12 @@ // // Created by Brent Simmons on 4/19/26. // -// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` -// equivalent yet. -// import XCTest import RSParser +// Performance tests stay in XCTest — Swift Testing doesn't have a `measure { }` equivalent yet. + final class RSSParserPerformanceTests: XCTestCase { func testScriptingNewsPerformance() { diff --git a/Modules/RSParser/Tests/RSParserTests/XMLASCIITests.swift b/Modules/RSParser/Tests/RSParserTests/XMLASCIITests.swift index 5431b8f94..85d9f1b50 100644 --- a/Modules/RSParser/Tests/RSParserTests/XMLASCIITests.swift +++ b/Modules/RSParser/Tests/RSParserTests/XMLASCIITests.swift @@ -4,15 +4,15 @@ // // Created by Brent Simmons on 4/19/26. // -// Tests for the UInt8 ASCII helpers and ArraySlice comparison methods -// in XMLASCII.swift. These underpin the scanner so every code path should -// be pinned down by a test. -// import Foundation import Testing @testable import RSParser +// Tests for the UInt8 ASCII helpers and ArraySlice comparison methods in +// XMLASCII.swift. These underpin the scanner so every code path should be pinned +// down by a test. + @Suite struct XMLASCIITests { // MARK: - Byte constants diff --git a/Modules/RSParser/Tests/RSParserTests/XMLEncodingTests.swift b/Modules/RSParser/Tests/RSParserTests/XMLEncodingTests.swift index 12084c3b5..0f154a3a0 100644 --- a/Modules/RSParser/Tests/RSParserTests/XMLEncodingTests.swift +++ b/Modules/RSParser/Tests/RSParserTests/XMLEncodingTests.swift @@ -4,15 +4,15 @@ // // Created by Brent Simmons on 4/19/26. // -// Direct unit tests for `XMLEncoding.toUTF8`. Covers BOMs, declaration-based -// detection, encoding-name aliases and case-insensitivity, the hand-rolled -// Latin-1/Windows-1252 paths, the Foundation-bridged CJK/Cyrillic paths, and -// boundary inputs. import Foundation import Testing @testable import RSParser +// Direct unit tests for `XMLEncoding.toUTF8`. Covers BOMs, declaration-based detection, +// encoding-name aliases and case-insensitivity, the hand-rolled Latin-1/Windows-1252 +// paths, the Foundation-bridged CJK/Cyrillic paths, and boundary inputs. + @Suite struct XMLEncodingTests { // MARK: - Helpers diff --git a/Modules/RSParser/Tests/RSParserTests/XMLSAXParserTests.swift b/Modules/RSParser/Tests/RSParserTests/XMLSAXParserTests.swift index 0395da41e..ef1b53364 100644 --- a/Modules/RSParser/Tests/RSParserTests/XMLSAXParserTests.swift +++ b/Modules/RSParser/Tests/RSParserTests/XMLSAXParserTests.swift @@ -320,8 +320,8 @@ import Testing @Test func captureRawInnerContent() { let xml = #"
hello world!
"# let delegate = TestDelegate() - delegate.onStart = { parser, name, _, _, attrs in - if name == "content" && attrs["type"] == "xhtml" { + delegate.onStart = { parser, name, _, _, attributes in + if name == "content" && attributes["type"] == "xhtml" { parser.captureRawInnerContent() } } @@ -483,7 +483,7 @@ private final class TestDelegate: XMLSAXParserDelegate { captured = String(decoding: bytes, as: UTF8.self) } - func xmlSAXParser(_ parser: XMLSAXParser, charactersFound bytes: ArraySlice) { + func xmlSAXParser(_ parser: XMLSAXParser, didFindCharacters bytes: ArraySlice) { let s = String(decoding: bytes, as: UTF8.self) // Collapse adjacent character events for simpler test assertions. if case .characters(let last) = events.last ?? .done {