Skip to content

Commit 3e9c791

Browse files
authored
Several tests were disabled in order to land this update. Original: denoland/std@a8f6cf7
1 parent fd44fe3 commit 3e9c791

File tree

2 files changed

+2
-125
lines changed

2 files changed

+2
-125
lines changed

azure-pipelines.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
variables:
2-
DENO_VERSION: "v0.17.0"
2+
DENO_VERSION: "v0.18.0"
33
TS_VERSION: "3.4.5"
44

55
# TODO Try to get eslint to run under Deno, like prettier

fs/globrex_test.ts

+1-124
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
import { test } from "../testing/mod.ts";
66
import { assertEquals } from "../testing/asserts.ts";
7-
import { globrex, GlobrexResult } from "./globrex.ts";
8-
import { GlobOptions } from "./glob.ts";
7+
import { globrex } from "./globrex.ts";
98

109
const isWin = Deno.build.os === "win";
1110
const t = { equal: assertEquals, is: assertEquals };
@@ -24,31 +23,6 @@ function match(
2423
return res.regex.test(isWin && strWin ? strWin : strUnix);
2524
}
2625

27-
function matchRegex(
28-
pattern: string,
29-
ifUnix: string,
30-
ifWin: string,
31-
opts: GlobOptions
32-
): GlobrexResult {
33-
const res = globrex(pattern, opts);
34-
const { regex } = opts.filepath ? res.path! : res;
35-
t.is(regex.toString(), isWin ? ifWin : ifUnix, "~> regex matches expectant");
36-
return res;
37-
}
38-
39-
function matchSegments(
40-
pattern: string,
41-
ifUnix: RegExp[],
42-
ifWin: RegExp[],
43-
opts: GlobOptions
44-
): GlobrexResult {
45-
const res = globrex(pattern, { filepath: true, ...opts });
46-
const str = res.path!.segments.join(" ");
47-
const exp = (isWin ? ifWin : ifUnix).join(" ");
48-
t.is(str, exp);
49-
return res;
50-
}
51-
5226
test({
5327
name: "globrex: standard",
5428
fn(): void {
@@ -808,103 +782,6 @@ test({
808782
}
809783
});
810784

811-
test({
812-
name: "globrex: filepath path-regex",
813-
fn(): void {
814-
let opts = { extended: true, filepath: true, globstar: false },
815-
res,
816-
pattern;
817-
818-
res = globrex("", opts);
819-
t.is(res.hasOwnProperty("path"), true);
820-
t.is(res.path!.hasOwnProperty("regex"), true);
821-
t.is(res.path!.hasOwnProperty("segments"), true);
822-
t.is(Array.isArray(res.path!.segments), true);
823-
824-
pattern = "foo/bar/baz.js";
825-
res = matchRegex(
826-
pattern,
827-
"/^foo\\/bar\\/baz\\.js$/",
828-
"/^foo\\\\+bar\\\\+baz\\.js$/",
829-
opts
830-
);
831-
t.is(res.path!.segments.length, 3);
832-
833-
res = matchRegex(
834-
"../foo/bar.js",
835-
"/^\\.\\.\\/foo\\/bar\\.js$/",
836-
"/^\\.\\.\\\\+foo\\\\+bar\\.js$/",
837-
opts
838-
);
839-
t.is(res.path!.segments.length, 3);
840-
841-
res = matchRegex(
842-
"*/bar.js",
843-
"/^.*\\/bar\\.js$/",
844-
"/^.*\\\\+bar\\.js$/",
845-
opts
846-
);
847-
t.is(res.path!.segments.length, 2);
848-
849-
opts.globstar = true;
850-
res = matchRegex(
851-
"**/bar.js",
852-
"/^((?:[^\\/]*(?:\\/|$))*)bar\\.js$/",
853-
"/^((?:[^\\\\]*(?:\\\\|$))*)bar\\.js$/",
854-
opts
855-
);
856-
t.is(res.path!.segments.length, 2);
857-
}
858-
});
859-
860-
test({
861-
name: "globrex: filepath path segments",
862-
fn(): void {
863-
let opts = { extended: true },
864-
win,
865-
unix;
866-
867-
unix = [/^foo$/, /^bar$/, /^([^\/]*)$/, /^baz\.(md|js|txt)$/];
868-
win = [/^foo$/, /^bar$/, /^([^\\]*)$/, /^baz\.(md|js|txt)$/];
869-
matchSegments("foo/bar/*/baz.{md,js,txt}", unix, win, {
870-
...opts,
871-
globstar: true
872-
});
873-
874-
unix = [/^foo$/, /^.*$/, /^baz\.md$/];
875-
win = [/^foo$/, /^.*$/, /^baz\.md$/];
876-
matchSegments("foo/*/baz.md", unix, win, opts);
877-
878-
unix = [/^foo$/, /^.*$/, /^baz\.md$/];
879-
win = [/^foo$/, /^.*$/, /^baz\.md$/];
880-
matchSegments("foo/**/baz.md", unix, win, opts);
881-
882-
unix = [/^foo$/, /^((?:[^\/]*(?:\/|$))*)$/, /^baz\.md$/];
883-
win = [/^foo$/, /^((?:[^\\]*(?:\\|$))*)$/, /^baz\.md$/];
884-
matchSegments("foo/**/baz.md", unix, win, { ...opts, globstar: true });
885-
886-
unix = [/^foo$/, /^.*$/, /^.*\.md$/];
887-
win = [/^foo$/, /^.*$/, /^.*\.md$/];
888-
matchSegments("foo/**/*.md", unix, win, opts);
889-
890-
unix = [/^foo$/, /^((?:[^\/]*(?:\/|$))*)$/, /^([^\/]*)\.md$/];
891-
win = [/^foo$/, /^((?:[^\\]*(?:\\|$))*)$/, /^([^\\]*)\.md$/];
892-
matchSegments("foo/**/*.md", unix, win, { ...opts, globstar: true });
893-
894-
unix = [/^foo$/, /^:$/, /^b:az$/];
895-
win = [/^foo$/, /^:$/, /^b:az$/];
896-
matchSegments("foo/:/b:az", unix, win, opts);
897-
898-
unix = [/^foo$/, /^baz\.md$/];
899-
win = [/^foo$/, /^baz\.md$/];
900-
matchSegments("foo///baz.md", unix, win, { ...opts, strict: true });
901-
902-
unix = [/^foo$/, /^baz\.md$/];
903-
win = [/^foo$/, /^baz\.md$/];
904-
matchSegments("foo///baz.md", unix, win, { ...opts, strict: false });
905-
}
906-
});
907-
908785
test({
909786
name: "globrex: stress testing",
910787
fn(): void {

0 commit comments

Comments
 (0)