From d35e538123ecfd6cde1fe3b4872d8fe6a47c73dd Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 29 May 2017 21:48:43 -0700 Subject: [PATCH] Add fourslash tests --- tests/baselines/reference/jsDocTypedef1.js | 234 ++++++++++++++++++ .../cases/fourslash/jsDocTypedefQuickInfo1.ts | 33 +++ 2 files changed, 267 insertions(+) create mode 100644 tests/baselines/reference/jsDocTypedef1.js create mode 100644 tests/cases/fourslash/jsDocTypedefQuickInfo1.ts diff --git a/tests/baselines/reference/jsDocTypedef1.js b/tests/baselines/reference/jsDocTypedef1.js new file mode 100644 index 0000000000..28410ee879 --- /dev/null +++ b/tests/baselines/reference/jsDocTypedef1.js @@ -0,0 +1,234 @@ +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/jsDocTypedef1.js", + "position": 189 + }, + "quickInfo": { + "kind": "parameter", + "kindModifiers": "", + "textSpan": { + "start": 189, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "opts", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "z", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "w", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "documentation": [], + "tags": [] + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/jsDocTypedef1.js", + "position": 424 + }, + "quickInfo": { + "kind": "parameter", + "kindModifiers": "", + "textSpan": { + "start": 424, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "opts1", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "documentation": [], + "tags": [] + } + } +] \ No newline at end of file diff --git a/tests/cases/fourslash/jsDocTypedefQuickInfo1.ts b/tests/cases/fourslash/jsDocTypedefQuickInfo1.ts new file mode 100644 index 0000000000..eea17f182e --- /dev/null +++ b/tests/cases/fourslash/jsDocTypedefQuickInfo1.ts @@ -0,0 +1,33 @@ +/// +// @allowJs: true +// @Filename: jsDocTypedef1.js +//// /** +//// * @typedef {Object} Opts +//// * @property {string} x +//// * @property {string=} y +//// * @property {string} [z] +//// * @property {string} [w="hi"] +//// * +//// * @param {Opts} opts +//// */ +//// function foo(/*1*/opts) { +//// opts.x; +///// } + +//// foo({x: 'abc'}); + +//// /** +//// * @typedef {object} Opts1 +//// * @property {string} x +//// * @property {string=} y +//// * @property {string} [z] +//// * @property {string} [w="hi"] +//// * +//// * @param {Opts1} opts +//// */ +//// function foo1(/*2*/opts1) { +//// opts1.x; +//// } +//// foo1({x: 'abc'}); + +verify.baselineQuickInfo(); \ No newline at end of file