| 1 |
#![cfg(feature = "shortcodes")] |
| 2 |
|
| 3 |
use super::*; |
| 4 |
|
| 5 |
#[test] |
| 6 |
fn emojis() { |
| 7 |
// Test match |
| 8 |
html_opts!( |
| 9 |
[extension.shortcodes], |
| 10 |
"Hello, happy days! :smile:\n", |
| 11 |
"<p>Hello, happy days! π</p>\n", |
| 12 |
); |
| 13 |
|
| 14 |
// Test match |
| 15 |
html_opts!( |
| 16 |
[extension.shortcodes], |
| 17 |
":smile::smile::smile::smile:\n", |
| 18 |
"<p>ππππ</p>\n", |
| 19 |
); |
| 20 |
|
| 21 |
// Test match |
| 22 |
html_opts!( |
| 23 |
[extension.shortcodes], |
| 24 |
":smile:::smile:::smile:::smile:\n", |
| 25 |
"<p>π:π:π:π</p>\n", |
| 26 |
); |
| 27 |
|
| 28 |
// Test no match |
| 29 |
html_opts!( |
| 30 |
[extension.shortcodes], |
| 31 |
"Hello, happy days! :diego:\n", |
| 32 |
"<p>Hello, happy days! :diego:</p>\n", |
| 33 |
); |
| 34 |
} |
| 35 |
|
| 36 |
#[test] |
| 37 |
fn emojis_specials() { |
| 38 |
// Take a quick trip to https://raw.githubusercontent.com/github/gemoji/master/db/emoji.json |
| 39 |
// with `jq -r .[].aliases[] | sort | grep -E '[^a-z_-]'` to see what else there is to see. |
| 40 |
html_opts!( |
| 41 |
[extension.shortcodes], |
| 42 |
":+1: :-1: :clock12::1234: :1st_place_medal: :e-mail: :non-potable_water:", |
| 43 |
"<p>π π ππ’ π₯ π§ π±</p>\n", |
| 44 |
); |
| 45 |
} |