TypeScript/tests/cases/fourslash/quickInfoDisplayPartsFunctionExpression.ts
Cyrus Najmabadi eed6f0deca Use an output format for quickinfo that more closely matches the original source.
i.e. use  "var v: string" instead of "(var) v: string".

The parens case should only be used when we're using an english description instead of
an actual language construct.
2015-03-24 00:16:49 -07:00

45 lines
1.8 KiB
TypeScript

/// <reference path='fourslash.ts'/>
////var /*1*/x = function /*2*/foo() {
//// /*3*/foo();
////};
////var /*4*/y = function () {
////};
////(function /*5*/foo1() {
//// /*6*/foo1();
////})();
var marker = 0;
function verifyInstance(instanceName: string) {
marker++;
goTo.marker(marker.toString());
verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName(marker.toString()).position, length: instanceName.length },
[{ text: "var", kind: "keyword" },
{ text: " ", kind: "space" }, { text: instanceName, kind: "localName" }, { text: ":", kind: "punctuation" },
{ text: " ", kind: "space" }, { text: "(", kind: "punctuation" }, { text: ")", kind: "punctuation" },
{ text: " ", kind: "space" }, { text: "=>", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "void", kind: "keyword" }],
[]);
}
function verifyNamedFunctionExpression(functionName: string) {
marker++;
goTo.marker(marker.toString());
verify.verifyQuickInfoDisplayParts("local function", "", { start: test.markerByName(marker.toString()).position, length: functionName.length },
[{ text: "(", kind: "punctuation" }, { text: "local function", kind: "text" }, { text: ")", kind: "punctuation" },
{ text: " ", kind: "space" }, { text: functionName, kind: "functionName" }, { text: "(", kind: "punctuation" },
{ text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "void", kind: "keyword" }],
[]);
}
verifyInstance("x");
// Declaration
verifyNamedFunctionExpression("foo");
// Call
verifyNamedFunctionExpression("foo");
verifyInstance("y");
// Declaration
verifyNamedFunctionExpression("foo1");
// Call
verifyNamedFunctionExpression("foo1");