mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-03 10:47:21 +00:00
Update tests.
This commit is contained in:
1 parent
e36ac80ee2
commit
90099fcf0f
14 files changed
+35
-42
No files matched your search
@@ -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() {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
//
|
||||
// Created by Brent Simmons on 4/19/26.
|
||||
//
|
||||
// Tests for the UInt8 ASCII helpers and ArraySlice<UInt8> 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<UInt8> 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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -320,8 +320,8 @@ import Testing
|
||||
@Test func captureRawInnerContent() {
|
||||
let xml = #"<root><content type="xhtml"><div>hello <em>world</em>!</div></content></root>"#
|
||||
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<UInt8>) {
|
||||
func xmlSAXParser(_ parser: XMLSAXParser, didFindCharacters bytes: ArraySlice<UInt8>) {
|
||||
let s = String(decoding: bytes, as: UTF8.self)
|
||||
// Collapse adjacent character events for simpler test assertions.
|
||||
if case .characters(let last) = events.last ?? .done {
|
||||
|
||||
Reference in new issue
Block a user