deno.land / std@0.224.0 / assert / assert_string_includes_test.ts

assert_string_includes_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
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.import { assert, assertEquals, AssertionError, assertStringIncludes,} from "./mod.ts";
Deno.test("AssertStringIncludes", function () { assertStringIncludes("Denosaurus", "saur"); assertStringIncludes("Denosaurus", "Deno"); assertStringIncludes("Denosaurus", "rus"); let didThrow; try { assertStringIncludes("Denosaurus", "Raptor"); didThrow = false; } catch (e) { assert(e instanceof AssertionError); didThrow = true; } assertEquals(didThrow, true);});
Deno.test("AssertStringContainsThrow", function () { let didThrow = false; try { assertStringIncludes("Denosaurus from Jurassic", "Raptor"); } catch (e) { assert(e instanceof AssertionError); assert( e.message === `Expected actual: "Denosaurus from Jurassic" to contain: "Raptor".`, ); didThrow = true; } assert(didThrow);});
std

Version Info

Tagged at
3 weeks ago