From 0b247b12a35b004f90489fcd9bc05bdc210a6394 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 6 Mar 2017 14:49:50 -0800 Subject: [PATCH] Add tests --- tests/baselines/reference/checkJsFiles.errors.txt | 13 +++++++++++++ tests/baselines/reference/checkJsFiles2.errors.txt | 14 ++++++++++++++ tests/baselines/reference/checkJsFiles3.errors.txt | 14 ++++++++++++++ tests/cases/compiler/checkJsFiles.ts | 6 ++++++ tests/cases/compiler/checkJsFiles2.ts | 7 +++++++ tests/cases/compiler/checkJsFiles3.ts | 6 ++++++ 6 files changed, 60 insertions(+) create mode 100644 tests/baselines/reference/checkJsFiles.errors.txt create mode 100644 tests/baselines/reference/checkJsFiles2.errors.txt create mode 100644 tests/baselines/reference/checkJsFiles3.errors.txt create mode 100644 tests/cases/compiler/checkJsFiles.ts create mode 100644 tests/cases/compiler/checkJsFiles2.ts create mode 100644 tests/cases/compiler/checkJsFiles3.ts diff --git a/tests/baselines/reference/checkJsFiles.errors.txt b/tests/baselines/reference/checkJsFiles.errors.txt new file mode 100644 index 00000000000..8371e101dd1 --- /dev/null +++ b/tests/baselines/reference/checkJsFiles.errors.txt @@ -0,0 +1,13 @@ +error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. +tests/cases/compiler/a.js(3,1): error TS2322: Type '0' is not assignable to type 'string'. + + +!!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. +==== tests/cases/compiler/a.js (1 errors) ==== + + var x = "string"; + x = 0; + ~ +!!! error TS2322: Type '0' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/checkJsFiles2.errors.txt b/tests/baselines/reference/checkJsFiles2.errors.txt new file mode 100644 index 00000000000..566ba3786b8 --- /dev/null +++ b/tests/baselines/reference/checkJsFiles2.errors.txt @@ -0,0 +1,14 @@ +error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. +tests/cases/compiler/a.js(4,1): error TS2322: Type '0' is not assignable to type 'string'. + + +!!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. +==== tests/cases/compiler/a.js (1 errors) ==== + + // @check + var x = "string"; + x = 0; + ~ +!!! error TS2322: Type '0' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/checkJsFiles3.errors.txt b/tests/baselines/reference/checkJsFiles3.errors.txt new file mode 100644 index 00000000000..566ba3786b8 --- /dev/null +++ b/tests/baselines/reference/checkJsFiles3.errors.txt @@ -0,0 +1,14 @@ +error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. + Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. +tests/cases/compiler/a.js(4,1): error TS2322: Type '0' is not assignable to type 'string'. + + +!!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. +!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. +==== tests/cases/compiler/a.js (1 errors) ==== + + // @check + var x = "string"; + x = 0; + ~ +!!! error TS2322: Type '0' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/cases/compiler/checkJsFiles.ts b/tests/cases/compiler/checkJsFiles.ts new file mode 100644 index 00000000000..c36673b0239 --- /dev/null +++ b/tests/cases/compiler/checkJsFiles.ts @@ -0,0 +1,6 @@ +// @allowJs: true +// @checkJsFiles: true + +// @fileName: a.js +var x = "string"; +x = 0; \ No newline at end of file diff --git a/tests/cases/compiler/checkJsFiles2.ts b/tests/cases/compiler/checkJsFiles2.ts new file mode 100644 index 00000000000..fe8978666b0 --- /dev/null +++ b/tests/cases/compiler/checkJsFiles2.ts @@ -0,0 +1,7 @@ +// @allowJs: true +// @checkJsFiles: false + +// @fileName: a.js +// @check +var x = "string"; +x = 0; \ No newline at end of file diff --git a/tests/cases/compiler/checkJsFiles3.ts b/tests/cases/compiler/checkJsFiles3.ts new file mode 100644 index 00000000000..964f909bc6f --- /dev/null +++ b/tests/cases/compiler/checkJsFiles3.ts @@ -0,0 +1,6 @@ +// @allowJs: true + +// @fileName: a.js +// @check +var x = "string"; +x = 0; \ No newline at end of file