Hey there 👋 , first of all thanks for your work!
I've been using FeedKit in a side project of mine and while I was creating unit tests for types that uses/wraps a FeedParser I though about potential minor improvements.. that's why I'm opening this PR.
These are lightweight changes and there are no breaking changes derived from it. I hope to be contributing.
Changes
Conform ParserError to Equatable. IMO it makes it easier for users to check parser errors through equality. It helps on tests as well.
parser.parseAsync(queue: queue) { result in
switch result {
case let .success(feed):
// do something
case let .failure(error):
switch error {
case .notFound: break
case let .feedCDATABlockEncodingError(path): break
case let .internalError(reason): break
}
}
}
Since all Feed associated types (AtomFeed, etc) already conform to Equatable, it's straightforward to also make Feed conform to Equatable. It allows comparing the equality of a feed without getting the associated value. This can be e.g. useful in tests:
let feed = Feed.rss(RSSFeed())
XCTAssertEqual(try lastResult?.get(), feed)
Hey there 👋 , first of all thanks for your work!
I've been using FeedKit in a side project of mine and while I was creating unit tests for types that uses/wraps a FeedParser I though about potential minor improvements.. that's why I'm opening this PR. These are lightweight changes and there are no breaking changes derived from it. I hope to be contributing.
Changes
Conform ParserError to Equatable
. IMO it makes it easier for users to check parser errors through equality. It helps on tests as well.