From a9217a76e568bb2b840b4143d21526ddab12aa17 Mon Sep 17 00:00:00 2001 From: Evilebot Tnawi Date: Fri, 15 Nov 2019 13:10:13 +0300 Subject: [PATCH] fix: tests for empty type parameters in TS (#6960) --- .../__snapshots__/jsfmt.spec.js.snap | 51 +++++++++++++++++++ tests/typescript_error_recovery/generic.ts | 19 +++++++ tests/typescript_error_recovery/jsfmt.spec.js | 1 + 3 files changed, 71 insertions(+) create mode 100644 tests/typescript_error_recovery/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/typescript_error_recovery/generic.ts create mode 100644 tests/typescript_error_recovery/jsfmt.spec.js diff --git a/tests/typescript_error_recovery/__snapshots__/jsfmt.spec.js.snap b/tests/typescript_error_recovery/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..e37181540 --- /dev/null +++ b/tests/typescript_error_recovery/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,51 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`generic.ts 1`] = ` +====================================options===================================== +parsers: ["typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +f1<>(); + +new f2<>(); + +function f3<>() {} + +class f4 { + constructor<>() {} +} + +const f5 = function<>() {} + +interface f6<> { + test<>(); +} + +class f7<> { + test<>() {} +} + +=====================================output===================================== +f1<>(); + +new f2<>(); + +function f3<>() {} + +class f4 { + constructor<>() {} +} + +const f5 = function<>() {}; + +interface f6<> { + test<>(); +} + +class f7<> { + test<>() {} +} + +================================================================================ +`; diff --git a/tests/typescript_error_recovery/generic.ts b/tests/typescript_error_recovery/generic.ts new file mode 100644 index 000000000..aa18ea0f9 --- /dev/null +++ b/tests/typescript_error_recovery/generic.ts @@ -0,0 +1,19 @@ +f1<>(); + +new f2<>(); + +function f3<>() {} + +class f4 { + constructor<>() {} +} + +const f5 = function<>() {} + +interface f6<> { + test<>(); +} + +class f7<> { + test<>() {} +} diff --git a/tests/typescript_error_recovery/jsfmt.spec.js b/tests/typescript_error_recovery/jsfmt.spec.js new file mode 100644 index 000000000..2ea3bb6eb --- /dev/null +++ b/tests/typescript_error_recovery/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, ["typescript"]);