forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests when realpath supresses the casing error
- Loading branch information
1 parent
42165a1
commit 4a808aa
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/testRunner/unittests/tsc/forceConsistentCasingInFileNames.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace ts { | ||
describe("unittests:: tsc:: forceConsistentCasingInFileNames::", () => { | ||
verifyTsc({ | ||
scenario: "forceConsistentCasingInFileNames", | ||
subScenario: "with relative and non relative file resolutions", | ||
commandLineArgs: ["/src/project/src/struct.d.ts", "--forceConsistentCasingInFileNames", "--explainFiles"], | ||
fs: () => loadProjectFromFiles({ | ||
"/src/project/src/struct.d.ts": Utils.dedent` | ||
import * as xs1 from "fp-ts/lib/Struct"; | ||
import * as xs2 from "fp-ts/lib/struct"; | ||
import * as xs3 from "./Struct"; | ||
import * as xs4 from "./struct"; | ||
`, | ||
"/src/project/node_modules/fp-ts/lib/struct.d.ts": `export function foo(): void`, | ||
}), | ||
}); | ||
}); | ||
} |
59 changes: 59 additions & 0 deletions
59
...e/tsc/forceConsistentCasingInFileNames/with-relative-and-non-relative-file-resolutions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
Input:: | ||
//// [/lib/lib.d.ts] | ||
/// <reference no-default-lib="true"/> | ||
interface Boolean {} | ||
interface Function {} | ||
interface CallableFunction {} | ||
interface NewableFunction {} | ||
interface IArguments {} | ||
interface Number { toExponential: any; } | ||
interface Object {} | ||
interface RegExp {} | ||
interface String { charAt: any; } | ||
interface Array<T> { length: number; [n: number]: T; } | ||
interface ReadonlyArray<T> {} | ||
declare const console: { log(msg: any): void; }; | ||
|
||
//// [/src/project/node_modules/fp-ts/lib/struct.d.ts] | ||
export function foo(): void | ||
|
||
//// [/src/project/src/struct.d.ts] | ||
import * as xs1 from "fp-ts/lib/Struct"; | ||
import * as xs2 from "fp-ts/lib/struct"; | ||
import * as xs3 from "./Struct"; | ||
import * as xs4 from "./struct"; | ||
|
||
|
||
|
||
|
||
Output:: | ||
/lib/tsc /src/project/src/struct.d.ts --forceConsistentCasingInFileNames --explainFiles | ||
[96msrc/project/src/struct.d.ts[0m:[93m3[0m:[93m22[0m - [91merror[0m[90m TS1149: [0mFile name '/src/project/src/Struct.d.ts' differs from already included file name '/src/project/src/struct.d.ts' only in casing. | ||
The file is in the program because: | ||
Root file specified for compilation | ||
Imported via "./Struct" from file '/src/project/src/struct.d.ts' | ||
Imported via "./struct" from file '/src/project/src/struct.d.ts' | ||
|
||
[7m3[0m import * as xs3 from "./Struct"; | ||
[7m [0m [91m ~~~~~~~~~~[0m | ||
|
||
[96msrc/project/src/struct.d.ts[0m:[93m4[0m:[93m22[0m | ||
[7m4[0m import * as xs4 from "./struct"; | ||
[7m [0m [96m ~~~~~~~~~~[0m | ||
File is included via import here. | ||
|
||
lib/lib.d.ts | ||
Default library for target 'es3' | ||
src/project/node_modules/fp-ts/lib/struct.d.ts | ||
Imported via "fp-ts/lib/Struct" from file 'src/project/src/struct.d.ts' | ||
Imported via "fp-ts/lib/struct" from file 'src/project/src/struct.d.ts' | ||
src/project/src/struct.d.ts | ||
Root file specified for compilation | ||
Imported via "./Struct" from file 'src/project/src/struct.d.ts' | ||
Imported via "./struct" from file 'src/project/src/struct.d.ts' | ||
|
||
Found 1 error in src/project/src/struct.d.ts[90m:3[0m | ||
|
||
exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated | ||
|
||
|