mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-24 02:21:30 -05:00
Detailed comments for regular expressions and renamed some files.
This commit is contained in:
@@ -131,7 +131,7 @@ var languageServiceLibrarySources = [
|
||||
|
||||
var harnessCoreSources = [
|
||||
"harness.ts",
|
||||
"vfs.ts",
|
||||
"virtualFileSystem.ts",
|
||||
"sourceMapRecorder.ts",
|
||||
"harnessLanguageService.ts",
|
||||
"fourslash.ts",
|
||||
@@ -163,7 +163,7 @@ var harnessSources = harnessCoreSources.concat([
|
||||
"cachingInServerLSHost.ts",
|
||||
"moduleResolution.ts",
|
||||
"tsconfigParsing.ts",
|
||||
"expandFiles.ts"
|
||||
"matchFiles.ts"
|
||||
].map(function (f) {
|
||||
return path.join(unittestsDirectory, f);
|
||||
})).concat([
|
||||
|
||||
@@ -582,9 +582,61 @@ namespace ts {
|
||||
return { options, errors };
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests for a path that ends in a recursive directory wildcard.
|
||||
* Matches **, /**, /**\/, and /**\/, but not a**b.
|
||||
*
|
||||
* NOTE: used \/ in place of / above to avoid ending the comment.
|
||||
*
|
||||
* Breakdown:
|
||||
* (^|\/) # matches either the beginning of the string or a directory separator.
|
||||
* \*\* # matches the recursive directory wildcard "**".
|
||||
* \/?$ # matches an optional trailing directory separator at the end of the string.
|
||||
*/
|
||||
const invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/;
|
||||
|
||||
/**
|
||||
* Tests for a path with multiple recursive directory wildcards.
|
||||
* Matches **\/** and **\/a/**, but not **\/a**b.
|
||||
*
|
||||
* NOTE: used \/ in place of / above to avoid ending the comment.
|
||||
*
|
||||
* Breakdown:
|
||||
* (^|\/) # matches either the beginning of the string or a directory separator.
|
||||
* \*\*\/ # matches a recursive directory wildcard "**" followed by a directory separator.
|
||||
* (.*\/)? # optionally matches any number of characters followed by a directory separator.
|
||||
* \*\* # matches a recursive directory wildcard "**"
|
||||
* ($|\/) # matches either the end of the string or a directory separator.
|
||||
*/
|
||||
const invalidMultipleRecursionPatterns = /(^|\/)\*\*\/(.*\/)?\*\*($|\/)/;
|
||||
|
||||
/**
|
||||
* Tests for a path containing a wildcard character in a directory component of the path.
|
||||
* Matches /*\/, /?/, and /a*b/, but not /a/ or /a/*.
|
||||
*
|
||||
* NOTE: used \/ in place of / above to avoid ending the comment.
|
||||
*
|
||||
* Breakdown:
|
||||
* \/ # matches a directory separator.
|
||||
* [^/]*? # matches any number of characters excluding directory separators (non-greedy).
|
||||
* [*?] # matches either a wildcard character (* or ?)
|
||||
* [^/]* # matches any number of characters excluding directory separators (greedy).
|
||||
* \/ # matches a directory separator.
|
||||
*/
|
||||
const watchRecursivePattern = /\/[^/]*?[*?][^/]*\//;
|
||||
|
||||
/**
|
||||
* Matches the portion of a wildcard path that does not contain wildcards.
|
||||
* Matches /a of /a/*, or /a/b/c of /a/b/c/?/d.
|
||||
*
|
||||
* Breakdown:
|
||||
* ^ # matches the beginning of the string
|
||||
* [^*?]* # matches any number of non-wildcard characters
|
||||
* (?=\/[^/]*[*?]) # lookahead that matches a directory separator followed by
|
||||
* # a path component that contains at least one wildcard character (* or ?).
|
||||
*/
|
||||
const wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
|
||||
|
||||
/**
|
||||
* Expands an array of file specifications.
|
||||
*
|
||||
@@ -693,9 +745,6 @@ namespace ts {
|
||||
return validSpecs;
|
||||
}
|
||||
|
||||
const watchRecursivePattern = /\/[^/]*?[*?][^/]*\//;
|
||||
const wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
|
||||
|
||||
/**
|
||||
* Gets directories in a set of include patterns that should be watched for changes.
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
/// <reference path="external\chai.d.ts"/>
|
||||
/// <reference path="sourceMapRecorder.ts"/>
|
||||
/// <reference path="runnerbase.ts"/>
|
||||
/// <reference path="vfs.ts" />
|
||||
/// <reference path="virtualFileSystem.ts" />
|
||||
/* tslint:disable:no-null */
|
||||
|
||||
// Block scoped definitions work poorly for global variables, temporarily enable var
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/// <reference path="..\..\..\src\harness\external\mocha.d.ts" />
|
||||
/// <reference path="..\..\..\src\harness\harness.ts" />
|
||||
/// <reference path="..\..\..\src\harness\virtualFileSystem.ts" />
|
||||
|
||||
namespace ts {
|
||||
class MockParseConfigHost extends Utils.VirtualFileSystem implements ParseConfigHost {
|
||||
@@ -89,7 +90,7 @@ namespace ts {
|
||||
"c:/dev/f.other"
|
||||
]);
|
||||
|
||||
describe("expandFiles", () => {
|
||||
describe("matchFiles", () => {
|
||||
describe("with literal file list", () => {
|
||||
it("without exclusions", () => {
|
||||
const json = {
|
||||
Reference in New Issue
Block a user