deno.land / std@0.224.0 / text / _util_test.ts
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859// 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); },});
Version Info