Skip to content

Added test with special character for text document matcher #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions test/Lsp.Tests/Matchers/TextDocumentMatcherTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,30 @@ public void Should_Return_Did_Open_Text_Document_Handler_Descriptor()
result.Should().Contain(x => x.Method == DocumentNames.DidOpen);
}

[Fact]
public void Should_Return_Did_Open_Text_Document_Handler_Descriptor_With_Sepcial_Character()
{
// Given
var textDocumentSyncHandler =
TextDocumentSyncHandlerExtensions.With(DocumentSelector.ForPattern("**/*.cshtml"));
var collection = new HandlerCollection(SupportedCapabilitiesFixture.AlwaysTrue) { textDocumentSyncHandler };
AutoSubstitute.Provide<IHandlerCollection>(collection);
AutoSubstitute.Provide<IEnumerable<ILspHandlerDescriptor>>(collection);
var handlerMatcher = AutoSubstitute.Resolve<TextDocumentMatcher>();

// When
var result = handlerMatcher.FindHandler(new DidOpenTextDocumentParams() {
TextDocument = new TextDocumentItem {
Uri = new Uri("file://c:/users/myøasdf/d.cshtml")
}
},
collection.Where(x => x.Method == DocumentNames.DidOpen));

// Then
result.Should().NotBeNullOrEmpty();
result.Should().Contain(x => x.Method == DocumentNames.DidOpen);
}

[Fact]
public void Should_Return_Did_Change_Text_Document_Descriptor()
{
Expand Down