mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-28 08:17:16 +00:00
35 lines
1014 B
Swift
35 lines
1014 B
Swift
//
|
|
// EntityDecodingTests.swift
|
|
// RSParserTests
|
|
//
|
|
// Created by Brent Simmons on 12/30/17.
|
|
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
|
//
|
|
|
|
import Testing
|
|
import RSParser
|
|
|
|
@Suite struct EntityDecodingTests {
|
|
|
|
@Test("Decimal entity ' (single-quote bug from micro.blog)")
|
|
func decimalEntity39() {
|
|
// 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()
|
|
#expect(decoded == "These are the times that try men's souls.")
|
|
}
|
|
|
|
@Test("Decimal and hex entities decode to the same characters",
|
|
arguments: [
|
|
("…", "…"),
|
|
("…", "…"),
|
|
("'", "'"),
|
|
("§", "§"),
|
|
("£", "£")
|
|
])
|
|
func entityPair(_ input: String, _ expected: String) {
|
|
#expect(input.rsparser_stringByDecodingHTMLEntities() == expected)
|
|
}
|
|
}
|