Add fourslash tests

This commit is contained in:
Yui T 2017-05-29 21:48:43 -07:00
parent 5c7c113203
commit d35e538123
2 changed files with 267 additions and 0 deletions

View file

@ -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": []
}
}
]

View file

@ -0,0 +1,33 @@
/// <reference path="fourslash.ts" />
// @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();