-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathcmd.test.js
More file actions
55 lines (46 loc) · 1.22 KB
/
cmd.test.js
File metadata and controls
55 lines (46 loc) · 1.22 KB
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
/**
* @overview Contains (additional) unit tests for the escaping functionality for
* the the Windows Command Prompt.
* @license MIT
*/
import { testProp } from "@fast-check/ava";
import * as fc from "fast-check";
import * as old from "../../../node_modules/shescape-previous/src/internal/win/cmd.js";
import * as upd from "../../../src/internal/win/cmd.js";
const numRuns = 5_000_000;
testProp(
"escape functionality is unchanged",
[fc.string()],
(t, arg) => {
const updFn = upd.getEscapeFunction();
const oldFn = old.getEscapeFunction();
const got = updFn(arg);
const want = oldFn(arg);
t.is(got, want);
},
{ numRuns },
);
testProp(
"quote functionality is unchanged",
[fc.string()],
(t, arg) => {
const updFn = upd.getQuoteFunction();
const oldFn = old.getQuoteFunction();
const got = updFn[0](updFn[1](arg));
const want = oldFn[0](oldFn[1](arg));
t.is(got, want);
},
{ numRuns },
);
testProp(
"flag protection functionality is unchanged",
[fc.string()],
(t, arg) => {
const updFn = upd.getFlagProtectionFunction();
const oldFn = old.getFlagProtectionFunction();
const got = updFn(arg);
const want = oldFn(arg);
t.is(got, want);
},
{ numRuns },
);