mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Added tests for dotted namespace declarations, object literal methods.
This commit is contained in:
parent
67b44b59c0
commit
08e2b0a159
@ -39,6 +39,13 @@ confirmNormalizedJsDoc("0", Indentation.Standard, `
|
||||
*
|
||||
*/`);
|
||||
|
||||
|
||||
confirmNormalizedJsDoc("1", Indentation.Indented,
|
||||
`/**
|
||||
*
|
||||
*/`);
|
||||
|
||||
|
||||
confirmNormalizedJsDoc("2", Indentation.Indented,
|
||||
`/**
|
||||
*
|
||||
|
||||
@ -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
|
||||
*/`);
|
||||
@ -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();
|
||||
@ -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
|
||||
*/`);
|
||||
Loading…
x
Reference in New Issue
Block a user