Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit187674c

Browse files
committed
Formatting completion lists in VerifyCompletionList
1 parent693e8a3 commit187674c

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

‎vsintegration/tests/unittests/CompletionProviderTests.fs‎

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ let internal projectOptions = {
4949
Stamp= None
5050
}
5151

52+
letformatCompletions(completions:string seq)=
53+
"\n\t"+ String.Join("\n\t", completions)
54+
5255
letVerifyCompletionList(fileContents:string,marker:string,expected:string list,unexpected:string list)=
5356
letcaretPosition= fileContents.IndexOf(marker)+ marker.Length
5457
letresults=
@@ -57,11 +60,44 @@ let VerifyCompletionList(fileContents: string, marker: string, expected: string
5760
|> Option.defaultValue(ResizeArray())
5861
|> Seq.map(fun result-> result.DisplayText)
5962

60-
for itemin expecteddo
61-
Assert.IsTrue(results.Contains(item), sprintf"Completions should contain '%s'. Got '%s'." item(String.Join(",", results)))
63+
letexpectedFound=
64+
expected
65+
|> Seq.filter results.Contains
66+
67+
letexpectedNotFound=
68+
expected
69+
|> Seq.filter(expectedFound.Contains>>not)
70+
71+
letunexpectedNotFound=
72+
unexpected
73+
|> Seq.filter(results.Contains>>not)
74+
75+
letunexpectedFound=
76+
unexpected
77+
|> Seq.filter(unexpectedNotFound.Contains>>not)
78+
79+
// If either of these are true, then the test fails.
80+
lethasExpectedNotFound= expectedNotFound.Count()>0
81+
lethasUnexpectedFound= unexpectedFound.Count()>0
82+
83+
if hasExpectedNotFound|| hasUnexpectedFoundthen
84+
letexpectedNotFoundMsg=
85+
if hasExpectedNotFoundthen
86+
sprintf"Expected completions not found:%s"(formatCompletions expectedNotFound)
87+
else
88+
String.Empty
89+
90+
letunexpectedFoundMsg=
91+
if hasUnexpectedFoundthen
92+
sprintf"Unexpected completions found:%s"(formatCompletions unexpectedFound)
93+
else
94+
String.Empty
95+
96+
letcompletionsMsg= sprintf"Completions:%s"(formatCompletions results)
97+
98+
letmsg= sprintf"\n%s\n%s\n in%s" expectedNotFoundMsg unexpectedFoundMsg completionsMsg
6299

63-
for itemin unexpecteddo
64-
Assert.IsFalse(results.Contains(item), sprintf"Completions should not contain '%s'. Got '{%s}'" item(String.Join(",", results)))
100+
Assert.Fail(msg)
65101

66102
letVerifyCompletionListExactly(fileContents:string,marker:string,expected:string list)=
67103
letcaretPosition= fileContents.IndexOf(marker)+ marker.Length

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp