Skip to content

Commit

Permalink
Merge pull request #22450 from Microsoft/reenableTest
Browse files Browse the repository at this point in the history
Enable the commented out test and convert folder entries to sorted list
  • Loading branch information
sheetalkamat authored Mar 12, 2018
2 parents ac5a39c + a0cd8d3 commit 3f2ff01
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/compiler/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ namespace ts {
* Make `elements` into a `NodeArray<T>`. If `elements` is `undefined`, returns an empty `NodeArray<T>`.
*/
export function createNodeArray<T extends Node>(elements?: ReadonlyArray<T>, hasTrailingComma?: boolean): NodeArray<T> {
if (elements) {
if (!elements || elements === emptyArray) {
elements = [];
}
else {
if (isNodeArray(elements)) {
return elements;
}
}
else {
elements = [];
}

const array = <NodeArray<T>>elements;
array.pos = -1;
Expand Down
6 changes: 3 additions & 3 deletions src/harness/unittests/tscWatchMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2333,9 +2333,9 @@ declare module "fs" {
verifyRenamingFileInSubFolder(TestFSWithWatch.Tsc_WatchDirectory.NonRecursiveWatchDirectory);
});

// it("uses non recursive dynamic polling when renaming file in subfolder", () => {
// verifyRenamingFileInSubFolder(TestFSWithWatch.Tsc_WatchDirectory.DynamicPolling);
// });
it("uses non recursive dynamic polling when renaming file in subfolder", () => {
verifyRenamingFileInSubFolder(TestFSWithWatch.Tsc_WatchDirectory.DynamicPolling);
});
});
});
}
6 changes: 3 additions & 3 deletions src/harness/virtualFileSystemWithWatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ interface Array<T> {}`
}

interface Folder extends FSEntry {
entries: FSEntry[];
entries: SortedArray<FSEntry>;
}

interface SymLink extends FSEntry {
Expand Down Expand Up @@ -504,7 +504,7 @@ interface Array<T> {}`
}

private addFileOrFolderInFolder(folder: Folder, fileOrDirectory: File | Folder | SymLink, ignoreWatch?: boolean) {
folder.entries.push(fileOrDirectory);
insertSorted(folder.entries, fileOrDirectory, (a, b) => compareStringsCaseSensitive(getBaseFileName(a.path), getBaseFileName(b.path)));
folder.modifiedTime = new Date();
this.fs.set(fileOrDirectory.path, fileOrDirectory);

Expand Down Expand Up @@ -606,7 +606,7 @@ interface Array<T> {}`

private toFolder(path: string): Folder {
const folder = this.toFsEntry(path) as Folder;
folder.entries = [];
folder.entries = [] as SortedArray<FSEntry>;
return folder;
}

Expand Down

0 comments on commit 3f2ff01

Please sign in to comment.