deno.land / std@0.166.0 / fs / eol_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
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.import { assertEquals } from "../testing/asserts.ts";import { detect, EOL, format } from "./eol.ts";
const CRLFinput = "deno\r\nis not\r\nnode";const Mixedinput = "deno\nis not\r\nnode";const Mixedinput2 = "deno\r\nis not\nnode";const LFinput = "deno\nis not\nnode";const NoNLinput = "deno is not node";
Deno.test({ name: "[EOL] Detect CR LF", fn() { assertEquals(detect(CRLFinput), EOL.CRLF); },});
Deno.test({ name: "[EOL] Detect LF", fn() { assertEquals(detect(LFinput), EOL.LF); },});
Deno.test({ name: "[EOL] Detect No New Line", fn() { assertEquals(detect(NoNLinput), null); },});
Deno.test({ name: "[EOL] Detect Mixed", fn() { assertEquals(detect(Mixedinput), EOL.CRLF); assertEquals(detect(Mixedinput2), EOL.CRLF); },});
Deno.test({ name: "[EOL] Format", fn() { assertEquals(format(CRLFinput, EOL.LF), LFinput); assertEquals(format(LFinput, EOL.LF), LFinput); assertEquals(format(LFinput, EOL.CRLF), CRLFinput); assertEquals(format(CRLFinput, EOL.CRLF), CRLFinput); assertEquals(format(CRLFinput, EOL.CRLF), CRLFinput); assertEquals(format(NoNLinput, EOL.CRLF), NoNLinput); assertEquals(format(Mixedinput, EOL.CRLF), CRLFinput); assertEquals(format(Mixedinput, EOL.LF), LFinput); assertEquals(format(Mixedinput2, EOL.CRLF), CRLFinput); assertEquals(format(Mixedinput2, EOL.LF), LFinput); },});
std
Deno standard library
GitHub Repositorydenoland/deno_std
GitHub Stars
2458

Version Info

Tagged at
2 months ago