From e68c53f708c69e7ea509f2240b318de03c9e7b39 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 15 Dec 2014 14:55:46 -0800 Subject: [PATCH] Separated fourslash test to two files. --- ...TypedFunctionInTaggedTemplateExpression.ts | 44 ------------------- ...ypedFunctionInTaggedTemplateExpression1.ts | 19 ++++++++ ...ypedFunctionInTaggedTemplateExpression2.ts | 31 +++++++++++++ 3 files changed, 50 insertions(+), 44 deletions(-) delete mode 100644 tests/cases/fourslash/quickInfoForContextuallyTypedFunctionInTaggedTemplateExpression.ts create mode 100644 tests/cases/fourslash/quickInfoForContextuallyTypedFunctionInTaggedTemplateExpression1.ts create mode 100644 tests/cases/fourslash/quickInfoForContextuallyTypedFunctionInTaggedTemplateExpression2.ts diff --git a/tests/cases/fourslash/quickInfoForContextuallyTypedFunctionInTaggedTemplateExpression.ts b/tests/cases/fourslash/quickInfoForContextuallyTypedFunctionInTaggedTemplateExpression.ts deleted file mode 100644 index 6d30d59ebd9..00000000000 --- a/tests/cases/fourslash/quickInfoForContextuallyTypedFunctionInTaggedTemplateExpression.ts +++ /dev/null @@ -1,44 +0,0 @@ -/// - -////function tempTag1(templateStrs: TemplateStringsArray, f: (x: T) => T, x: T): T; -////function tempTag1(templateStrs: TemplateStringsArray, f: (x: T) => T, h: (y: T) => T, x: T): T; -////function tempTag1(...rest: any[]): T { -//// return undefined; -////} -//// -////tempTag1 `${ x => /*0*/x }${ 10 }`; -////tempTag1 `${ x => /*1*/x }${ x => /*2*/x }${ 10 }`; -////tempTag1 `${ x => /*3*/x }${ (x: number) => /*4*/x }${ undefined }`; -////tempTag1 `${ (x: number) => /*5*/x }${ x => /*6*/x }${ undefined }`; -//// -////function tempTag2(templateStrs: TemplateStringsArray, f: (x: number) => number, x: number): number; -////function tempTag2(templateStrs: TemplateStringsArray, f: (x: string) => string, h: (y: string) => string, x: string): string; -////function tempTag2(...rest: any[]): any { -//// return undefined; -////} -//// -////tempTag2 `${ x => /*7*/x }${ 0 }`; -////tempTag2 `${ x => /*8*/x }${ undefined }`; -////tempTag2 `${ x => /*9*/x }${ x => /*10*/x }${ "hello" }`; -////tempTag2 `${ x => /*11*/x }${ undefined }${ "hello" }`; - -// The first group of parameters, [0, 8], should all be contextually typed as 'number'. -// The second group, [9, 11], should be typed as 'string'. -var numTypedVariableCount = 9; -var strTypedVariableCount = 3; - -var markers = test.markers(); - -if (numTypedVariableCount + strTypedVariableCount !== markers.length) { - throw "Unexpected number of markers in file."; -} - -for (var i = 0; i < numTypedVariableCount; i++) { - goTo.marker("" + i); - verify.quickInfoIs("(parameter) x: number"); -} - -for (var i = 0; i < strTypedVariableCount; i++) { - goTo.marker("" + (i + numTypedVariableCount)); - verify.quickInfoIs("(parameter) x: string"); -} \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoForContextuallyTypedFunctionInTaggedTemplateExpression1.ts b/tests/cases/fourslash/quickInfoForContextuallyTypedFunctionInTaggedTemplateExpression1.ts new file mode 100644 index 00000000000..ce6b454843a --- /dev/null +++ b/tests/cases/fourslash/quickInfoForContextuallyTypedFunctionInTaggedTemplateExpression1.ts @@ -0,0 +1,19 @@ +/// + +////function tempTag1(templateStrs: TemplateStringsArray, f: (x: T) => T, x: T): T; +////function tempTag1(templateStrs: TemplateStringsArray, f: (x: T) => T, h: (y: T) => T, x: T): T; +////function tempTag1(...rest: any[]): T { +//// return undefined; +////} +//// +////tempTag1 `${ x => /*0*/x }${ 10 }`; +////tempTag1 `${ x => /*1*/x }${ x => /*2*/x }${ 10 }`; +////tempTag1 `${ x => /*3*/x }${ (x: number) => /*4*/x }${ undefined }`; +////tempTag1 `${ (x: number) => /*5*/x }${ x => /*6*/x }${ undefined }`; + +var markers = test.markers(); + +markers.forEach(marker => { + goTo.position(marker.position); + verify.quickInfoIs("(parameter) x: number"); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoForContextuallyTypedFunctionInTaggedTemplateExpression2.ts b/tests/cases/fourslash/quickInfoForContextuallyTypedFunctionInTaggedTemplateExpression2.ts new file mode 100644 index 00000000000..d878d601416 --- /dev/null +++ b/tests/cases/fourslash/quickInfoForContextuallyTypedFunctionInTaggedTemplateExpression2.ts @@ -0,0 +1,31 @@ +/// + +////function tempTag2(templateStrs: TemplateStringsArray, f: (x: number) => number, x: number): number; +////function tempTag2(templateStrs: TemplateStringsArray, f: (x: string) => string, h: (y: string) => string, x: string): string; +////function tempTag2(...rest: any[]): any { +//// return undefined; +////} +//// +////tempTag2 `${ x => /*0*/x }${ 0 }`; +////tempTag2 `${ /*1*/x => /*2*/x }${ undefined }`; +////tempTag2 `${ x => /*3*/x }${ x => /*4*/x }${ "hello" }`; +////tempTag2 `${ x => /*5*/x }${ undefined }${ "hello" }`; + +// The first group of parameters, [0, 2], should all be contextually typed as 'number'. +// The second group, [3, 5], should be typed as 'string'. +var numTypedVariableCount = 3; +var strTypedVariableCount = 3; + +if (numTypedVariableCount + strTypedVariableCount !== test.markers().length) { + throw "Unexpected number of markers in file."; +} + +for (var i = 0; i < numTypedVariableCount; i++) { + goTo.marker("" + i); + verify.quickInfoIs("(parameter) x: number"); +} + +for (var i = 0; i < strTypedVariableCount; i++) { + goTo.marker("" + (i + numTypedVariableCount)); + verify.quickInfoIs("(parameter) x: string"); +} \ No newline at end of file