-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from louib/better_replace_function
πΉπΉ Improve tokenization
- Loading branch information
Showing
3 changed files
with
108 additions
and
13 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
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,54 @@ | ||
#!/usr/bin/env bats | ||
|
||
@test "handles an input without a single emoji πΏ" { | ||
result=$(./emojify "no emoji :(") | ||
[ "$result" = "no emoji :(" ] | ||
} | ||
|
||
@test "handles an input with a single emoji πΉ" { | ||
result=$(./emojify "an emoji :grin:") | ||
[ "$result" = "an emoji π" ] | ||
} | ||
|
||
@test "handles an input with a lot of emojis π»" { | ||
result=$(./emojify "emojis :grin::grin: :tada:yay:champagne:") | ||
[ "$result" = "emojis ππ πyayπΎ" ] | ||
} | ||
|
||
@test "handles emojis with underscores and numbers π―" { | ||
result=$(./emojify "this is perfect :100: :1st_place_medal:") | ||
[ "$result" = "this is perfect π― π₯" ] | ||
} | ||
|
||
@test "handles emojis with + and - π" { | ||
result=$(./emojify "great :+1::+1::-1:") | ||
[ "$result" = "great πππ" ] | ||
} | ||
|
||
@test "handles right-hand side emojis π" { | ||
result=$(./emojify ":not_an_emoji:point_right:") | ||
[ "$result" = ":not_an_emojiπ" ] | ||
result=$(./emojify "::::point_right:") | ||
[ "$result" = ":::π" ] | ||
} | ||
|
||
@test "handles punctuations just after aliases" { | ||
result=$(./emojify "Enter the :airplane:!") | ||
[ "$result" = "Enter the βοΈ!" ] | ||
} | ||
|
||
@test "handles multiple spaces after an emoji" { | ||
result=$(./emojify ":sparkles: Three spaces") | ||
[ "$result" = "β¨ Three spaces" ] | ||
result=$(./emojify ":sparkles: Five spaces") | ||
[ "$result" = "β¨ Five spaces" ] | ||
result=$(./emojify ":sparkles: One space") | ||
[ "$result" = "β¨ One space" ] | ||
} | ||
|
||
@test "handles the examples from the readme π" { | ||
result=$(./emojify "Hey, I just :raising_hand: you, and this is :scream: , but here's my :calling: , so :telephone_receiver: me, maybe?") | ||
[ "$result" = "Hey, I just π you, and this is π± , but here's my π² , so π me, maybe?" ] | ||
result=$(./emojify "To :bee: , or not to :bee: : that is the question... To take :muscle: against a :ocean: of troubles, and by opposing, end them?") | ||
[ "$result" = "To π , or not to π : that is the question... To take πͺ against a π of troubles, and by opposing, end them?" ] | ||
} |