From a48615b06063c36687f99007b74cf02732f99fa7 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Mon, 16 Sep 2024 22:07:31 -0700 Subject: [PATCH] Add additional EntityDecodingTests. --- .../FeedParserTests/EntityDecodingTests.swift | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/Modules/Parser/Tests/FeedParserTests/EntityDecodingTests.swift b/Modules/Parser/Tests/FeedParserTests/EntityDecodingTests.swift index bc55d3e91..110e698d9 100644 --- a/Modules/Parser/Tests/FeedParserTests/EntityDecodingTests.swift +++ b/Modules/Parser/Tests/FeedParserTests/EntityDecodingTests.swift @@ -21,7 +21,39 @@ class EntityDecodingTests: XCTestCase { XCTAssertEqual(decoded, "These are the times that try men's souls.") } - func testEntities() { + func testEntityAtBeginning() { + + let s = "'leading single quote" + let decoded = HTMLEntityDecoder.decodedString(s) + + XCTAssertEqual(decoded, "'leading single quote") + } + + func testEntityAtEnd() { + + let s = "trailing single quote'" + let decoded = HTMLEntityDecoder.decodedString(s) + + XCTAssertEqual(decoded, "trailing single quote'") + } + + func testEntityInMiddle() { + + let s = "entity ç in middle" + let decoded = HTMLEntityDecoder.decodedString(s) + + XCTAssertEqual(decoded, "entity ç in middle") + } + + func testMultipleEntitiesInARow() { + + let s = "çèmult……iple 'æ"entities÷♥" + let decoded = HTMLEntityDecoder.decodedString(s) + + XCTAssertEqual(decoded, "çèmult……iple 'æ\"entities÷♥") + } + + func testOnlyEntity() { var s = "…" var decoded = HTMLEntityDecoder.decodedString(s)