mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
47 lines
1.1 KiB
Swift
47 lines
1.1 KiB
Swift
//
|
|
// EntityDecodingTests.swift
|
|
// RSParserTests
|
|
//
|
|
// Created by Brent Simmons on 12/30/17.
|
|
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
|
//
|
|
|
|
import XCTest
|
|
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 = 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, "£")
|
|
}
|
|
}
|