deno.land / std@0.166.0 / collections / without_all_test.ts

without_all_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
57
58
59
60
61
62
63
64
65
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
import { assertEquals } from "../testing/asserts.ts";import { withoutAll } from "./without_all.ts";
function withoutAllTest<I>( input: Array<I>, excluded: Array<I>, expected: Array<I>, message?: string,) { const actual = withoutAll(input, excluded); assertEquals(actual, expected, message);}
Deno.test({ name: "[collections/withoutAll] no mutation", fn() { const array = [1, 2, 3, 4]; withoutAll(array, [2, 3]); assertEquals(array, [1, 2, 3, 4]); },});
Deno.test({ name: "[collections/withoutAll] empty input", fn() { withoutAllTest([], [], []); },});
Deno.test({ name: "[collections/withoutAll] no matches", fn() { withoutAllTest([1, 2, 3, 4], [0, 7, 9], [1, 2, 3, 4]); },});
Deno.test({ name: "[collections/withoutAll] single matche", fn() { withoutAllTest([1, 2, 3, 4], [1], [2, 3, 4]); withoutAllTest([1, 2, 3, 2], [2], [1, 3]); },});
Deno.test({ name: "[collections/withoutAll] multiple matches", fn() { withoutAllTest([1, 2, 3, 4, 6, 3], [1, 2], [3, 4, 6, 3]); withoutAllTest([7, 2, 9, 8, 7, 6, 5, 7], [7, 9], [2, 8, 6, 5]); },});
Deno.test({ name: "[collection/withoutAll] leaves duplicate elements", fn() { withoutAllTest( Array.from({ length: 110 }, () => 3), [1], Array.from({ length: 110 }, () => 3), ); },});
std
Deno standard library
GitHub Repositorydenoland/deno_std
GitHub Stars
2458

Version Info

Tagged at
2 months ago