@@ -49,6 +49,9 @@ let internal projectOptions = {
4949 Stamp= None
5050}
5151
52+ let formatCompletions ( completions : string seq ) =
53+ " \n\t " + String.Join( " \n\t " , completions)
54+
5255let VerifyCompletionList ( fileContents : string , marker : string , expected : string list , unexpected : string list ) =
5356let caretPosition = fileContents.IndexOf( marker) + marker.Length
5457let results =
@@ -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+ let expectedFound =
64+ expected
65+ |> Seq.filter results.Contains
66+
67+ let expectedNotFound =
68+ expected
69+ |> Seq.filter( expectedFound.Contains>> not )
70+
71+ let unexpectedNotFound =
72+ unexpected
73+ |> Seq.filter( results.Contains>> not )
74+
75+ let unexpectedFound =
76+ unexpected
77+ |> Seq.filter( unexpectedNotFound.Contains>> not )
78+
79+ // If either of these are true, then the test fails.
80+ let hasExpectedNotFound = expectedNotFound.Count() > 0
81+ let hasUnexpectedFound = unexpectedFound.Count() > 0
82+
83+ if hasExpectedNotFound|| hasUnexpectedFoundthen
84+ let expectedNotFoundMsg =
85+ if hasExpectedNotFoundthen
86+ sprintf" Expected completions not found:%s " ( formatCompletions expectedNotFound)
87+ else
88+ String.Empty
89+
90+ let unexpectedFoundMsg =
91+ if hasUnexpectedFoundthen
92+ sprintf" Unexpected completions found:%s " ( formatCompletions unexpectedFound)
93+ else
94+ String.Empty
95+
96+ let completionsMsg = sprintf" Completions:%s " ( formatCompletions results)
97+
98+ let msg = 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
66102let VerifyCompletionListExactly ( fileContents : string , marker : string , expected : string list ) =
67103let caretPosition = fileContents.IndexOf( marker) + marker.Length