-
Notifications
You must be signed in to change notification settings - Fork 0
/
tokenize.test.js
36 lines (34 loc) · 1.49 KB
/
tokenize.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import test from "ava";
import tokenizer from "./tokenizer";
function macro(t, input, expected) {
t.deepEqual(tokenizer.tokenize(input), expected);
}
macro.title = (title, input) => `"${input}"`;
test(macro, "one two", ["one", "two"]);
test(macro, "one two", ["one", "two"]);
test(macro, "one two ", ["one", "two"]);
test(macro, " one two ", ["one", "two"]);
test(macro, "One tWo", ["One", "tWo"]);
test(macro, "don't you", ["don't", "you"]);
test(macro, "one-two", ["one-two"]);
test(macro, "see https://t.co/Ao47NBwbOB", ["see", "https://t.co/Ao47NBwbOB"]);
test(macro, "hey :)", ["hey", ":)"]);
test(macro, "hey 😅", ["hey", "😅"]);
test(macro, "@men_tion @some2", ["@men_tion", "@some2"]);
test(macro, "¿cuántos años?", ["¿", "cuántos", "años", "?"]);
test(macro, "v8 compiler", ["v8", "compiler"]);
test(macro, "$12 billion", ["$12", "billion"]);
test(macro, "u.s.a.", ["u.s.a."]);
test(macro, "soon...", ["soon", ".", ".", "."]);
test(macro, "one. two", ["one", ".", "two"]);
test(macro, "one two.", ["one", "two", "."]);
test(macro, "one (two)", ["one", "(", "two", ")"]);
test(macro, '"one two" three', ['"', "one", "two", '"', "three"]);
test(macro, "one & two", ["one", "&", "two"]);
test(macro, "one: two", ["one", ":", "two"]);
test(macro, "one.two", ["one", ".", "two"]);
test(macro, "one… two", ["one", "…", "two"]);
test(macro, "barça", ["barça"]);
test(macro, "Verão", ["Verão"]);
test(macro, "déjà vu", ["déjà", "vu"]);
test(macro, "We’re going", ["We’re", "going"]);