Restore EntityDecodingTests.

This commit is contained in:
Brent Simmons
2024-09-16 21:57:05 -07:00
parent e315820b47
commit 88675adff2

View File

@@ -7,41 +7,40 @@
//
import XCTest
import FeedParser
import SAX
//class EntityDecodingTests: XCTestCase {
//
// func test39Decoding() {
//
// // Bug found by Manton Reece the ' entity was not getting decoded by NetNewsWire in JSON Feeds from micro.blog.
//
// let s = "These are the times that try men's souls."
// let decoded = s.rsparser_stringByDecodingHTMLEntities()
//
// XCTAssertEqual(decoded, "These are the times that try men's souls.")
// }
//
// func testEntities() {
// var s = "…"
// var decoded = s.rsparser_stringByDecodingHTMLEntities()
//
// XCTAssertEqual(decoded, "")
//
// s = "…"
// decoded = s.rsparser_stringByDecodingHTMLEntities()
// XCTAssertEqual(decoded, "")
//
// s = "'"
// decoded = s.rsparser_stringByDecodingHTMLEntities()
// XCTAssertEqual(decoded, "'")
//
// s = "§"
// decoded = s.rsparser_stringByDecodingHTMLEntities()
// XCTAssertEqual(decoded, "§")
//
// s = "£"
// decoded = s.rsparser_stringByDecodingHTMLEntities()
// XCTAssertEqual(decoded, "£")
//
// }
//}
class EntityDecodingTests: XCTestCase {
func test39Decoding() {
// Bug found by Manton Reece the ' entity was not getting decoded by NetNewsWire in JSON Feeds from micro.blog.
let s = "These are the times that try men's souls."
let decoded = HTMLEntityDecoder.decodedString(s)
XCTAssertEqual(decoded, "These are the times that try men's souls.")
}
func testEntities() {
var s = "…"
var decoded = HTMLEntityDecoder.decodedString(s)
XCTAssertEqual(decoded, "")
s = "…"
decoded = HTMLEntityDecoder.decodedString(s)
XCTAssertEqual(decoded, "")
s = "'"
decoded = HTMLEntityDecoder.decodedString(s)
XCTAssertEqual(decoded, "'")
s = "§"
decoded = HTMLEntityDecoder.decodedString(s)
XCTAssertEqual(decoded, "§")
s = "£"
decoded = HTMLEntityDecoder.decodedString(s)
XCTAssertEqual(decoded, "£")
}
}