mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-20 05:17:43 -05:00
Modified/added tests.
This commit is contained in:
@@ -28,27 +28,43 @@ function confirmNormalizedJsDoc(markerName: string, newTextOffset: number, templ
|
||||
////const c = 30;
|
||||
////
|
||||
/////*d*/
|
||||
////let d = function d(x, y, z) {
|
||||
//// return +(x + y + z);
|
||||
////let d = {
|
||||
//// foo: 10,
|
||||
//// bar: "20"
|
||||
////};
|
||||
////
|
||||
/////*e*/
|
||||
////let e = class 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);
|
||||
//// }
|
||||
////}
|
||||
////
|
||||
/////*f*/
|
||||
////let f = {
|
||||
//// foo: 10,
|
||||
//// bar: "20"
|
||||
////};
|
||||
|
||||
for (const varName of "abcdef".split("")) {
|
||||
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
|
||||
*/`);
|
||||
@@ -0,0 +1,90 @@
|
||||
/// <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 = x => x
|
||||
////
|
||||
/////*b*/
|
||||
////let b = (x,y,z) => x + y + z;
|
||||
////
|
||||
/////*c*/
|
||||
////const c = ((x => +x))
|
||||
////
|
||||
/////*d*/
|
||||
////let d = (function () { })
|
||||
////
|
||||
/////*e*/
|
||||
////let e = function e([a,b,c]) {
|
||||
//// return "hello"
|
||||
////};
|
||||
////
|
||||
/////*f*/
|
||||
////let f = class {
|
||||
////}
|
||||
////
|
||||
/////*g*/
|
||||
////const g = ((class G {
|
||||
//// constructor(private x);
|
||||
//// constructor(x,y,z);
|
||||
//// constructor(x,y,z, ...okayThatsEnough) {
|
||||
//// }
|
||||
////}))
|
||||
|
||||
confirmNormalizedJsDoc("a", /*newTextOffset*/ 8, `
|
||||
/**
|
||||
*
|
||||
* @param x
|
||||
*/`);
|
||||
|
||||
confirmNormalizedJsDoc("b", /*newTextOffset*/ 8, `
|
||||
/**
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
*/`);
|
||||
|
||||
confirmNormalizedJsDoc("c", /*newTextOffset*/ 8, `
|
||||
/**
|
||||
*
|
||||
* @param x
|
||||
*/`);
|
||||
|
||||
confirmNormalizedJsDoc("d", /*newTextOffset*/ 8, `
|
||||
/**
|
||||
*
|
||||
*/`);
|
||||
|
||||
confirmNormalizedJsDoc("e", /*newTextOffset*/ 8, `
|
||||
/**
|
||||
*
|
||||
* @param param0
|
||||
*/`);
|
||||
|
||||
confirmNormalizedJsDoc("f", /*newTextOffset*/ 8, `
|
||||
/**
|
||||
*
|
||||
*/`);
|
||||
|
||||
confirmNormalizedJsDoc("g", /*newTextOffset*/ 8, `
|
||||
/**
|
||||
*
|
||||
* @param x
|
||||
*/`);
|
||||
Reference in New Issue
Block a user