Skip to content

Commit 3dda9b4

Browse files
Added test with special character for text document matcher
1 parent 7d8567c commit 3dda9b4

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/Lsp.Tests/Matchers/TextDocumentMatcherTests.cs

+24
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,30 @@ public void Should_Return_Did_Open_Text_Document_Handler_Descriptor()
7575
result.Should().Contain(x => x.Method == DocumentNames.DidOpen);
7676
}
7777

78+
[Fact]
79+
public void Should_Return_Did_Open_Text_Document_Handler_Descriptor_With_Sepcial_Character()
80+
{
81+
// Given
82+
var textDocumentSyncHandler =
83+
TextDocumentSyncHandlerExtensions.With(DocumentSelector.ForPattern("**/*.cshtml"));
84+
var collection = new HandlerCollection(SupportedCapabilitiesFixture.AlwaysTrue) { textDocumentSyncHandler };
85+
AutoSubstitute.Provide<IHandlerCollection>(collection);
86+
AutoSubstitute.Provide<IEnumerable<ILspHandlerDescriptor>>(collection);
87+
var handlerMatcher = AutoSubstitute.Resolve<TextDocumentMatcher>();
88+
89+
// When
90+
var result = handlerMatcher.FindHandler(new DidOpenTextDocumentParams() {
91+
TextDocument = new TextDocumentItem {
92+
Uri = new Uri("file://c:/users/myøasdf/d.cshtml")
93+
}
94+
},
95+
collection.Where(x => x.Method == DocumentNames.DidOpen));
96+
97+
// Then
98+
result.Should().NotBeNullOrEmpty();
99+
result.Should().Contain(x => x.Method == DocumentNames.DidOpen);
100+
}
101+
78102
[Fact]
79103
public void Should_Return_Did_Change_Text_Document_Descriptor()
80104
{

0 commit comments

Comments
 (0)