mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Remove unreachable guard condition in String.asciified() (#4395)
This commit is contained in:
@@ -29,25 +29,24 @@ class StringTests: XCTestCase {
|
||||
func testJ🅾️hnnyIsNotAscii() {
|
||||
XCTAssertFalse("j🅾️hnny".isASCII)
|
||||
}
|
||||
|
||||
func testAsciiStaysAscii() {
|
||||
|
||||
func testAsciifiedMethod() {
|
||||
// ASCII strings return themselves unchanged
|
||||
XCTAssertEqual("johnny".asciified(), "johnny")
|
||||
}
|
||||
|
||||
func testÖBecomesO() {
|
||||
XCTAssertEqual("jöhnny".asciified(), "johnny")
|
||||
}
|
||||
|
||||
func testÅBecomesA() {
|
||||
XCTAssertEqual("jåhnny".asciified(), "jahnny")
|
||||
}
|
||||
|
||||
func test1️⃣2️⃣3️⃣Becomes123() {
|
||||
XCTAssertEqual("1️⃣2️⃣3️⃣".asciified(), "123")
|
||||
}
|
||||
|
||||
func testStripsTheHeartbreakHotel() {
|
||||
XCTAssertEqual("Heartbreak Hotel 🏩".asciified(), "Heartbreak Hotel")
|
||||
XCTAssertEqual("hello".asciified(), "hello")
|
||||
XCTAssertEqual("abc123".asciified(), "abc123")
|
||||
XCTAssertEqual("".asciified(), "")
|
||||
XCTAssertEqual(" ".asciified(), " ")
|
||||
|
||||
// Non-ASCII strings get converted or stripped
|
||||
XCTAssertEqual("jöhnny".asciified(), "johnny", "ö should become o")
|
||||
XCTAssertEqual("jåhnny".asciified(), "jahnny", "å should become a")
|
||||
XCTAssertEqual("café".asciified(), "cafe")
|
||||
XCTAssertEqual("naïve".asciified(), "naive")
|
||||
XCTAssertEqual("résumé".asciified(), "resume")
|
||||
XCTAssertEqual("🚀".asciified(), "")
|
||||
XCTAssertEqual("Heartbreak Hotel 🏩".asciified(), "Heartbreak Hotel", "The emoji should be stripped.")
|
||||
XCTAssertEqual("1️⃣2️⃣3️⃣".asciified(), "123", "The emoji should be converted to ASCII.")
|
||||
}
|
||||
|
||||
func testGenerateBreakableWhitespaceEnd() {
|
||||
|
||||
Reference in New Issue
Block a user