Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emoji 5.0 Unicode 10.0 🤩 #6

Merged
merged 4 commits into from
Feb 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion SmileTests/Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ class Tests: XCTestCase {

func testEmoji() {
XCTAssertEqual(Smile.emoji(unicodeValues: [0x23F0]), "⏰")
XCTAssertEqual(Smile.emoji(unicodeValues: [0x2600, 0xFE0F]), "☀️")
XCTAssertEqual(Smile.emoji(unicodeValues: [0x1F47B]), "👻")
XCTAssertEqual(Smile.emoji(unicodeValues: [0x1F517]), "🔗")
XCTAssertEqual(Smile.emoji(unicodeValues: [0x0001F468, 0x200D, 0x2708]), "👨‍✈")
}

func testVisibleLength() {
XCTAssertEqual("👨🏾‍🎓".unicodeScalars.count, 4)
XCTAssertEqual("👨🏾‍🎓".characters.count, 1)
XCTAssertEqual("👨🏾‍🎓".count, 1)
}

func testUnmodify() {
Expand All @@ -39,13 +40,15 @@ class Tests: XCTestCase {
func testIsEmoji() {
XCTAssertEqual(Smile.isEmoji(character: "🎉"), true)
XCTAssertEqual(Smile.isEmoji(character: "👨‍✈"), true)
XCTAssertEqual(Smile.isEmoji(character: "☀️"), true)
XCTAssertEqual(Smile.isEmoji(character: "a"), false)
XCTAssertEqual(Smile.isEmoji(character: "1"), false)
}

func testContainsEmoji() {
XCTAssertEqual(Smile.containsEmoji(string: "🎈 and 🎁"), true)
XCTAssertEqual(Smile.containsEmoji(string: "👨‍✈️"), true)
XCTAssertEqual(Smile.containsEmoji(string: "☀️"), true)
XCTAssertEqual(Smile.containsEmoji(string: "just plain text"), false)
XCTAssertEqual(Smile.containsEmoji(string: "1 2 3"), false)
}
Expand Down Expand Up @@ -75,6 +78,7 @@ class Tests: XCTestCase {

func testExtractEmoji() {
XCTAssertEqual(Smile.extractEmojis(string: "Find 🔑and🔎"), "🔑🔎")
XCTAssertEqual(Smile.extractEmojis(string: "Find ☀️and⚙️"), "☀️⚙️")
XCTAssertEqual(Smile.extractEmojis(string: "Find the 👨‍✈️👨‍🏫💂 and 👨‍💻"), "👨‍✈️👨‍🏫💂👨‍💻")
}

Expand Down
62 changes: 61 additions & 1 deletion Sources/Emoji.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1431,4 +1431,64 @@ public let emojiList: [String: String] = [
"yemen": "🇾🇪",
"zambia": "🇿🇲",
"zimbabwe": "🇿🇼",
]
"starstruck": "🤩",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Francescu This is cool. However I would like to move these manual added emojies into a new file called ManualAddedEmojis. As this Emoji.swift file is generated by a script

"eyebrowraised": "🤨",
"mindblown": "🤯",
"zany": "🤪",
"cursing": "🤬",
"vomiting": "🤮",
"shushing": "🤫",
"giggling": "🤭",
"posh": "🧐",
"child": "🧒",
"adult": "🧑",
"senior": "🧓",
"headscarf": "🧕",
"beard": "🧔",
"breastfeeding": "🤱",
"mage": "🧙",
"fairy": "🧚",
"vampire": "🧛",
"mermaid": "🧜",
"elf": "🧝",
"genie": "🧞‍♀️",
"zombie": "🧟",
"sauna": "🧖",
"climber": "🧗",
"yoga": "🧘",
"ily": "🤟",
"praying": "🤲",
"brain": "🧠",
"orange_heart": "🧡",
"scarf": "🧣",
"gloves": "🧤",
"coat": "🧥",
"socks": "🧦",
"cap": "🧢",
"zebra": "🦓",
"giraffe": "🦒",
"hedgehog": "🦔",
"dino": "🦕",
"T-Rex": "🦖",
"crickets": "🦗",
"coconut": "🥥",
"broccoli": "🥦",
"pretzel": "🥨",
"steak": "🥩",
"sandwich": "🥪",
"cereal": "🥣",
"can": "🥫",
"dumpling": "🥟",
"fortune_cookie": "🥠",
"takeout": "🥡",
"pie": "🥧",
"softdrink": "🥤",
"chopsticks": "🥢",
"ufo": "🛸",
"sled": "🛷",
"curling": "🥌",
"England": "🏴󠁧󠁢󠁥󠁮󠁧󠁿",
"Scotland": "🏴󠁧󠁢󠁳󠁣󠁴󠁿",
"Wales": "🏴󠁧󠁢󠁷󠁬󠁳󠁿",
]

2 changes: 1 addition & 1 deletion Sources/Smile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Foundation
public func list() -> [String] {
let ranges = [
0x1F601...0x1F64F,
0x2702...0x27B0,
0x2600...0x27B0,
0x1F680...0x1F6C0,
0x1F170...0x1F251
]
Expand Down