Add initial tests

This commit is contained in:
Nathan Shively-Sanders
2018-05-01 10:16:36 -07:00
parent 5ea4d3b2bb
commit f9f9157126
4 changed files with 91 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
// @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: cb.js
/** @callback Sid
* @param {string} s
* @returns {string} What were you expecting
*/
/** @type {Sid} smallId */
var sid = s => s + "!";

View File

@@ -0,0 +1,31 @@
/// <reference path="../fourslash.ts"/>
// @allowNonTsExtensions: true
// @Filename: jsdocCallbackTag.js
//// /**
//// * @callback FooHandler
//// * @param {string} eventName - So many words
//// * @param eventName2 {number | string} - Silence is golden
//// * @param eventName3 - Osterreich mos def
//// */
//// /**
//// * @type {FooHandler} callback
//// */
//// var t/*1*/;
////
//// /**
//// * @callback FooHandler2 - What, another one?
//// * @param {string=} eventName - it keeps happening
//// * @param {string} [eventName2] - i WARNED you dog
//// */
//// /**
//// * @type {FooHandler2} callback
//// */
//// var t2/*2*/;
goTo.marker("1");
verify.quickInfoIs("var t: (eventName: string, eventName2: number | string, eventName3: any) => void");
goTo.marker("2");
verify.quickInfoIs("var t2: (eventName?: string, eventName2?: string) => void");

View File

@@ -0,0 +1,33 @@
/// <reference path="../fourslash.ts"/>
// @allowNonTsExtensions: true
// @Filename: jsDocCallback.js
//// /**
//// * @callback FooCallback
//// * @param {string} eventName - What even is the navigation bar?
//// */
//// /** @type {FooCallback} */
//// var t;
verify.navigationBar([
{
"text": "<global>",
"kind": "module",
"childItems": [
{
"text": "FooCallback",
"kind": "type"
},
{
"text": "t",
"kind": "var"
}
]
},
{
"text": "FooCallback",
"kind": "type",
"indent": 1
}
])

View File

@@ -0,0 +1,15 @@
/// <reference path="../fourslash.ts"/>
// @allowNonTsExtensions: true
// @Filename: jsDocCallback.js
////
//// /**
//// * @callback [|FooCallback|]
//// * @param {string} eventName - Rename should work
//// */
////
//// /** @type {/*1*/[|FooCallback|]} */
//// var t;
const ranges = test.ranges();
verify.renameLocations(ranges[0], { findInStrings: false, findInComments: true, ranges });