-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add infrustructure for semantic snippet testing * Port `foreach` snippet * Port `for` snippet * Port `forr` snippet * Port `lock` snippet * Port `else` snippet * Port `cw` snippet * Port `ctor` snippet * Port `svm` and `sim` snippets * Port `class` snippet * Port `struct` snippet * Port `interface` snippet * Port `enum` snippet * Port `do` snippet * Port `if` and `while` snippets * Port `prop`, `propg` and `propi` snippets and remove leftover legacy snippet test infrastructure * Do not show `enum` snippet after `partial` modifier * Use common test data in a few more places * Fix build * Fix
- Loading branch information
1 parent
76b0357
commit 5e6bb7a
Showing
43 changed files
with
5,198 additions
and
6,910 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
...tures/CSharpTest/Completion/CompletionProviders/SemanticSnippetCompletionProviderTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Threading.Tasks; | ||
using Microsoft.CodeAnalysis.CSharp.Completion.CompletionProviders.Snippets; | ||
using Microsoft.CodeAnalysis.Test.Utilities; | ||
using Roslyn.Test.Utilities; | ||
using Xunit; | ||
|
||
namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Completion.CompletionProviders; | ||
|
||
[Trait(Traits.Feature, Traits.Features.Completion)] | ||
public sealed class SemanticSnippetCompletionProviderTests : AbstractCSharpCompletionProviderTests | ||
{ | ||
public SemanticSnippetCompletionProviderTests() | ||
{ | ||
ShowNewSnippetExperience = true; | ||
} | ||
|
||
internal override Type GetCompletionProviderType() | ||
=> typeof(CSharpSnippetCompletionProvider); | ||
|
||
[WpfFact] | ||
public async Task InsertConsoleSnippetWithInvocationBeforeAndAfterCursorTest() | ||
{ | ||
var markupBeforeCommit = """ | ||
class Program | ||
{ | ||
public void Method() | ||
{ | ||
Wr$$Blah | ||
} | ||
} | ||
"""; | ||
|
||
var expectedCodeAfterCommit = """ | ||
using System; | ||
|
||
class Program | ||
{ | ||
public void Method() | ||
{ | ||
Console.WriteLine($$); | ||
} | ||
} | ||
"""; | ||
|
||
await VerifyCustomCommitProviderAsync(markupBeforeCommit, "cw", expectedCodeAfterCommit); | ||
} | ||
|
||
[WpfFact] | ||
public async Task InsertConsoleSnippetWithInvocationUnderscoreBeforeAndAfterCursorTest() | ||
{ | ||
var markupBeforeCommit = | ||
""" | ||
class Program | ||
{ | ||
public void Method() | ||
{ | ||
_Wr$$Blah_ | ||
} | ||
} | ||
"""; | ||
|
||
var expectedCodeAfterCommit = | ||
""" | ||
using System; | ||
|
||
class Program | ||
{ | ||
public void Method() | ||
{ | ||
Console.WriteLine($$); | ||
} | ||
} | ||
"""; | ||
await VerifyCustomCommitProviderAsync(markupBeforeCommit, "cw", expectedCodeAfterCommit); | ||
} | ||
} |
172 changes: 0 additions & 172 deletions
172
...pletion/CompletionProviders/Snippets/AbstractCSharpAutoPropertyCompletionProviderTests.cs
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
...t/Completion/CompletionProviders/Snippets/AbstractCSharpSnippetCompletionProviderTests.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.