1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
/// <reference path='fourslash.ts' />
const CRLF = "\r\n";
/**
* @returns the given value with '\n' normalized to '\r\n' and with no leading newline
*/
function useCRLFAndStripLeadingNewline(str: string): string {
str = str.replace(/\r?\n/g, CRLF);
if (str.indexOf(CRLF) === 0) {
str = str.slice(CRLF.length);
}
return str;
}
function confirmNormalizedJsDoc(markerName: string, newTextOffset: number, template: string): void {
goTo.marker(markerName);
const normalized = useCRLFAndStripLeadingNewline(template);
verify.DocCommentTemplate(normalized, newTextOffset);
}
/////*a*/
////var a = 10;
////
/////*b*/
////let b = "";
////
/////*c*/
////const c = 30;
////
/////*d*/
////let d = {
//// foo: 10,
//// bar: "20"
////};
////
/////*e*/
////let e = function e(x, y, z) {
//// return +(x + y + z);
////};
////
/////*f*/
////let f = class F {
//// constructor(a, b, c) {
//// this.a = a;
//// this.b = b || (this.c = c);
//// }
////}
for (const varName of "abcd".split("")) {
confirmNormalizedJsDoc(varName, /*newTextOffset*/ 8, `
/**
*
*/`);
}
confirmNormalizedJsDoc("e", /*newTextOffset*/ 8, `
/**
*
* @param x
* @param y
* @param z
*/`);
confirmNormalizedJsDoc("f", /*newTextOffset*/ 8, `
/**
*
* @param a
* @param b
* @param c
*/`);
|