mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-23 15:50:26 +01:00
3d72ba4b44
It’s missing the opening <rss> tag, but it has enough other distinct markers that we can detect it as RSS. Add two tests to make sure it’s detected and that the parser handles it.
58 lines
1.2 KiB
Swift
58 lines
1.2 KiB
Swift
//
|
|
// RSSParserTests.swift
|
|
// RSParser
|
|
//
|
|
// Created by Brent Simmons on 6/26/17.
|
|
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
|
//
|
|
|
|
import XCTest
|
|
import RSParser
|
|
|
|
class RSSParserTests: XCTestCase {
|
|
|
|
func testScriptingNewsPerformance() {
|
|
|
|
// 0.004 sec on my 2012 iMac.
|
|
let d = parserData("scriptingNews", "rss", "http://scripting.com/")
|
|
self.measure {
|
|
let _ = try! FeedParser.parse(d)
|
|
}
|
|
}
|
|
|
|
func testKatieFloydPerformance() {
|
|
|
|
// 0.004 sec on my 2012 iMac.
|
|
let d = parserData("KatieFloyd", "rss", "http://katiefloyd.com/")
|
|
self.measure {
|
|
let _ = try! FeedParser.parse(d)
|
|
}
|
|
}
|
|
|
|
func testEMarleyPerformance() {
|
|
|
|
// 0.001 sec on my 2012 iMac.
|
|
let d = parserData("EMarley", "rss", "https://medium.com/@emarley")
|
|
self.measure {
|
|
let _ = try! FeedParser.parse(d)
|
|
}
|
|
}
|
|
|
|
func testMantonPerformance() {
|
|
|
|
// 0.002 sec on my 2012 iMac.
|
|
let d = parserData("manton", "rss", "http://manton.org/")
|
|
self.measure {
|
|
let _ = try! FeedParser.parse(d)
|
|
}
|
|
}
|
|
|
|
func testNatashaTheRobot() {
|
|
|
|
let d = parserData("natasha", "xml", "https://www.natashatherobot.com/")
|
|
let parsedFeed = try! FeedParser.parse(d)!
|
|
XCTAssertEqual(parsedFeed.items.count, 10)
|
|
}
|
|
|
|
}
|