Skip to content

Commit 28fce55

Browse files
Arthur Ozgaaozgaa
authored andcommitted
add and update tests
1 parent 0df66a5 commit 28fce55

6 files changed

+62
-34
lines changed

tests/cases/fourslash/autoFormattingOnPasting.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
/////**/
55
////}
66
goTo.marker("");
7-
edit.paste(" class TestClass{\r\n\
8-
private foo;\r\n\
9-
public testMethod( )\r\n\
10-
{}\r\n\
11-
}");
7+
edit.paste(` class TestClass{
8+
private foo;
9+
public testMethod( )
10+
{}
11+
}`);
1212
// We're missing scenarios of formatting option settings due to bug 693273 - [TypeScript] Need to improve fourslash support for formatting options.
1313
// Missing scenario ** Uncheck Tools->Options->Text Editor->TypeScript->Formatting->General->Format on paste **
1414
//verify.currentFileContentIs("module TestModule {\r\n\
@@ -19,10 +19,9 @@ public testMethod( )\r\n\
1919
//}\r\n\
2020
//}");
2121
// Missing scenario ** Check Tools->Options->Text Editor->TypeScript->Formatting->General->Format on paste **
22-
verify.currentFileContentIs("module TestModule {\r\n\
23-
class TestClass {\r\n\
24-
private foo;\r\n\
25-
public testMethod()\r\n\
26-
{ }\r\n\
27-
}\r\n\
28-
}");
22+
verify.currentFileContentIs(`module TestModule {
23+
class TestClass {
24+
private foo;
25+
public testMethod() { }
26+
}
27+
}`);
Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
///<reference path="fourslash.ts"/>
22

3-
////function f()
3+
////function f1()
44
////{ return 0; }
5+
////function f2()
6+
////{
7+
////return 0;
8+
////}
59
////function g()
610
////{ function h() {
711
////return 0;
812
////}}
913
format.document();
1014
verify.currentFileContentIs(
11-
"function f()\n" +
12-
"{ return 0; }\n" +
13-
"function g() {\n" +
14-
" function h() {\n" +
15-
" return 0;\n" +
16-
" }\n" +
17-
"}"
18-
);
15+
`function f1() { return 0; }
16+
function f2() {
17+
return 0;
18+
}
19+
function g() {
20+
function h() {
21+
return 0;
22+
}
23+
}`);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/// <reference path="fourslash.ts"/>
2+
3+
//// if(true)
4+
//// /**/
5+
6+
7+
format.setOption("PlaceOpenBraceOnNewLineForControlBlocks", false);
8+
goTo.marker("");
9+
edit.insert("{");
10+
// TODO: figure out how to get rid of 3 extra spaces on second last line.
11+
verify.currentFileContentIs(
12+
`if (true) {`);
13+
14+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/// <reference path="fourslash.ts"/>
2+
3+
//// function foo()
4+
//// {
5+
//// }
6+
//// if (true)
7+
//// {
8+
//// }
9+
10+
format.document();
11+
verify.currentFileContentIs(
12+
`function foo() {
13+
}
14+
if (true) {
15+
}`);

tests/cases/fourslash/formattingOfMultilineBlockConstructs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ verify.currentLineContentIs("enum E {");
4747
goTo.marker('4');
4848
verify.currentLineContentIs("class MyClass {");
4949
goTo.marker('cons');
50-
verify.currentLineContentIs(" constructor()");
50+
verify.currentLineContentIs(" constructor() { }");
5151
goTo.marker('5');
5252
verify.currentLineContentIs(" public MyFunction() {");
5353
goTo.marker('6');
Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
/// <reference path='fourslash.ts' />
22

3-
/////*1*/class C
4-
////{}/*2*/
5-
/////*3*/if (true)
6-
////{}/*4*/
3+
////class C
4+
////{}
5+
////if (true)
6+
////{}
77

88
format.document();
9-
goTo.marker("1");
10-
verify.currentLineContentIs("class C");
11-
goTo.marker("2");
12-
verify.currentLineContentIs("{ }");
13-
goTo.marker("3");
14-
verify.currentLineContentIs("if (true)");
15-
goTo.marker("4");
16-
verify.currentLineContentIs("{ }");
9+
verify.currentFileContentIs(
10+
`class C { }
11+
if (true) { }`);

0 commit comments

Comments
 (0)