-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
010e055
commit 83c8ad1
Showing
3 changed files
with
58 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// HTMLStringTests.swift | ||
// | ||
// | ||
// Created by zhgchgli on 2023/8/15. | ||
// | ||
|
||
import Foundation | ||
@testable import ZMarkupParser | ||
import XCTest | ||
|
||
final class HTMLStringTests: XCTestCase { | ||
func testAddingUnicodeEntities() { | ||
let string = "Fish & Chips" | ||
let result = string.addingUnicodeEntities() | ||
XCTAssertEqual(result, "Fish & Chips") | ||
} | ||
|
||
func testAddingASCIIEntities() { | ||
let string = "Fish & Chips" | ||
let result = string.addingASCIIEntities() | ||
XCTAssertEqual(result, "Fish & Chips") | ||
|
||
let stringWithUnicode = "Σ" | ||
let resultWithUnicode = stringWithUnicode.addingASCIIEntities() | ||
XCTAssertEqual(resultWithUnicode, "Σ") | ||
|
||
let stringWithEmoji = "🇺🇸" | ||
let resultWithEmoji = stringWithEmoji.addingASCIIEntities() | ||
XCTAssertEqual(resultWithEmoji, "🇺🇸") | ||
} | ||
|
||
func testRemovingHTMLEntities() { | ||
let string = "Fish & Chips" | ||
let result = string.removingHTMLEntities() | ||
XCTAssertEqual(result, "Fish & Chips") | ||
|
||
let stringWithUnicode = "Σ" | ||
let resultWithUnicode = stringWithUnicode.removingHTMLEntities() | ||
XCTAssertEqual(resultWithUnicode, "Σ") | ||
|
||
let stringWithEmoji = "🇺🇸" | ||
let resultWithEmoji = stringWithEmoji.removingHTMLEntities() | ||
XCTAssertEqual(resultWithEmoji, "🇺🇸") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters