deno.land / std@0.224.0 / text / _util_test.ts

_util_test.ts
View Documentation
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
57
58
59
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { assertEquals } from "../assert/assert_equals.ts";import { splitToWords } from "./_util.ts";
Deno.test({ name: "split() handles whitespace", fn() { const result = splitToWords("deno Is AWESOME"); const expected = ["deno", "Is", "AWESOME"]; assertEquals(result, expected); },});
Deno.test({ name: "split() handles mixed delimiters", fn() { const result = splitToWords("I am up-to-date!"); const expected = ["I", "am", "up", "to", "date"]; assertEquals(result, expected); },});
Deno.test({ name: "split() handles upper case delimiter", fn() { const result = splitToWords("denoIsAwesome"); const expected = ["deno", "Is", "Awesome"]; assertEquals(result, expected); },});
Deno.test({ name: "split() handles hyphen delimiter", fn() { const result = splitToWords("deno-is-awesome"); const expected = ["deno", "is", "awesome"]; assertEquals(result, expected); },});
Deno.test({ name: "split() handles screaming snake case", fn() { const result = splitToWords("DENO_IS_AWESOME"); const expected = ["DENO", "IS", "AWESOME"]; assertEquals(result, expected); },});
Deno.test({ name: "split() handles underscore delimiter", fn() { const result = splitToWords("deno_is_awesome"); const expected = ["deno", "is", "awesome"]; assertEquals(result, expected); },});
std

Version Info

Tagged at
6 months ago