File tree Expand file tree Collapse file tree 5 files changed +73
-5
lines changed
Expand file tree Collapse file tree 5 files changed +73
-5
lines changed Original file line number Diff line number Diff line change @@ -364,7 +364,7 @@ jobs:
364364 git config --global user.name "John Doe"
365365 git config --global user.email johndoe@example.com
366366 git commit -m 'n/a'
367- git apply ../../bash .patch
367+ git apply ../../2410 .patch
368368 - name : Run unit tests
369369 run : npm run coverage:unit
370370 transpile :
Original file line number Diff line number Diff line change @@ -11,3 +11,16 @@ index 19fba6d..c1c57ce 100644
1111 .replace(/(?<=[:=])(~)(?=[\s+\-/0:=]|$)/gu, "\\$1")
1212 .replace(/([\t ])/gu, "\\$1");
1313 }
14+ diff --git a/src/internal/unix/busybox.js b/src/internal/unix/busybox.js
15+ index e61262f..0c91dc4 100644
16+ --- a/src/internal/unix/busybox.js
17+ +++ b/src/internal/unix/busybox.js
18+ @@ -15,7 +15,7 @@ function escapeArg(arg) {
19+ .replace(/\n/gu, " ")
20+ .replace(/\\/gu, "\\\\")
21+ .replace(/(?<=^|\s)([#~])/gu, "\\$1")
22+ - .replace(/(["$&'()*;<>?`|])/gu, "\\$1")
23+ + .replace(/(["$&'()*;<>?`|[\]])/gu, "\\$1")
24+ .replace(/([\t ])/gu, "\\$1");
25+ }
26+
Original file line number Diff line number Diff line change 11/**
2- * @overview Contains differential tests for the migration form standard regular
3- * expressions to linear-time regular expressions in Bash.
2+ * @overview Contains (additional) unit tests for the escaping functionality for
3+ * the Bourne-again shell ( Bash) .
44 * @license MIT
55 */
66
Original file line number Diff line number Diff line change 1+ /**
2+ * @overview Contains (additional) unit tests for the escaping functionality for
3+ * the BusyBox shell.
4+ * @license MIT
5+ */
6+
7+ import { testProp } from "@fast-check/ava" ;
8+ import * as fc from "fast-check" ;
9+
10+ import * as old from "../../../node_modules/shescape-previous/src/internal/unix/busybox.js" ;
11+ import * as upd from "../../../src/internal/unix/busybox.js" ;
12+
13+ const numRuns = 5_000_000 ;
14+
15+ testProp (
16+ "escape functionality is unchanged" ,
17+ [ fc . string ( ) ] ,
18+ ( t , arg ) => {
19+ const updFn = upd . getEscapeFunction ( ) ;
20+ const oldFn = old . getEscapeFunction ( ) ;
21+
22+ const got = updFn ( arg ) ;
23+ const want = oldFn ( arg ) ;
24+ t . is ( got , want ) ;
25+ } ,
26+ { numRuns } ,
27+ ) ;
28+
29+ testProp (
30+ "quote functionality is unchanged" ,
31+ [ fc . string ( ) ] ,
32+ ( t , arg ) => {
33+ const updFn = upd . getQuoteFunction ( ) ;
34+ const oldFn = old . getQuoteFunction ( ) ;
35+
36+ const got = updFn [ 0 ] ( updFn [ 1 ] ( arg ) ) ;
37+ const want = oldFn [ 0 ] ( oldFn [ 1 ] ( arg ) ) ;
38+ t . is ( got , want ) ;
39+ } ,
40+ { numRuns } ,
41+ ) ;
42+
43+ testProp (
44+ "flag protection functionality is unchanged" ,
45+ [ fc . string ( ) ] ,
46+ ( t , arg ) => {
47+ const updFn = upd . getFlagProtectionFunction ( ) ;
48+ const oldFn = old . getFlagProtectionFunction ( ) ;
49+
50+ const got = updFn ( arg ) ;
51+ const want = oldFn ( arg ) ;
52+ t . is ( got , want ) ;
53+ } ,
54+ { numRuns } ,
55+ ) ;
Original file line number Diff line number Diff line change 11/**
2- * @overview Contains differential tests for the migration form standard regular
3- * expressions to linear-time regular expressions in CMD .
2+ * @overview Contains (additional) unit tests for the escaping functionality for
3+ * the the Windows Command Prompt .
44 * @license MIT
55 */
66
You can’t perform that action at this time.
0 commit comments