From 049b8fb2d0ff47cfa40bb7846e2dbdbb1a1ba62f Mon Sep 17 00:00:00 2001 From: Ahmad Farid Date: Mon, 6 Apr 2015 14:42:43 -0700 Subject: [PATCH] Addressing PR comments and adding unit tests --- .../fourslash/getOutliningForBlockComments.ts | 17 ++-- .../getOutliningForSingleLineComments.ts | 81 +++++++++++++++++++ 2 files changed, 90 insertions(+), 8 deletions(-) create mode 100644 tests/cases/fourslash/getOutliningForSingleLineComments.ts diff --git a/tests/cases/fourslash/getOutliningForBlockComments.ts b/tests/cases/fourslash/getOutliningForBlockComments.ts index facbe741d76..06b30228274 100644 --- a/tests/cases/fourslash/getOutliningForBlockComments.ts +++ b/tests/cases/fourslash/getOutliningForBlockComments.ts @@ -1,14 +1,14 @@ /// ////[|/* -//// Comment before module: +//// Block comment at the beginning of the file before module: //// line one of the comment //// line two of the comment //// line three //// line four //// line five ////*/|] -////module Sayings [|{ +////module Sayings[| { //// [|/* //// Comment before class: //// line one of the comment @@ -17,7 +17,7 @@ //// line four //// line five //// */|] -//// export class Greeter [|{ +//// export class Greeter[| { //// [|/* //// Comment before a string identifier //// line two of the comment @@ -27,17 +27,17 @@ //// constructor //// parameter message as a string //// */|] -//// /* This is a single line block comment style. Should not be collapsed*/ +//// //// [|/* //// Multiple comments should be collapsed individually //// */|] -//// constructor(message: string /* do not collapse single lines*/) [|{ +//// constructor(message: string /* do not collapse this */)[| { //// this.greeting = message; //// }|] //// [|/* //// method of a class //// */|] -//// greet() [|{ +//// greet()[| { //// return "Hello, " + this.greeting; //// }|] //// }|] @@ -45,7 +45,7 @@ //// ////[|/* //// Block comment for interface. The ending can be on the same line as the declaration. -////*/|]interface IFoo [|{ +////*/|]interface IFoo[| { //// [|/* //// Multiple block comments //// */|] @@ -95,10 +95,11 @@ //// [|/* //// Over a function in an object literal //// */|] -//// get foo() [|{ +//// get foo()[| { //// return 1; //// }|] ////}|] +debugger; verify.outliningSpansInCurrentFile(test.ranges()); diff --git a/tests/cases/fourslash/getOutliningForSingleLineComments.ts b/tests/cases/fourslash/getOutliningForSingleLineComments.ts new file mode 100644 index 00000000000..42d782581a7 --- /dev/null +++ b/tests/cases/fourslash/getOutliningForSingleLineComments.ts @@ -0,0 +1,81 @@ +/// + +////[|// Single line comments at the start of the file +////// line 2 +////// line 3 +////// line 4|] +////module Sayings[| { +//// +//// [|/* +//// */|] +//// [|// A sequence of +//// // single line|] +//// [|/* +//// and block +//// */|] +//// [|// comments +//// //|] +//// export class Sample[| { +//// }|] +////}|] +//// +////interface IFoo[| { +//// [|// all consecutive single line comments should be in one block regardless of their number or empty lines/spaces inbetween +//// +//// // comment 2 +//// // comment 3 +//// +//// //comment 4 +//// /// comment 5 +//// ///// comment 6 +//// +//// //comment 7 +//// ///comment 8 +//// // comment 9 +//// // //comment 10 +//// +//// +//// +//// +//// +//// +//// +//// +//// +//// +//// +//// +//// +//// +//// +//// +//// +//// +//// +//// +//// // // //comment 11 +//// // comment 12 +//// // comment 13 +//// // comment 14 +//// // comment 15 +//// +//// // comment 16 +//// // comment 17 +//// // comment 18 +//// // comment 19 +//// // comment 20 +//// // comment 21|] +//// +//// getDist(): number; // One single line comment should not be collapsed +////}|] +//// +////// One single line comment should not be collapsed +////class WithOneSingleLineComment[| { +////}|] + + + + +verify.outliningSpansInCurrentFile(test.ranges()); + +