|
1 | 1 | ///<reference path="fourslash.ts"/>
|
2 | 2 |
|
3 |
| -/////*InsertSpaceAfterCommaDelimiter*/[1,2, 3];[ 72 , ]; |
4 |
| -/////*InsertSpaceAfterSemicolonInForStatements*/for (i = 0;i; i++); |
5 |
| -/////*InsertSpaceBeforeAndAfterBinaryOperators*/1+2- 3 |
6 |
| -/////*InsertSpaceAfterKeywordsInControlFlowStatements*/if (true) { } |
7 |
| -/////*InsertSpaceAfterFunctionKeywordForAnonymousFunctions*/(function () { }) |
8 |
| -/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis*/(1 ) |
9 |
| -/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets*/[1 ]; [ ]; []; [,]; |
10 |
| -/////*InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces*/`${1}`;`${ 1 }` |
11 |
| -/////*InsertSpaceAfterTypeAssertion*/const bar = <Bar> Thing.getFoo(); |
12 |
| -/////*PlaceOpenBraceOnNewLineForFunctions*/class foo { |
| 3 | +/////*insertSpaceAfterCommaDelimiter*/[1,2, 3];[ 72 , ]; |
| 4 | +/////*insertSpaceAfterSemicolonInForStatements*/for (i = 0;i; i++); |
| 5 | +/////*insertSpaceBeforeAndAfterBinaryOperators*/1+2- 3 |
| 6 | +/////*insertSpaceAfterKeywordsInControlFlowStatements*/if (true) { } |
| 7 | +/////*insertSpaceAfterFunctionKeywordForAnonymousFunctions*/(function () { }) |
| 8 | +/////*insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis*/(1 ) |
| 9 | +/////*insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets*/[1 ]; [ ]; []; [,]; |
| 10 | +/////*insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces*/`${1}`;`${ 1 }` |
| 11 | +/////*insertSpaceAfterTypeAssertion*/const bar = <Bar> Thing.getFoo(); |
| 12 | +/////*placeOpenBraceOnNewLineForFunctions*/class foo { |
13 | 13 | ////}
|
14 |
| -/////*PlaceOpenBraceOnNewLineForControlBlocks*/if (true) { |
| 14 | +/////*placeOpenBraceOnNewLineForControlBlocks*/if (true) { |
15 | 15 | ////}
|
16 |
| -/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; var {a,b } = { a: 'sw', b:'r' };function f( { a, b}) { } |
17 |
| - |
18 |
| -runTest("InsertSpaceAfterCommaDelimiter", "[1, 2, 3];[72,];", "[1,2,3];[72,];"); |
19 |
| -runTest("InsertSpaceAfterSemicolonInForStatements", "for (i = 0; i; i++);", "for (i = 0;i;i++);"); |
20 |
| -runTest("InsertSpaceBeforeAndAfterBinaryOperators", "1 + 2 - 3", "1+2-3"); |
21 |
| -runTest("InsertSpaceAfterKeywordsInControlFlowStatements", "if (true) { }", "if(true) { }"); |
22 |
| -runTest("InsertSpaceAfterFunctionKeywordForAnonymousFunctions", "(function () { })", "(function() { })"); |
23 |
| -runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis", " ( 1 )", " (1)"); |
24 |
| -runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets", "[ 1 ];[];[];[ , ];", "[1];[];[];[,];"); |
25 |
| -runTest("InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces", "`${ 1 }`; `${ 1 }`", "`${1}`; `${1}`"); |
26 |
| -runTest("InsertSpaceAfterTypeAssertion", "const bar = <Bar> Thing.getFoo();", "const bar = <Bar>Thing.getFoo();"); |
27 |
| -runTest("PlaceOpenBraceOnNewLineForFunctions", "class foo", "class foo {"); |
28 |
| -runTest("PlaceOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {"); |
29 |
| -runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBraces", "{ var t = 1 }; var { a, b } = { a: 'sw', b: 'r' }; function f({ a, b }) { }", "{var t = 1}; var {a, b} = {a: 'sw', b: 'r'}; function f({a, b}) {}"); |
| 16 | +/////*insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces*/{ var t = 1}; var {a,b } = { a: 'sw', b:'r' };function f( { a, b}) { } |
| 17 | + |
| 18 | +runTest("insertSpaceAfterCommaDelimiter", "[1, 2, 3];[72,];", "[1,2,3];[72,];"); |
| 19 | +runTest("insertSpaceAfterSemicolonInForStatements", "for (i = 0; i; i++);", "for (i = 0;i;i++);"); |
| 20 | +runTest("insertSpaceBeforeAndAfterBinaryOperators", "1 + 2 - 3", "1+2-3"); |
| 21 | +runTest("insertSpaceAfterKeywordsInControlFlowStatements", "if (true) { }", "if(true) { }"); |
| 22 | +runTest("insertSpaceAfterFunctionKeywordForAnonymousFunctions", "(function () { })", "(function() { })"); |
| 23 | +runTest("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis", " ( 1 )", " (1)"); |
| 24 | +runTest("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets", "[ 1 ];[];[];[ , ];", "[1];[];[];[,];"); |
| 25 | +runTest("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces", "`${ 1 }`; `${ 1 }`", "`${1}`; `${1}`"); |
| 26 | +runTest("insertSpaceAfterTypeAssertion", "const bar = <Bar> Thing.getFoo();", "const bar = <Bar>Thing.getFoo();"); |
| 27 | +runTest("placeOpenBraceOnNewLineForFunctions", "class foo", "class foo {"); |
| 28 | +runTest("placeOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {"); |
| 29 | +runTest("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces", "{ var t = 1 }; var { a, b } = { a: 'sw', b: 'r' }; function f({ a, b }) { }", "{var t = 1}; var {a, b} = {a: 'sw', b: 'r'}; function f({a, b}) {}"); |
30 | 30 |
|
31 | 31 | const defaultFormatOption = format.copyFormatOptions();
|
32 | 32 | function runTest(propertyName: string, expectedStringWhenTrue: string, expectedStringWhenFalse: string) {
|
|
0 commit comments