Added tests for dotted namespace declarations, object literal methods.

This commit is contained in:
Daniel Rosenwasser 2015-09-24 17:09:16 -07:00
parent 67b44b59c0
commit 08e2b0a159
5 changed files with 135 additions and 0 deletions

View File

@ -39,6 +39,13 @@ confirmNormalizedJsDoc("0", Indentation.Standard, `
*
*/`);
confirmNormalizedJsDoc("1", Indentation.Indented,
`/**
*
*/`);
confirmNormalizedJsDoc("2", Indentation.Indented,
`/**
*

View File

@ -0,0 +1,46 @@
/// <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, indentation: number, template: string): void {
goTo.marker(markerName);
const normalized = useCRLFAndStripLeadingNewline(template);
verify.DocCommentTemplate(normalized, indentation);
}
const enum Indentation {
Indented = 12,
}
////class C {
//// /*0*/
//// [Symbol.iterator]() {
//// return undefined;
//// }
//// /*1*/
//// [1 + 2 + 3 + Math.rand()](x: number, y: string, z = true) { }
////}
confirmNormalizedJsDoc("0", Indentation.Indented,
`/**
*
*/`);
confirmNormalizedJsDoc("1", Indentation.Indented,
`/**
*
* @param x
* @param y
* @param z
*/`);

View File

@ -0,0 +1,36 @@
/// <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, charOffset: number, template: string): void {
goTo.marker(markerName);
const normalized = useCRLFAndStripLeadingNewline(template);
verify.DocCommentTemplate(normalized, charOffset);
}
/////*top*/
////namespace n1.
//// /*n2*/ n2.
//// /*n3*/ n3 {
////}
confirmNormalizedJsDoc("top", /*indentation*/ 8, `
/**
*
*/`);
goTo.marker("n2");
verify.noDocCommentTemplate();
goTo.marker("n3");
verify.noDocCommentTemplate();

View File

@ -0,0 +1,46 @@
/// <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, indentation: number, template: string): void {
goTo.marker(markerName);
const normalized = useCRLFAndStripLeadingNewline(template);
verify.DocCommentTemplate(normalized, indentation);
}
const enum Indentation {
Indented = 12,
}
////var x = {
//// /*0*/
//// foo() {
//// return undefined;
//// }
//// /*1*/
//// [1 + 2 + 3 + Math.rand()](x: number, y: string, z = true) { }
////}
confirmNormalizedJsDoc("0", Indentation.Indented,
`/**
*
*/`);
confirmNormalizedJsDoc("1", Indentation.Indented,
`/**
*
* @param x
* @param y
* @param z
*/`);