-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist_test.ts
56 lines (54 loc) · 1.56 KB
/
list_test.ts
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { parseListFields } from "./list.ts";
import { assertEquals, describe, it } from "./_dev_deps.ts";
describe("parseListFields", () => {
it("should ", () => {
const table: [string, string[]][] = [
["", []],
["a", ["a"]],
["a, b, c", ["a", "b", "c"]],
[" a, a , a ", ["a", "a", "a"]],
[`"", `, [`""`]],
[`","`, [`","`]],
[`",", `, [`","`]],
[`"," ,`, [`","`]],
[`",,," ,`, [`",,,"`]],
[`"," , " , "`, [`","`, `" , "`]],
[`","abc,`, [`","abc`]],
["a, b,,,,", ["a", "b"]],
["a, b, c", ["a", "b", "c"]],
["a,b,c", ["a", "b", "c"]],
["a,,c", ["a", "c"]],
[",,,", []],
[`"a,b"`, [`"a,b"`]],
[`"a,b",c, "d,e", f f , g `, [`"a,b"`, "c", `"d,e"`, "f f", "g"]],
[` complex,pattern,"abc", "abc , def", ,,,, """, , ",""`, [
"complex",
"pattern",
`"abc"`,
`"abc , def"`,
`""", , "`,
`""`,
]],
[`",","`, [`"`, `","`]],
[`",",","`, [`","`, `","`]],
[`",",",",`, [`","`, `","`]],
[`",",",","`, [`"`, `","`, `","`]],
[`",",",",",`, [`"`, `","`, `","`]],
[`",",",",","`, [`","`, `","`, `","`]],
[`"`, [`"`]],
[`""`, [`""`]],
[`"""`, [`"""`]],
[`""""`, [`""""`]],
[`"",""`, [`""`, `""`]],
[`",",`, [`","`]],
[`"abc,def", "efg, hij", "lmn, opq"`, [
'"abc,def"',
'"efg, hij"',
'"lmn, opq"',
]],
];
table.forEach(([input, expected]) => {
assertEquals(parseListFields(input), expected);
});
});
});