Skip to content

Commit cb3bffe

Browse files
committed
Add a few basic IDE tests
1 parent 93959af commit cb3bffe

File tree

4 files changed

+51
-0
lines changed

4 files changed

+51
-0
lines changed

src/EditorFeatures/CSharpTest/Classification/SemanticClassifierTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4439,5 +4439,17 @@ await TestAsync(
44394439
testHost,
44404440
RecordStruct("R"));
44414441
}
4442+
4443+
[Theory]
4444+
[CombinatorialData]
4445+
public async Task BasicFileScopedNamespaceClassification(TestHost testHost)
4446+
{
4447+
await TestAsync(
4448+
@"namespace NS;
4449+
4450+
class C { }",
4451+
testHost,
4452+
Namespace("NS"));
4453+
}
44424454
}
44434455
}

src/EditorFeatures/CSharpTest/Formatting/Indentation/SmartIndenterTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,22 @@ namespace NS
203203
expectedIndentation: 4);
204204
}
205205

206+
[WpfFact]
207+
[Trait(Traits.Feature, Traits.Features.SmartIndent)]
208+
public void FileScopedNamespace()
209+
{
210+
var code = @"using System;
211+
212+
namespace NS;
213+
214+
215+
";
216+
AssertSmartIndent(
217+
code,
218+
indentationLine: 4,
219+
expectedIndentation: 0);
220+
}
221+
206222
[WpfFact]
207223
[Trait(Traits.Feature, Traits.Features.SmartIndent)]
208224
public void Class()

src/EditorFeatures/CSharpTest2/Recommendations/ClassKeywordRecommenderTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,5 +401,12 @@ public async Task TestAfterRecord()
401401
await VerifyKeywordAsync(
402402
@"record $$");
403403
}
404+
405+
[Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)]
406+
public async Task TestAfterFileScopedNamespace()
407+
{
408+
await VerifyKeywordAsync(
409+
@"namespace NS; $$");
410+
}
404411
}
405412
}

src/Workspaces/CSharpTest/Formatting/FormattingTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9971,6 +9971,22 @@ record struct R(int X);
99719971
",
99729972
@"
99739973
record struct R(int X);
9974+
");
9975+
}
9976+
9977+
[Fact, Trait(Traits.Feature, Traits.Features.Formatting)]
9978+
public async Task FileScopedNamespace()
9979+
{
9980+
await AssertFormatAsync(
9981+
@"
9982+
namespace NS;
9983+
9984+
class C { }
9985+
",
9986+
@"
9987+
namespace NS;
9988+
9989+
class C { }
99749990
");
99759991
}
99769992
}

0 commit comments

Comments
 (0)