Skip to content

Commit

Permalink
Merge pull request #11 from onmyway133/francescu/issue_10
Browse files Browse the repository at this point in the history
First fix for issue #10
  • Loading branch information
onmyway133 authored Aug 23, 2018
2 parents 7b12928 + 73b7d85 commit 0b626b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions SmileTests/Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@ class Tests: XCTestCase {
XCTAssertEqual(Smile.extractEmojis(string: "Find the solos ⌨️ and ⭐️"), "⌨️⭐️")
XCTAssertEqual(Smile.extractEmojis(string: "Find the 👨‍✈️👨‍🏫💂 and 👨‍💻"), "👨‍✈️👨‍🏫💂👨‍💻")
XCTAssertEqual(Smile.extractEmojis(string: "⌚️"), "⌚️")
XCTAssertEqual(Smile.extractEmojis(string: "Hello ⏰⌛️💳 and 🆙."), "⏰⌛️💳🆙")
}

func testRemoveEmoji() {
XCTAssertEqual(Smile.removeEmojis(string: "Find 🔑and🔎"), "Find and")
XCTAssertEqual(Smile.removeEmojis(string: "Remove the 👨‍🏫"), "Remove the ")
XCTAssertEqual(Smile.removeEmojis(string: "🥑🦈🏍🛴🤡🦋🥚🦐🦑👰🇬🇧🎅🤑👍🏿☔️☂️☃️☀️❗️💀☠️⚔️⚖️☁️"), "")
XCTAssertEqual(Smile.removeEmojis(string: "⏰⌛️💳🆙"), "")

// Variation selectors
XCTAssertEqual(Smile.removeEmojis(string: "👨‍✈️⚔️"), "")
Expand Down
3 changes: 2 additions & 1 deletion Sources/Smile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public func list() -> [String] {
let ranges = [
0x1F601...0x1F64F,
0x2600...0x27B0,
0x23F0...0x23FA,
0x1F680...0x1F6C0,
0x1F170...0x1F251
]
Expand All @@ -24,7 +25,7 @@ public func list() -> [String] {
}

//⌚️⌨️⭐️
let solos = [0x231A, 0x2328, 0x2B50]
let solos = [0x231A, 0x231B, 0x2328, 0x2B50]
all.append(contentsOf: solos.map({ String(Character(UnicodeScalar($0)!))}))

return all
Expand Down

0 comments on commit 0b626b7

Please sign in to comment.