Modified/added tests.

This commit is contained in:
Daniel Rosenwasser
2015-09-25 16:27:58 -07:00
parent a458d4b2f4
commit 7b7e62ce72
2 changed files with 116 additions and 10 deletions

View File

@@ -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
*/`);

View File

@@ -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
*/`);