From 398d16d95c14c96f5ff7173b5fa529fa879cbee6 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Mon, 23 Sep 2024 12:18:18 +0100 Subject: [PATCH 1/2] Better ranges for CE `let!` and `use!` error reporting. (#17712) --- .../.FSharp.Compiler.Service/9.0.200.md | 1 + .../CheckComputationExpressions.fs | 49 +++-- src/Compiler/SyntaxTree/SyntaxTrivia.fs | 7 +- src/Compiler/SyntaxTree/SyntaxTrivia.fsi | 2 + src/Compiler/pars.fsy | 8 +- .../Language/ComputationExpressionTests.fs | 196 ++++++++++++++++++ ...ervice.SurfaceArea.netstandard20.debug.bsl | 4 +- ...vice.SurfaceArea.netstandard20.release.bsl | 4 +- .../DataExpressions/ComputationExpressions.fs | 8 +- tests/fsharp/typecheck/sigs/neg61.bsl | 4 +- ...atStartsAtAndAndEndsAfterExpression.fs.bsl | 3 +- ...geStartsAtAndAndEndsAfterExpression.fs.bsl | 3 +- ...BangContainsTheRangeOfTheEqualsSign.fs.bsl | 3 +- 13 files changed, 250 insertions(+), 42 deletions(-) diff --git a/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md b/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md index a2a0f964f7f..ce187cb8421 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md +++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md @@ -7,5 +7,6 @@ ### Changed * Make ILTypeDef interface impls calculation lazy. ([PR #17392](https://github.com/dotnet/fsharp/pull/17392)) +* Better ranges for CE `let!` and `use!` error reporting. ([PR #17712](https://github.com/dotnet/fsharp/pull/17712)) ### Breaking Changes diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index 3a3682fbf53..5d9f3562ed9 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -1589,10 +1589,10 @@ let rec TryTranslateComputationExpression Some(TranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace innerComp2 translatedCtxt) else - if ceenv.isQuery && not (innerComp1.IsArbExprAndThusAlreadyReportedError) then match innerComp1 with - | SynExpr.JoinIn _ -> () // an error will be reported later when we process innerComp1 as a sequential + | SynExpr.JoinIn _ -> () + | SynExpr.DoBang(range = m) -> errorR (Error(FSComp.SR.tcBindMayNotBeUsedInQueries (), m)) | _ -> errorR (Error(FSComp.SR.tcUnrecognizedQueryOperator (), innerComp1.RangeOfFirstPortion)) match @@ -1854,12 +1854,14 @@ let rec TryTranslateComputationExpression // or // --> build.BindReturn(e1, (fun _argN -> match _argN with pat -> expr-without-return)) | SynExpr.LetOrUseBang( - bindDebugPoint = spBind; isUse = false; isFromSource = isFromSource; pat = pat; rhs = rhsExpr; andBangs = []; body = innerComp) -> - - let mBind = - match spBind with - | DebugPointAtBinding.Yes m -> m - | _ -> rhsExpr.Range + bindDebugPoint = spBind + isUse = false + isFromSource = isFromSource + pat = pat + rhs = rhsExpr + andBangs = [] + body = innerComp + trivia = { LetOrUseBangKeyword = mBind }) -> if ceenv.isQuery then error (Error(FSComp.SR.tcBindMayNotBeUsedInQueries (), mBind)) @@ -1900,7 +1902,8 @@ let rec TryTranslateComputationExpression pat = SynPat.Named(ident = SynIdent(id, _); isThisVal = false) as pat rhs = rhsExpr andBangs = [] - body = innerComp) + body = innerComp + trivia = { LetOrUseBangKeyword = mBind }) | SynExpr.LetOrUseBang( bindDebugPoint = spBind isUse = true @@ -1908,12 +1911,8 @@ let rec TryTranslateComputationExpression pat = SynPat.LongIdent(longDotId = SynLongIdent(id = [ id ])) as pat rhs = rhsExpr andBangs = [] - body = innerComp) -> - - let mBind = - match spBind with - | DebugPointAtBinding.Yes m -> m - | _ -> rhsExpr.Range + body = innerComp + trivia = { LetOrUseBangKeyword = mBind }) -> if ceenv.isQuery then error (Error(FSComp.SR.tcBindMayNotBeUsedInQueries (), mBind)) @@ -1988,9 +1987,9 @@ let rec TryTranslateComputationExpression Some(translatedCtxt bindExpr) // 'use! pat = e1 ... in e2' where 'pat' is not a simple name -> error - | SynExpr.LetOrUseBang(isUse = true; pat = pat; andBangs = andBangs) -> + | SynExpr.LetOrUseBang(isUse = true; andBangs = andBangs; trivia = { LetOrUseBangKeyword = mBind }) -> if isNil andBangs then - error (Error(FSComp.SR.tcInvalidUseBangBinding (), pat.Range)) + error (Error(FSComp.SR.tcInvalidUseBangBinding (), mBind)) else let m = match andBangs with @@ -2013,17 +2012,17 @@ let rec TryTranslateComputationExpression rhs = letRhsExpr andBangs = andBangBindings body = innerComp - range = letBindRange) -> + trivia = { LetOrUseBangKeyword = mBind }) -> if not (cenv.g.langVersion.SupportsFeature LanguageFeature.AndBang) then - error (Error(FSComp.SR.tcAndBangNotSupported (), comp.Range)) + let andBangRange = + match andBangBindings with + | [] -> comp.Range + | h :: _ -> h.Trivia.AndBangKeyword - if ceenv.isQuery then - error (Error(FSComp.SR.tcBindMayNotBeUsedInQueries (), letBindRange)) + error (Error(FSComp.SR.tcAndBangNotSupported (), andBangRange)) - let mBind = - match spBind with - | DebugPointAtBinding.Yes m -> m - | _ -> letRhsExpr.Range + if ceenv.isQuery then + error (Error(FSComp.SR.tcBindMayNotBeUsedInQueries (), mBind)) let sources = (letRhsExpr diff --git a/src/Compiler/SyntaxTree/SyntaxTrivia.fs b/src/Compiler/SyntaxTree/SyntaxTrivia.fs index 0932befd7c1..bbc5f8ea0ce 100644 --- a/src/Compiler/SyntaxTree/SyntaxTrivia.fs +++ b/src/Compiler/SyntaxTree/SyntaxTrivia.fs @@ -93,10 +93,15 @@ type SynExprLetOrUseTrivia = [] type SynExprLetOrUseBangTrivia = { + LetOrUseBangKeyword: range EqualsRange: range option } - static member Zero: SynExprLetOrUseBangTrivia = { EqualsRange = None } + static member Zero: SynExprLetOrUseBangTrivia = + { + LetOrUseBangKeyword = Range.Zero + EqualsRange = None + } [] type SynExprMatchTrivia = diff --git a/src/Compiler/SyntaxTree/SyntaxTrivia.fsi b/src/Compiler/SyntaxTree/SyntaxTrivia.fsi index 24bfc1b7a52..08f8228c3bc 100644 --- a/src/Compiler/SyntaxTree/SyntaxTrivia.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTrivia.fsi @@ -139,6 +139,8 @@ type SynExprLetOrUseTrivia = [] type SynExprLetOrUseBangTrivia = { + /// The syntax range of the `let!` or `use!` keyword. + LetOrUseBangKeyword: range /// The syntax range of the `=` token. EqualsRange: range option } diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 2794edf560e..c930398b24b 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -4419,7 +4419,7 @@ declExpr: { let spBind = DebugPointAtBinding.Yes(rhs2 parseState 1 5) let mEquals = rhs parseState 3 let m = unionRanges (rhs parseState 1) $8.Range - let trivia: SynExprLetOrUseBangTrivia = { EqualsRange = Some mEquals } + let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, $2, $4, $7, $8, m, trivia) } | OBINDER headBindingPattern EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let @@ -4428,7 +4428,7 @@ declExpr: let spBind = DebugPointAtBinding.Yes(unionRanges (rhs parseState 1) $4.Range) let mEquals = rhs parseState 3 let m = unionRanges (rhs parseState 1) $8.Range - let trivia: SynExprLetOrUseBangTrivia = { EqualsRange = Some mEquals } + let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, $2, $4, $7, $8, m, trivia) } | OBINDER headBindingPattern EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP error %prec expr_let @@ -4437,12 +4437,12 @@ declExpr: let mEquals = rhs parseState 3 let mAll = unionRanges (rhs parseState 1) (rhs parseState 7) let m = $4.Range.EndRange // zero-width range - let trivia: SynExprLetOrUseBangTrivia = { EqualsRange = Some mEquals } + let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, $2, $4, [], SynExpr.ImplicitZero m, mAll, trivia) } | DO_BANG typedSequentialExpr IN opt_OBLOCKSEP typedSequentialExprBlock %prec expr_let { let spBind = DebugPointAtBinding.NoneAtDo - let trivia: SynExprLetOrUseBangTrivia = { EqualsRange = None } + let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = Range.Zero; EqualsRange = None } SynExpr.LetOrUseBang(spBind, false, true, SynPat.Const(SynConst.Unit, $2.Range), $2, [], $5, unionRanges (rhs parseState 1) $5.Range, trivia) } | ODO_BANG typedSequentialExprBlock hardwhiteDefnBindingsTerminator %prec expr_let diff --git a/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs index d5c6a5a0a63..8333657e699 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs @@ -246,4 +246,200 @@ let run r2 r3 = |> shouldFail |> withDiagnostics [ (Error 3345, Line 22, Col 9, Line 22, Col 13, "use! may not be combined with and!") + ] + + [] + let ``This control construct may only be used if the computation expression builder defines a 'Bind' method`` () = + Fsx """ +module Result = + let zip x1 x2 = + match x1,x2 with + | Ok x1res, Ok x2res -> Ok (x1res, x2res) + | Error e, _ -> Error e + | _, Error e -> Error e + +type ResultBuilder() = + member _.MergeSources(t1: Result<'T,'U>, t2: Result<'T1,'U>) = Result.zip t1 t2 + member _.BindReturn(x: Result<'T,'U>, f) = Result.map f x + member _.Delay(f) = f() + + member _.TryWith(r: Result<'T,'U>, f) = + match r with + | Ok x -> Ok x + | Error e -> f e + +let result = ResultBuilder() + +let run r2 r3 = + result { + let! a = r2 + return! a + } + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 708, Line 23, Col 9, Line 23, Col 13, "This control construct may only be used if the computation expression builder defines a 'Bind' method") + ] + + [] + let ``This control construct may only be used if the computation expression builder defines a 'Using' method`` () = + Fsx """ +module Result = + let zip x1 x2 = + match x1,x2 with + | Ok x1res, Ok x2res -> Ok (x1res, x2res) + | Error e, _ -> Error e + | _, Error e -> Error e + +type ResultBuilder() = + member _.MergeSources(t1: Result<'T,'U>, t2: Result<'T1,'U>) = Result.zip t1 t2 + member _.BindReturn(x: Result<'T,'U>, f) = Result.map f x + member _.Delay(f) = f() + + member _.TryWith(r: Result<'T,'U>, f) = + match r with + | Ok x -> Ok x + | Error e -> f e + +let result = ResultBuilder() + +let run r2 r3 = + result { + use! a = r2 + return! a + } + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 708, Line 23, Col 9, Line 23, Col 13, "This control construct may only be used if the computation expression builder defines a 'Using' method") + ] + + [] + let ``do! expressions may not be used in queries`` () = + Fsx """ +query { + do! failwith "" + yield 1 +} + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3143, Line 3, Col 5, Line 3, Col 20, "'let!', 'use!' and 'do!' expressions may not be used in queries") + ] + + [] + let ``let! expressions may not be used in queries`` () = + Fsx """ +query { + let! x = failwith "" + yield 1 +} + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3143, Line 3, Col 5, Line 3, Col 9, "'let!', 'use!' and 'do!' expressions may not be used in queries") + ] + + [] + let ``let!, and! expressions may not be used in queries`` () = + Fsx """ +query { + let! x = failwith "" + and! y = failwith "" + yield 1 +} + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3143, Line 3, Col 5, Line 3, Col 9, "'let!', 'use!' and 'do!' expressions may not be used in queries") + ] + + [] + let ``use! expressions may not be used in queries`` () = + Fsx """ +query { + use! x = failwith "" + yield 1 +} + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3143, Line 3, Col 5, Line 3, Col 9, "'let!', 'use!' and 'do!' expressions may not be used in queries") + ] + + [] + let ``do! expressions may not be used in queries(SynExpr.Sequential)`` () = + Fsx """ +query { + for c in [1..10] do + do! failwith "" + yield 1 +} + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3143, Line 4, Col 5, Line 4, Col 20, "'let!', 'use!' and 'do!' expressions may not be used in queries") + ] + + [] + let ``let! expressions may not be used in queries(SynExpr.Sequential)`` () = + Fsx """ +query { + for c in [1..10] do + let! x = failwith "" + yield 1 +} + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3143, Line 4, Col 5, Line 4, Col 9, "'let!', 'use!' and 'do!' expressions may not be used in queries") + ] + + [] + let ``let!, and! expressions may not be used in queries(SynExpr.Sequential)`` () = + Fsx """ +query { + for c in [1..10] do + let! x = failwith "" + and! y = failwith "" + yield 1 +} + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3143, Line 4, Col 5, Line 4, Col 9, "'let!', 'use!' and 'do!' expressions may not be used in queries") + ] + + [] + let ``use! expressions may not be used in queries(SynExpr.Sequential)`` () = + Fsx """ +query { + for c in [1..10] do + use! x = failwith "" + yield 1 +} + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3143, Line 4, Col 5, Line 4, Col 9, "'let!', 'use!' and 'do!' expressions may not be used in queries") ] \ No newline at end of file diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl index 543c92ef5cc..c41cdbbea96 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl @@ -10203,7 +10203,9 @@ FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: FSharp.Compiler.SyntaxTr FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] EqualsRange FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_EqualsRange() FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: System.String ToString() -FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: Void .ctor(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) +FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: FSharp.Compiler.Text.Range LetOrUseBangKeyword +FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: FSharp.Compiler.Text.Range get_LetOrUseBangKeyword() +FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: Void .ctor(FSharp.Compiler.Text.Range, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia: FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia Zero FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia: FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia get_Zero() FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] InKeyword diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl index 543c92ef5cc..c41cdbbea96 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl @@ -10203,7 +10203,9 @@ FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: FSharp.Compiler.SyntaxTr FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] EqualsRange FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_EqualsRange() FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: System.String ToString() -FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: Void .ctor(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) +FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: FSharp.Compiler.Text.Range LetOrUseBangKeyword +FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: FSharp.Compiler.Text.Range get_LetOrUseBangKeyword() +FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: Void .ctor(FSharp.Compiler.Text.Range, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia: FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia Zero FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia: FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia get_Zero() FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] InKeyword diff --git a/tests/fsharp/Compiler/Conformance/DataExpressions/ComputationExpressions.fs b/tests/fsharp/Compiler/Conformance/DataExpressions/ComputationExpressions.fs index 715a1e060a1..c6269705d17 100644 --- a/tests/fsharp/Compiler/Conformance/DataExpressions/ComputationExpressions.fs +++ b/tests/fsharp/Compiler/Conformance/DataExpressions/ComputationExpressions.fs @@ -281,7 +281,7 @@ let ceResult : Trace = return if y then x else -1 } """ - [| FSharpDiagnosticSeverity.Error, 3344, (6, 9, 8, 35), "This feature is not supported in this version of F#. You may need to add /langversion:preview to use this feature." |] + [| FSharpDiagnosticSeverity.Error, 3344, (7, 9, 7, 13), "This feature is not supported in this version of F#. You may need to add /langversion:preview to use this feature." |] [] let ``AndBang TraceMultiBindingMonoid`` () = @@ -582,7 +582,7 @@ let _ = return x + y } """ - [|(FSharpDiagnosticSeverity.Error, 3343, (6, 9, 6, 25), "The 'let! ... and! ...' construct may only be used if the computation expression builder defines either a 'Bind2' method or appropriate 'MergeSources' and 'Bind' methods")|] + [|(FSharpDiagnosticSeverity.Error, 3343, (6, 9, 6, 13), "The 'let! ... and! ...' construct may only be used if the computation expression builder defines either a 'Bind2' method or appropriate 'MergeSources' and 'Bind' methods")|] [] let ``AndBang Negative TraceApplicative missing Bind and BindReturn`` () = @@ -596,7 +596,7 @@ let _ = return x + y } """ - [|(FSharpDiagnosticSeverity.Error, 708, (6, 9, 6, 25), "This control construct may only be used if the computation expression builder defines a 'Bind' method")|] + [|(FSharpDiagnosticSeverity.Error, 708, (6, 9, 6, 13), "This control construct may only be used if the computation expression builder defines a 'Bind' method")|] [] @@ -612,7 +612,7 @@ let _ = return x + y } """ - [| FSharpDiagnosticSeverity.Error, 708, (7, 9, 7, 25), "This control construct may only be used if the computation expression builder defines a 'Bind' method" |] + [| FSharpDiagnosticSeverity.Error, 708, (7, 9, 7, 13), "This control construct may only be used if the computation expression builder defines a 'Bind' method" |] [] let ``AndBang TraceApplicative with do-bang`` () = diff --git a/tests/fsharp/typecheck/sigs/neg61.bsl b/tests/fsharp/typecheck/sigs/neg61.bsl index e0b2fb5eafb..8a8bd79e168 100644 --- a/tests/fsharp/typecheck/sigs/neg61.bsl +++ b/tests/fsharp/typecheck/sigs/neg61.bsl @@ -59,9 +59,7 @@ neg61.fs(86,13,86,16): typecheck error FS3141: 'try/finally' expressions may not neg61.fs(92,13,92,70): typecheck error FS3142: 'use' expressions may not be used in queries -neg61.fs(97,13,97,33): typecheck error FS3143: 'let!', 'use!' and 'do!' expressions may not be used in queries - -neg61.fs(102,13,102,28): typecheck error FS3145: This is not a known query operator. Query operators are identifiers such as 'select', 'where', 'sortBy', 'thenBy', 'groupBy', 'groupValBy', 'join', 'groupJoin', 'sumBy' and 'averageBy', defined using corresponding methods on the 'QueryBuilder' type. +neg61.fs(97,13,97,17): typecheck error FS3143: 'let!', 'use!' and 'do!' expressions may not be used in queries neg61.fs(102,13,102,28): typecheck error FS3143: 'let!', 'use!' and 'do!' expressions may not be used in queries diff --git a/tests/service/data/SyntaxTree/ComputationExpression/MultipleSynExprAndBangHaveRangeThatStartsAtAndAndEndsAfterExpression.fs.bsl b/tests/service/data/SyntaxTree/ComputationExpression/MultipleSynExprAndBangHaveRangeThatStartsAtAndAndEndsAfterExpression.fs.bsl index 2c7ca108bc8..72f8528c23f 100644 --- a/tests/service/data/SyntaxTree/ComputationExpression/MultipleSynExprAndBangHaveRangeThatStartsAtAndAndEndsAfterExpression.fs.bsl +++ b/tests/service/data/SyntaxTree/ComputationExpression/MultipleSynExprAndBangHaveRangeThatStartsAtAndAndEndsAfterExpression.fs.bsl @@ -40,7 +40,8 @@ ImplFile EqualsRange = (5,13--5,14) InKeyword = None })], YieldOrReturn ((false, true), Ident bar, (6,4--6,14)), - (3,4--6,14), { EqualsRange = Some (3,13--3,14) }), + (3,4--6,14), { LetOrUseBangKeyword = (3,4--3,8) + EqualsRange = Some (3,13--3,14) }), (2,6--7,1)), (2,0--7,1)), (2,0--7,1))], PreXmlDocEmpty, [], None, (2,0--7,1), { LeadingKeyword = None })], (true, true), { ConditionalDirectives = [] diff --git a/tests/service/data/SyntaxTree/ComputationExpression/SynExprAndBangRangeStartsAtAndAndEndsAfterExpression.fs.bsl b/tests/service/data/SyntaxTree/ComputationExpression/SynExprAndBangRangeStartsAtAndAndEndsAfterExpression.fs.bsl index 105a94f5b46..d0dd3083e64 100644 --- a/tests/service/data/SyntaxTree/ComputationExpression/SynExprAndBangRangeStartsAtAndAndEndsAfterExpression.fs.bsl +++ b/tests/service/data/SyntaxTree/ComputationExpression/SynExprAndBangRangeStartsAtAndAndEndsAfterExpression.fs.bsl @@ -29,7 +29,8 @@ ImplFile EqualsRange = (5,13--5,14) InKeyword = None })], YieldOrReturn ((false, true), Ident bar, (7,4--7,14)), - (3,4--7,14), { EqualsRange = Some (3,13--3,14) }), + (3,4--7,14), { LetOrUseBangKeyword = (3,4--3,8) + EqualsRange = Some (3,13--3,14) }), (2,6--8,1)), (2,0--8,1)), (2,0--8,1))], PreXmlDocEmpty, [], None, (2,0--8,1), { LeadingKeyword = None })], (true, true), { ConditionalDirectives = [] diff --git a/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseBangContainsTheRangeOfTheEqualsSign.fs.bsl b/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseBangContainsTheRangeOfTheEqualsSign.fs.bsl index 7dfd05fc1ad..a0f54029820 100644 --- a/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseBangContainsTheRangeOfTheEqualsSign.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseBangContainsTheRangeOfTheEqualsSign.fs.bsl @@ -27,7 +27,8 @@ ImplFile InKeyword = None })], YieldOrReturn ((false, true), Const (Unit, (5,11--5,13)), (5,4--5,13)), - (3,4--5,13), { EqualsRange = Some (3,11--3,12) }), + (3,4--5,13), { LetOrUseBangKeyword = (3,4--3,8) + EqualsRange = Some (3,11--3,12) }), (2,5--6,1)), (2,0--6,1)), (2,0--6,1))], PreXmlDocEmpty, [], None, (2,0--6,1), { LeadingKeyword = None })], (true, true), { ConditionalDirectives = [] From 2907d595bccae9f43ec14673600ace62c9ce9933 Mon Sep 17 00:00:00 2001 From: Petr Date: Mon, 23 Sep 2024 19:01:06 +0200 Subject: [PATCH 2/2] Migrate VisualFSharp tests to Xunit (#17751) * Migrate last Nunit tests to Xunit * up * up * up * Update TestLib.LanguageService.fs * up * up * up * Remove unused tests * one more * up --------- Co-authored-by: Kevin Ransom (msft) --- TESTGUIDE.md | 8 - .../tests/UnitTests/AssemblyResolver.fs | 7 - .../UnitTests/DocCommentIdParserTests.fs | 9 +- .../Tests.LanguageService.Completion.fs | 1262 ++++++++--------- .../Tests.LanguageService.ErrorList.fs | 200 +-- .../Tests.LanguageService.ErrorRecovery.fs | 48 +- .../Tests.LanguageService.General.fs | 57 +- .../Tests.LanguageService.GotoDefinition.fs | 287 ++-- .../Tests.LanguageService.NavigationBar.fs | 6 +- .../Tests.LanguageService.ParameterInfo.fs | 556 +++----- .../Tests.LanguageService.QuickInfo.fs | 489 +++---- .../Tests.LanguageService.QuickParse.fs | 112 +- .../Tests.LanguageService.Script.fs | 289 ++-- .../Tests.LanguageService.TimeStamp.fs | 39 +- .../Tests.ProjectSystem.Configs.fs | 37 +- .../Tests.ProjectSystem.Miscellaneous.fs | 179 ++- .../Tests.ProjectSystem.MultiTargeting.fs | 85 +- .../Tests.ProjectSystem.Project.fs | 88 +- .../Tests.ProjectSystem.ProjectItems.fs | 21 +- .../Tests.ProjectSystem.References.fs | 139 +- .../Tests.ProjectSystem.RoundTrip.fs | 23 +- .../Tests.ProjectSystem.UpToDate.fs | 157 +- .../UnitTests/TestLib.LanguageService.fs | 113 +- .../tests/UnitTests/TestLib.ProjectSystem.fs | 16 +- .../tests/UnitTests/TestLib.Salsa.fs | 4 +- .../tests/UnitTests/TestLib.Utils.fs | 2 +- vsintegration/tests/UnitTests/Tests.Build.fs | 93 +- .../UnitTests/Tests.InternalCollections.fs | 70 +- .../tests/UnitTests/Tests.Powerpack.fs | 87 -- .../tests/UnitTests/Tests.TaskReporter.fs | 23 +- vsintegration/tests/UnitTests/Tests.Watson.fs | 79 +- .../tests/UnitTests/Tests.XmlDocComments.fs | 17 +- .../tests/UnitTests/UnusedOpensTests.fs | 151 +- .../UnitTests/VisualFSharp.UnitTests.fsproj | 6 +- .../UnitTests/Workspace/WorkspaceTests.fs | 33 +- vsintegration/tests/UnitTests/app.runsettings | 8 - .../tests/UnitTests/xunit.runner.json | 5 + 37 files changed, 2046 insertions(+), 2759 deletions(-) delete mode 100644 vsintegration/tests/UnitTests/Tests.Powerpack.fs delete mode 100644 vsintegration/tests/UnitTests/app.runsettings create mode 100644 vsintegration/tests/UnitTests/xunit.runner.json diff --git a/TESTGUIDE.md b/TESTGUIDE.md index d9faeafde73..265241917a4 100644 --- a/TESTGUIDE.md +++ b/TESTGUIDE.md @@ -151,14 +151,6 @@ Tags are in the left column, paths to to corresponding test folders are in the r If you want to re-run a particular test area, the easiest way to do so is to set a temporary tag for that area in test.lst (e.g. "RERUN") and adjust `ttags` [run.fsharpqa.test.fsx script](tests/fsharpqa/run.fsharpqa.test.fsx) and run it. -### VisualFSharp.UnitTests - -These are currently NUnit tests (we hope to migrate them to xUnit). You can execute these tests individually via the Visual Studio NUnit3 runner -extension or the command line via `nunit3-console.exe`. - -Note that for compatibility reasons, the IDE unit tests should be run in a 32-bit process, -using the `--x86` flag to `nunit3-console.exe` - ### Logs and output All test execution logs and result files will be dropped into the `tests\TestResults` folder, and have file names matching diff --git a/vsintegration/tests/UnitTests/AssemblyResolver.fs b/vsintegration/tests/UnitTests/AssemblyResolver.fs index 65e717f2618..aab95cc46fc 100644 --- a/vsintegration/tests/UnitTests/AssemblyResolver.fs +++ b/vsintegration/tests/UnitTests/AssemblyResolver.fs @@ -1,6 +1,5 @@ namespace Microsoft.VisualStudio.FSharp -open NUnit.Framework open System open System.IO open System.Reflection @@ -46,9 +45,3 @@ module AssemblyResolver = match found() with | None -> Unchecked.defaultof | Some name -> Assembly.Load(name) ) - -[] -type public AssemblyResolverTestFixture () = - - [] - member public _.Init () = AssemblyResolver.addResolver () diff --git a/vsintegration/tests/UnitTests/DocCommentIdParserTests.fs b/vsintegration/tests/UnitTests/DocCommentIdParserTests.fs index b9cc39f66dc..a20cc3381a9 100644 --- a/vsintegration/tests/UnitTests/DocCommentIdParserTests.fs +++ b/vsintegration/tests/UnitTests/DocCommentIdParserTests.fs @@ -1,14 +1,11 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -[] + module Tests.ServiceAnalysis.DocCommentIdParser -open NUnit.Framework +open Xunit open Microsoft.VisualStudio.FSharp.Editor - - - -[] +[] let ``Test DocCommentId parser``() = let testData = dict [ "T:N.X.Nested", DocCommentId.Type ["N"; "X"; "Nested"]; diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs index be79eb48a9f..cb08d34ae88 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs @@ -7,7 +7,7 @@ open Microsoft.VisualStudio.FSharp.LanguageService open Salsa.Salsa open Salsa.VsMocks open Salsa.VsOpsUtils -open NUnit.Framework +open Xunit open UnitTests.TestLib.Salsa open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService @@ -25,7 +25,6 @@ module StandardSettings = let AC x y = AutoCompleteExpected(x,y) let DC x y = DotCompleteExpected(x,y) -[][] type UsingMSBuild() as this = inherit LanguageServiceBaseTests() @@ -212,11 +211,10 @@ type UsingMSBuild() as this = fileContents, marker, (fun completions -> - Assert.AreNotEqual(0,completions.Length) + Assert.NotEqual(0,completions.Length) let found = completions |> Array.exists(fun (CompletionItem(s,_,_,_,_)) -> s = expected) if not(found) then - printfn "Expected: %A to contain %s" completions expected - Assert.Fail() + failwithf "Expected: %A to contain %s" completions expected ), ?addtlRefAssy = addtlRefAssy ) @@ -232,7 +230,7 @@ type UsingMSBuild() as this = let (_, _, file) = this.CreateSingleFileProject(fileContents) MoveCursorToEndOfMarker(file,marker) let completions = AutoCompleteAtCursor file - Assert.AreNotEqual(0,completions.Length) + Assert.NotEqual(0,completions.Length) member public this.TestCompletionNotShowingWhenFastUpdate (firstSrc : string list) secondSrc marker = let (_, _, file) = this.CreateSingleFileProject(firstSrc) @@ -270,7 +268,7 @@ type UsingMSBuild() as this = let completions = DotCompletionAtStartOfMarker file marker AssertCompListIsEmpty(completions) - [] + [] member this.``AutoCompletion.ObjectMethods``() = let code = [ @@ -315,7 +313,7 @@ type UsingMSBuild() as this = test "DU_3." "DU_3." ["ExtensionPropObj"; "ExtensionMethodObj"; "Equals"] ["GetHashCode"] // no gethashcode, has equals defined in DU3 type test "DU_4." "DU_4." ["ExtensionPropObj"; "ExtensionMethodObj"; "GetHashCode"] ["Equals"] // no equals, has gethashcode defined in DU4 type - [] + [] member this.``AutoCompletion.BeforeThis``() = let code = [ @@ -348,9 +346,7 @@ type UsingMSBuild() as this = AssertCtrlSpaceCompletionListIsEmptyNoCoffeeBreak c "this." AssertAutoCompleteCompletionListIsEmptyNoCoffeeBreak c "this." - [] - [] - [] + [] member this.``TypeProvider.VisibilityChecksForGeneratedTypes``() = let extraRefs = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")] let check = DoWithAutoCompleteUsingExtraRefs extraRefs None true SourceFileKind.FS BackgroundRequestReason.MemberSelect @@ -385,49 +381,48 @@ type UsingMSBuild() as this = AssertCompListDoesNotContainAny(ci, ["f"; "ProtectedProp"; "ProtectedM"; "PrivateProp"; "PrivateM"]) - [] member public this.``AdjacentToDot_01``() = testAutoCompleteAdjacentToDot ".." - [] member public this.``AdjacentToDot_02``() = testAutoCompleteAdjacentToDot ".<" - [] member public this.``AdjacentToDot_03``() = testAutoCompleteAdjacentToDot ".>" - [] member public this.``AdjacentToDot_04``() = testAutoCompleteAdjacentToDot ".=" - [] member public this.``AdjacentToDot_05``() = testAutoCompleteAdjacentToDot ".!=" - [] member public this.``AdjacentToDot_06``() = testAutoCompleteAdjacentToDot ".$" - [] member public this.``AdjacentToDot_07``() = testAutoCompleteAdjacentToDot ".[]" - [] member public this.``AdjacentToDot_08``() = testAutoCompleteAdjacentToDot ".[]<-" - [] member public this.``AdjacentToDot_09``() = testAutoCompleteAdjacentToDot ".[,]<-" - [] member public this.``AdjacentToDot_10``() = testAutoCompleteAdjacentToDot ".[,,]<-" - [] member public this.``AdjacentToDot_11``() = testAutoCompleteAdjacentToDot ".[,,,]<-" - [] member public this.``AdjacentToDot_12``() = testAutoCompleteAdjacentToDot ".[,,,]" - [] member public this.``AdjacentToDot_13``() = testAutoCompleteAdjacentToDot ".[,,]" - [] member public this.``AdjacentToDot_14``() = testAutoCompleteAdjacentToDot ".[,]" - [] member public this.``AdjacentToDot_15``() = testAutoCompleteAdjacentToDot ".[..]" - [] member public this.``AdjacentToDot_16``() = testAutoCompleteAdjacentToDot ".[..,..]" - [] member public this.``AdjacentToDot_17``() = testAutoCompleteAdjacentToDot ".[..,..,..]" - [] member public this.``AdjacentToDot_18``() = testAutoCompleteAdjacentToDot ".[..,..,..,..]" - [] member public this.``AdjacentToDot_19``() = testAutoCompleteAdjacentToDot ".()" - [] member public this.``AdjacentToDot_20``() = testAutoCompleteAdjacentToDot ".()<-" - [] member public this.``AdjacentToDot_02_Negative``() = testAutoCompleteAdjacentToDotNegative ".<" - [] member public this.``AdjacentToDot_03_Negative``() = testAutoCompleteAdjacentToDotNegative ".>" - [] member public this.``AdjacentToDot_04_Negative``() = testAutoCompleteAdjacentToDotNegative ".=" - [] member public this.``AdjacentToDot_05_Negative``() = testAutoCompleteAdjacentToDotNegative ".!=" - [] member public this.``AdjacentToDot_06_Negative``() = testAutoCompleteAdjacentToDotNegative ".$" - [] member public this.``AdjacentToDot_07_Negative``() = testAutoCompleteAdjacentToDotNegative ".[]" - [] member public this.``AdjacentToDot_08_Negative``() = testAutoCompleteAdjacentToDotNegative ".[]<-" - [] member public this.``AdjacentToDot_09_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,]<-" - [] member public this.``AdjacentToDot_10_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,,]<-" - [] member public this.``AdjacentToDot_11_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,,,]<-" - [] member public this.``AdjacentToDot_12_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,,,]" - [] member public this.``AdjacentToDot_13_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,,]" - [] member public this.``AdjacentToDot_14_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,]" - [] member public this.``AdjacentToDot_15_Negative``() = testAutoCompleteAdjacentToDotNegative ".[..]" - [] member public this.``AdjacentToDot_16_Negative``() = testAutoCompleteAdjacentToDotNegative ".[..,..]" - [] member public this.``AdjacentToDot_17_Negative``() = testAutoCompleteAdjacentToDotNegative ".[..,..,..]" - [] member public this.``AdjacentToDot_18_Negative``() = testAutoCompleteAdjacentToDotNegative ".[..,..,..,..]" - [] member public this.``AdjacentToDot_19_Negative``() = testAutoCompleteAdjacentToDotNegative ".()" - [] member public this.``AdjacentToDot_20_Negative``() = testAutoCompleteAdjacentToDotNegative ".()<-" - [] member public this.``AdjacentToDot_21_Negative``() = testAutoCompleteAdjacentToDotNegative ".+." - - [] - [] + [] member public this.``AdjacentToDot_01``() = testAutoCompleteAdjacentToDot ".." + [] member public this.``AdjacentToDot_02``() = testAutoCompleteAdjacentToDot ".<" + [] member public this.``AdjacentToDot_03``() = testAutoCompleteAdjacentToDot ".>" + [] member public this.``AdjacentToDot_04``() = testAutoCompleteAdjacentToDot ".=" + [] member public this.``AdjacentToDot_05``() = testAutoCompleteAdjacentToDot ".!=" + [] member public this.``AdjacentToDot_06``() = testAutoCompleteAdjacentToDot ".$" + [] member public this.``AdjacentToDot_07``() = testAutoCompleteAdjacentToDot ".[]" + [] member public this.``AdjacentToDot_08``() = testAutoCompleteAdjacentToDot ".[]<-" + [] member public this.``AdjacentToDot_09``() = testAutoCompleteAdjacentToDot ".[,]<-" + [] member public this.``AdjacentToDot_10``() = testAutoCompleteAdjacentToDot ".[,,]<-" + [] member public this.``AdjacentToDot_11``() = testAutoCompleteAdjacentToDot ".[,,,]<-" + [] member public this.``AdjacentToDot_12``() = testAutoCompleteAdjacentToDot ".[,,,]" + [] member public this.``AdjacentToDot_13``() = testAutoCompleteAdjacentToDot ".[,,]" + [] member public this.``AdjacentToDot_14``() = testAutoCompleteAdjacentToDot ".[,]" + [] member public this.``AdjacentToDot_15``() = testAutoCompleteAdjacentToDot ".[..]" + [] member public this.``AdjacentToDot_16``() = testAutoCompleteAdjacentToDot ".[..,..]" + [] member public this.``AdjacentToDot_17``() = testAutoCompleteAdjacentToDot ".[..,..,..]" + [] member public this.``AdjacentToDot_18``() = testAutoCompleteAdjacentToDot ".[..,..,..,..]" + [] member public this.``AdjacentToDot_19``() = testAutoCompleteAdjacentToDot ".()" + [] member public this.``AdjacentToDot_20``() = testAutoCompleteAdjacentToDot ".()<-" + [] member public this.``AdjacentToDot_02_Negative``() = testAutoCompleteAdjacentToDotNegative ".<" + [] member public this.``AdjacentToDot_03_Negative``() = testAutoCompleteAdjacentToDotNegative ".>" + [] member public this.``AdjacentToDot_04_Negative``() = testAutoCompleteAdjacentToDotNegative ".=" + [] member public this.``AdjacentToDot_05_Negative``() = testAutoCompleteAdjacentToDotNegative ".!=" + [] member public this.``AdjacentToDot_06_Negative``() = testAutoCompleteAdjacentToDotNegative ".$" + [] member public this.``AdjacentToDot_07_Negative``() = testAutoCompleteAdjacentToDotNegative ".[]" + [] member public this.``AdjacentToDot_08_Negative``() = testAutoCompleteAdjacentToDotNegative ".[]<-" + [] member public this.``AdjacentToDot_09_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,]<-" + [] member public this.``AdjacentToDot_10_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,,]<-" + [] member public this.``AdjacentToDot_11_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,,,]<-" + [] member public this.``AdjacentToDot_12_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,,,]" + [] member public this.``AdjacentToDot_13_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,,]" + [] member public this.``AdjacentToDot_14_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,]" + [] member public this.``AdjacentToDot_15_Negative``() = testAutoCompleteAdjacentToDotNegative ".[..]" + [] member public this.``AdjacentToDot_16_Negative``() = testAutoCompleteAdjacentToDotNegative ".[..,..]" + [] member public this.``AdjacentToDot_17_Negative``() = testAutoCompleteAdjacentToDotNegative ".[..,..,..]" + [] member public this.``AdjacentToDot_18_Negative``() = testAutoCompleteAdjacentToDotNegative ".[..,..,..,..]" + [] member public this.``AdjacentToDot_19_Negative``() = testAutoCompleteAdjacentToDotNegative ".()" + [] member public this.``AdjacentToDot_20_Negative``() = testAutoCompleteAdjacentToDotNegative ".()<-" + [] member public this.``AdjacentToDot_21_Negative``() = testAutoCompleteAdjacentToDotNegative ".+." + + [] member public this.``LambdaOverloads.Completion``() = let prologue = "open System.Linq" let cases = @@ -452,8 +447,7 @@ type UsingMSBuild() as this = let code = [prologue; case] AssertCtrlSpaceCompleteContains code "(*$*)x.Len" ["Length"] [] - [] - [] + [] member public this.``Query.CompletionInJoinOn``() = let code = [ @@ -467,7 +461,7 @@ type UsingMSBuild() as this = - [] + [] member public this.``TupledArgsInLambda.Completion.Bug312557_1``() = let code = [ @@ -477,7 +471,7 @@ type UsingMSBuild() as this = ] AssertCtrlSpaceCompleteContains code "(*MARKER*)" ["xxx"; "yyy"] [] - [] + [] member public this.``TupledArgsInLambda.Completion.Bug312557_2``() = let code = [ @@ -491,7 +485,7 @@ type UsingMSBuild() as this = AssertCtrlSpaceCompleteContains code "b a" ["aaa"; "bbb"] [] AssertCtrlSpaceCompleteContains code "a b" ["aaa"; "bbb"] [] - [] + [] member this.``AutoCompletion.OnTypeConstraintError``() = let code = [ @@ -508,14 +502,12 @@ type UsingMSBuild() as this = ] AssertCtrlSpaceCompleteContains code "abcd." ["Bar"; "Equals"; "GetHashCode"; "GetType"; "InternalMethod"; "PublicMethodForIntellisense"; "ToString"] [] - [] - [] + [] member public this.``RangeOperator.IncorrectUsage``() = AssertCtrlSpaceCompletionListIsEmpty [".."] ".." AssertCtrlSpaceCompletionListIsEmpty ["..."] "..." - [] - [] + [] member public this.``Inherit.CompletionInConstructorArguments1``() = let code = [ @@ -524,8 +516,7 @@ type UsingMSBuild() as this = ] AssertCtrlSpaceCompleteContains code "inherit A(a" ["abs"] [] - [] - [] + [] member public this.``Inherit.CompletionInConstructorArguments2``() = let code = [ @@ -534,8 +525,7 @@ type UsingMSBuild() as this = ] AssertCtrlSpaceCompleteContains code "System.String." ["Empty"] ["Array"; "Collections"] - [] - [] + [] member public this.``ObjectInitializer.CompletionForProperties``() = let typeDef1 = [ @@ -602,8 +592,7 @@ type UsingMSBuild() as this = AssertCtrlSpaceCompleteContains (typeDef4 @ ["new M.A<_, _>(S = 1)"]) "A<_, _>(S = 1" [] ["NonSettableProperty"; "SettableProperty"] AssertCtrlSpaceCompleteContains (typeDef4 @ ["new M.A<_, _>(S = 1,)"]) "A<_, _>(S = 1," ["AnotherSettableProperty"] ["NonSettableProperty"] - [] - [] + [] member public this.``ObjectInitializer.CompletionForSettableExtensionProperties``() = let typeDef = [ @@ -615,8 +604,7 @@ type UsingMSBuild() as this = AssertCtrlSpaceCompleteContains (typeDef @ ["open Ext"; "A((**))"]) "A((**)" ["XYZ"] [] // positive AssertCtrlSpaceCompleteContains (typeDef @ ["A((**))"]) "A((**)" [] ["XYZ"] // negative - [] - [] + [] member public this.``ObjectInitializer.CompletionForNamedParameters``() = let typeDef1 = [ @@ -639,8 +627,7 @@ type UsingMSBuild() as this = AssertCtrlSpaceCompleteContains (typeDef2 @ ["A.Run<_>(x = 1)"]) ".Run<_>(x" ["xyz"] [] AssertCtrlSpaceCompleteContains (typeDef2 @ ["A.Run<_>(x = 1,)"]) ".Run<_>(x = 1," ["xyz"; "zyx"] [] - [] - [] + [] member public this.``ObjectInitializer.CompletionForSettablePropertiesInReturnValue``() = let typeDef1 = [ @@ -675,8 +662,7 @@ type UsingMSBuild() as this = AssertCtrlSpaceCompleteContains (typeDef2 @ ["A.Run<_>(Settable = 1,)"]) ".Run<_>(Settable = 1," ["Settable0"] ["NonSettable"] - [] - [] + [] member public this.``RangeOperator.CorrectUsage``() = let useCases = [ @@ -697,7 +683,7 @@ type UsingMSBuild() as this = - [] + [] member public this.``Array.Length.InForRange``() = AssertAutoCompleteContainsNoCoffeeBreak [ "let a = [|1;2;3|] @@ -706,7 +692,7 @@ for i in 0..a."] [ "Length" ] // should contain [ ] // should not contain - [] + [] member public this.``ProtectedMembers.BaseClass`` () = let sourceCode = [ @@ -716,7 +702,7 @@ for i in 0..a."] ] AssertCtrlSpaceCompleteContains sourceCode "x." ["Message"; "HResult"] [] - [] + [] member public this.``ProtectedMembers.SelfOrDerivedClass`` () = let sources = [ @@ -737,9 +723,7 @@ for i in 0..a."] AssertCtrlSpaceCompleteContains src "x." ["Message"; "HResult"] [] - [] - [] - [] + [] member public this.``Records.DotCompletion.ConstructingRecords1``() = let prologue = "type OuterRec = {XX : int; YY : string}" @@ -754,8 +738,7 @@ for i in 0..a."] let code = [prologue; code] AssertCtrlSpaceCompleteContains code marker should ["abs"] - [] - [] + [] member public this.``Records.DotCompletion.ConstructingRecords2``() = let prologue = [ @@ -774,8 +757,7 @@ for i in 0..a."] let code = prologue @ [code] AssertCtrlSpaceCompleteContains code marker should shouldnot - [] - [] + [] member public this.``Records.CopyOnUpdate``() = let prologue = [ @@ -793,8 +775,7 @@ for i in 0..a."] let code = prologue @ [code] AssertCtrlSpaceCompleteContains code marker ["a"; "b"] ["abs"] - [] - [] + [] member public this.``Records.CopyOnUpdate.NoFieldsCompletionBeforeWith``() = let code = [ @@ -804,8 +785,7 @@ for i in 0..a."] ] AssertCtrlSpaceCompleteContains code "{r " [] ["AAA"] - [] - [] + [] member public this.``Records.Constructors1``() = let prologue = [ @@ -825,8 +805,7 @@ for i in 0..a."] let code = prologue @ [code] AssertCtrlSpaceCompleteContains code marker ["field1"; "field2"] ["abs"] - [] - [] + [] member public this.``Records.Constructors2.UnderscoresInNames``() = let prologue = [ @@ -845,14 +824,12 @@ for i in 0..a."] AssertCtrlSpaceCompleteContains code marker ["_field1"; "_field2"] ["abs"] - [] - [] + [] member public this.``Records.NestedRecordPatterns``() = let code = ["[1..({contents = 5}).]"] AssertCtrlSpaceCompleteContains code "5})." ["Value"; "contents"] ["CompareTo"] - [] - [] + [] member public this.``Records.Separators1``() = let useCases = [ @@ -872,8 +849,7 @@ for i in 0..a."] printfn "%A" code AssertCtrlSpaceCompleteContains code marker ["abs"] ["AAA"; "BBB"] - [] - [] + [] member public this.``Records.Separators2``() = let useCases = [ @@ -909,8 +885,7 @@ for i in 0..a."] printfn "%A" code AssertCtrlSpaceCompleteContains code marker should ["abs"] - [] - [] + [] member public this.``Records.Inherits``() = let prologue = [ @@ -935,8 +910,7 @@ for i in 0..a."] printfn "%s" (String.concat "\r\n" code) AssertCtrlSpaceCompleteContains code marker should ["abs"] - [] - [] + [] member public this.``Records.MissingBindings``() = let prologue = [ @@ -956,8 +930,7 @@ for i in 0..a."] printfn "%s" (String.concat "\r\n" code) AssertCtrlSpaceCompleteContains code marker should ["abs"] - [] - [] + [] member public this.``Records.WRONG.ErrorsInFirstBinding``() = // errors in the first binding are critical now let prologue = @@ -976,8 +949,7 @@ for i in 0..a."] let code = prologue @ [code] AssertCtrlSpaceCompleteContains code marker [] ["field1"; "field2"] - [] - [] + [] member public this.``Records.InferByFieldsInPriorMethodArguments``() = let prologue = @@ -1005,7 +977,7 @@ for i in 0..a."] let code = prologue @ [code] AssertCtrlSpaceCompleteContains code marker should [] - [] + [] member this.``Completion.DetectInterfaces``() = let shouldBeInterface = [ @@ -1028,7 +1000,7 @@ for i in 0..a."] AssertCtrlSpaceCompleteContains ifs "(*M*)" ["seq"] ["obj"] - [] + [] member this.``Completion.DetectClasses``() = let shouldBeClass = @@ -1056,7 +1028,7 @@ for i in 0..a."] for cls in shouldBeClass do AssertCtrlSpaceCompleteContains cls "(*M*)" ["obj"] ["seq"] - [] + [] member this.``Completion.DetectUnknownCompletionContext``() = let content = [ @@ -1066,7 +1038,7 @@ for i in 0..a."] AssertCtrlSpaceCompleteContains content "(*M*)" ["obj"; "seq"] ["abs"] - [] + [] member this.``Completion.DetectInvalidCompletionContext``() = let shouldBeInvalid = [ @@ -1105,7 +1077,7 @@ for i in 0..a."] AssertCtrlSpaceCompletionListIsEmpty invalid "(*M*)" - [] + [] member this.``Completion.LongIdentifiers``() = // System.Diagnostics.Debugger.Launch() |> ignore AssertCtrlSpaceCompleteContains @@ -1188,8 +1160,7 @@ for i in 0..a."] ["Collections"; "IDisposable"] [] - [] - [] + [] member public this.``Query.GroupJoin.CompletionInIncorrectJoinRelations``() = let code = [ @@ -1202,8 +1173,7 @@ for i in 0..a."] AssertCtrlSpaceCompleteContains code "(x." ["CompareTo"] ["abs"] AssertCtrlSpaceCompleteContains code "? y." ["Chars"; "Length"] ["abs"] - [] - [] + [] member public this.``Query.Join.CompletionInIncorrectJoinRelations``() = let code = [ @@ -1216,8 +1186,7 @@ for i in 0..a."] AssertCtrlSpaceCompleteContains code "(x." ["CompareTo"] ["abs"] AssertCtrlSpaceCompleteContains code "? y." ["Chars"; "Length"] ["abs"] - [] - [] + [] member public this.``Query.ForKeywordCanCompleteIntoIdentifier``() = let code = [ @@ -1229,7 +1198,7 @@ for i in 0..a."] ] AssertCtrlSpaceCompleteContains code "for" ["form"] [] // 'for' is a keyword, but should not prevent completion - [] + [] member public this.``ObjInstance.InheritedClass.MethodsWithDiffAccessibility``() = AssertAutoCompleteContainsNoCoffeeBreak [ "type Base = @@ -1249,7 +1218,7 @@ derived.derivedField"] [ "baseField"; "derivedField" ] // should contain [ "baseFieldPrivate"; "derivedFieldPrivate" ] // should not contain - [] + [] member public this.``ObjInstance.InheritedClass.MethodsWithDiffAccessibilityWithSameNameMethod``() = AssertAutoCompleteContainsNoCoffeeBreak [ "type Base = @@ -1270,7 +1239,7 @@ derived.derivedField"] [ "baseField"; "derivedField" ] // should contain [ "baseFieldPrivate"; "derivedFieldPrivate" ] // should not contain - [] + [] member public this.``Visibility.InheritedClass.MethodsWithDiffAccessibility``() = AssertAutoCompleteContainsNoCoffeeBreak [ "type Base = @@ -1289,7 +1258,7 @@ type Derived = [ "baseField"; "derivedField"; "derivedFieldPrivate" ] // should contain [ "baseFieldPrivate" ] // should not contain - [] + [] member public this.``Visibility.InheritedClass.MethodsWithDiffAccessibilityWithSameNameMethod``() = AssertAutoCompleteContainsNoCoffeeBreak [ "type Base = @@ -1309,7 +1278,7 @@ type Derived = [ "baseField"; "derivedField"; "derivedFieldPrivate" ] // should contain [ "baseFieldPrivate" ] // should not contain - [] + [] member public this.``Visibility.InheritedClass.MethodsWithSameNameMethod``() = AssertAutoCompleteContainsNoCoffeeBreak [ "type MyClass = @@ -1330,7 +1299,7 @@ let x = new MyClass2(0) [ "foo" ] // should contain [ ] // should not contain - [] + [] member public this.``Identifier.Array.AfterassertKeyword``() = AssertAutoCompleteContainsNoCoffeeBreak [ "let x = [1;2;3] " @@ -1339,7 +1308,7 @@ let x = new MyClass2(0) [ "Head" ] // should contain (from List) [ "Listeners" ] // should not contain (from System.Diagnostics.Debug) - [] + [] member public this.``CtrlSpaceCompletion.Bug130670.Case1``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak [ "let i = async.Return(4)" ] @@ -1347,7 +1316,7 @@ let x = new MyClass2(0) [ "AbstractClassAttribute" ] // should contain (top-level) [ "GetType" ] // should not contain (object instance method) - [] + [] member public this.``CtrlSpaceCompletion.Bug130670.Case2``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak [ """ @@ -1357,7 +1326,7 @@ let x = new MyClass2(0) [ "AbstractClassAttribute" ] // should contain (top-level) [ "CompareTo" ] // should not contain (instance method on int) - [] + [] member public this.``CtrlSpaceCompletion.Bug294974.Case1``() = AssertCtrlSpaceCompleteContains @@ -1368,7 +1337,7 @@ let x = new MyClass2(0) [ "xxx" ] // should contain (completions before dot) [ "IsEmpty" ] // should not contain (completions after dot) - [] + [] member public this.``CtrlSpaceCompletion.Bug294974.Case2``() = AssertCtrlSpaceCompleteContains [ """ @@ -1378,7 +1347,7 @@ let x = new MyClass2(0) [ "AbstractClassAttribute" ] // should contain (top-level) [ "IsEmpty" ] // should not contain (completions after dot) - [] + [] member public this.``ObsoleteProperties.6377_1``() = AssertAutoCompleteContainsNoCoffeeBreak [ "System.Security.SecurityManager." ] @@ -1386,7 +1355,7 @@ let x = new MyClass2(0) [ "GetStandardSandbox" ] // should contain [ "get_SecurityEnabled"; "set_SecurityEnabled" ] // should not contain - [] + [] member public this.``ObsoleteProperties.6377_2``() = AssertAutoCompleteContainsNoCoffeeBreak [ "System.Threading.Thread.CurrentThread." ] @@ -1394,7 +1363,7 @@ let x = new MyClass2(0) [ "CurrentCulture" ] // should contain: just make sure something shows [ "get_ApartmentState"; "set_ApartmentState" ] // should not contain - [] + [] member public this.``PopupsVersusCtrlSpaceOnDotDot.FirstDot.Popup``() = AssertAutoCompleteContainsNoCoffeeBreak [ "System.Console..BackgroundColor" ] @@ -1402,7 +1371,7 @@ let x = new MyClass2(0) [ "BackgroundColor" ] // should contain (from prior System.Console) [ "abs" ] // should not contain (top-level autocomplete on empty identifier) - [] + [] member public this.``PopupsVersusCtrlSpaceOnDotDot.FirstDot.CtrlSpace``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak [ "System.Console..BackgroundColor" ] @@ -1410,17 +1379,17 @@ let x = new MyClass2(0) [ "BackgroundColor" ] // should contain (from prior System.Console) [ "abs" ] // should not contain (top-level autocomplete on empty identifier) - [] + [] member public this.``DotCompletionInPatternsPartOfLambda``() = let content = ["let _ = fun x . -> x + 1"] AssertCtrlSpaceCompletionListIsEmpty content "x ." - [] + [] member public this.``DotCompletionInBrokenLambda``() = let content = ["1 |> id (fun x .> x)"] AssertCtrlSpaceCompletionListIsEmpty content "x ." - [] + [] member public this.``DotCompletionInPatterns``() = let useCases = [ @@ -1433,7 +1402,7 @@ let x = new MyClass2(0) AssertCtrlSpaceCompletionListIsEmpty source marker - [] + [] member public this.``DotCompletionWithBrokenLambda``() = let errors = [ @@ -1458,8 +1427,7 @@ let x = new MyClass2(0) AssertCtrlSpaceCompleteContains source marker should shouldnot - [] - [] + [] member public this.``AfterConstructor.5039_1``() = AssertAutoCompleteContainsNoCoffeeBreak [ "let someCall(x) = null" @@ -1468,8 +1436,7 @@ let x = new MyClass2(0) [ "ReadBlock" ] // should contain (StringReader) [ "LastIndexOfAny" ] // should not contain (String) - [] - [] + [] member public this.``AfterConstructor.5039_1.CoffeeBreak``() = AssertAutoCompleteContains [ "let someCall(x) = null" @@ -1478,7 +1445,7 @@ let x = new MyClass2(0) [ "ReadBlock" ] // should contain (StringReader) [ "LastIndexOfAny" ] // should not contain (String) - [] + [] member public this.``AfterConstructor.5039_2``() = AssertAutoCompleteContainsNoCoffeeBreak [ "System.Random()." ] @@ -1486,7 +1453,7 @@ let x = new MyClass2(0) [ "NextDouble" ] // should contain [ ] // should not contain - [] + [] member public this.``AfterConstructor.5039_3``() = AssertAutoCompleteContainsNoCoffeeBreak [ "System.Collections.Generic.List()." ] @@ -1494,7 +1461,7 @@ let x = new MyClass2(0) [ "BinarySearch" ] // should contain [ ] // should not contain - [] + [] member public this.``AfterConstructor.5039_4``() = AssertAutoCompleteContainsNoCoffeeBreak [ "System.Collections.Generic.List()." ] @@ -1502,7 +1469,7 @@ let x = new MyClass2(0) [ "BinarySearch" ] // should contain [ ] // should not contain - [] + [] member public this.``Literal.809979``() = AssertAutoCompleteContainsNoCoffeeBreak [ "let value=uint64." ] @@ -1510,7 +1477,7 @@ let x = new MyClass2(0) [ ] // should contain [ "Parse" ] // should not contain - [] + [] member public this.``NameSpace.AsConstructor``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak [ "new System.DateTime()" ] @@ -1518,7 +1485,7 @@ let x = new MyClass2(0) ["System";"Array2D"] ["DaysInMonth"; "AddDays" ] // should contain top level info, no static or instance DateTime members! - [] + [] member public this.``DotAfterApplication1``() = AssertAutoCompleteContainsNoCoffeeBreak ["let g a = new System.Random()" @@ -1527,7 +1494,7 @@ let x = new MyClass2(0) ["Next"] [ ] - [] + [] member public this.``DotAfterApplication2``() = AssertAutoCompleteContainsNoCoffeeBreak ["let g a = new System.Random()" @@ -1536,7 +1503,7 @@ let x = new MyClass2(0) ["Head"] [ ] - [] + [] member public this.``Quickinfo.809979``() = AssertAutoCompleteContainsNoCoffeeBreak [ "let value=uint64." ] @@ -1545,19 +1512,19 @@ let x = new MyClass2(0) [ "Parse" ] // should not contain /// No intellisense in comments/strings! - [] + [] member public this.``InString``() = this.VerifyCtrlSpaceCompListIsEmptyAtEndOfMarker( fileContents = """ // System.C """ , marker = "// System.C" ) - [] + [] member public this.``InComment``() = this.VerifyCtrlSpaceCompListIsEmptyAtEndOfMarker( fileContents = """ let s = "System.C" """, marker = "\"System.C") /// Intellisense at the top level (on white space) - [] + [] member public this.``Identifier.OnWhiteSpace.AtTopLevel``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["(*marker*) "] @@ -1566,7 +1533,7 @@ let x = new MyClass2(0) ["Int32"] /// Intellisense at the top level (after a partial token). All matches should be shown even if there is a unique match - [] + [] member public this.``TopLevelIdentifier.AfterPartialToken1``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let foobaz = 1" @@ -1575,7 +1542,7 @@ let x = new MyClass2(0) ["System";"Array2D";"foobaz"] ["Int32"] - [] + [] member public this.``TopLevelIdentifier.AfterPartialToken2``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let foobaz = 1" @@ -1585,7 +1552,7 @@ let x = new MyClass2(0) [] (* these issues have not been fixed yet, but when they are, here are some tests - [] + [] member public this.``AutoComplete.Bug65730``() = AssertAutoCompleteContains [ "let f x y = x.Equals(y)" ] @@ -1593,7 +1560,7 @@ let x = new MyClass2(0) [ "Equals" ] // should contain [ ] // should not contain - [] + [] member public this.``AutoComplete.Bug65731_A``() = AssertAutoCompleteContains [ @@ -1605,7 +1572,7 @@ let x = new MyClass2(0) [ "a" ] // should contain [ ] // should not contain - [] + [] member public this.``AutoComplete.Bug65731_B``() = AssertAutoCompleteContains [ @@ -1617,7 +1584,7 @@ let x = new MyClass2(0) [ "a" ] // should contain [ ] // should not contain - [] + [] member public this.``AutoComplete.Bug69654_0``() = let code = [ @" let q = @@ -1646,7 +1613,7 @@ let x = new MyClass2(0) gpatcc.AssertExactly(0,0) - [] + [] member public this.``AutoComplete.Bug69654_1``() = let code = [ "let s = async {" @@ -1685,7 +1652,7 @@ let x = new MyClass2(0) gpatcc.AssertExactly(0,0) - [] + [] member public this.``AutoComplete.Bug69654_2``() = let code = [ "let s = async {" @@ -1725,7 +1692,7 @@ let x = new MyClass2(0) gpatcc.AssertExactly(0,0) *) - [] + [] member public this.``List.AfterAddLinqNamespace.Bug3754``() = let code = ["open System.Xml.Linq" @@ -1735,7 +1702,7 @@ let x = new MyClass2(0) let completions = AutoCompleteAtCursor file AssertCompListContainsAll(completions, [ "map"; "filter" ] ) - [] + [] member public this.``Global``() = AssertAutoCompleteContainsNoCoffeeBreak ["global."] @@ -1743,7 +1710,7 @@ let x = new MyClass2(0) ["System"; "Microsoft" ] [] - [] + [] member public this.``Duplicates.Bug4103a``() = let code = [ @@ -1762,7 +1729,7 @@ let x = new MyClass2(0) AssertEqualWithMessage(2, occurrences, "The entry for 'Expr.Var' is duplicated.") /// Testing autocomplete after a dot directly following method call - [] + [] member public this.``AfterMethod.Bug2296``() = AssertAutoCompleteContainsNoCoffeeBreak [ "type System.Int32 with" @@ -1773,7 +1740,7 @@ let x = new MyClass2(0) [] /// Testing autocomplete after a dot directly following overloaded method call - [] + [] member public this.``AfterMethod.Overloaded.Bug2296``() = AssertAutoCompleteContainsNoCoffeeBreak ["type System.Boolean with" @@ -1783,7 +1750,7 @@ let x = new MyClass2(0) ["BooleanMember"] [] - [] + [] member public this.``BasicGlobalMemberList``() = AssertAutoCompleteContainsNoCoffeeBreak ["let x = 1" @@ -1792,7 +1759,7 @@ let x = new MyClass2(0) ["CompareTo"; "GetHashCode"] [] - [] + [] member public this.``CharLiteral``() = AssertAutoCompleteContainsNoCoffeeBreak ["let x = \"foo\"" @@ -1802,7 +1769,7 @@ let x = new MyClass2(0) ["CompareTo";"GetHashCode"] [] - [] + [] member public this.``GlobalMember.ListOnIdentifierEndingWithTick``() = AssertAutoCompleteContainsNoCoffeeBreak ["let x' = 1" @@ -1811,7 +1778,7 @@ let x = new MyClass2(0) ["CompareTo";"GetHashCode"] [] - [] + [] member public this.``GlobalMember.ListOnIdentifierContainingTick``() = AssertAutoCompleteContainsNoCoffeeBreak ["let x'y = 1" @@ -1820,7 +1787,7 @@ let x = new MyClass2(0) ["CompareTo";"GetHashCode"] [] - [] + [] member public this.``GlobalMember.ListWithPartialMember1``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let x = 1" @@ -1829,7 +1796,7 @@ let x = new MyClass2(0) ["CompareTo";"GetHashCode"] [] - [] + [] member public this.``GlobalMember.ListWithPartialMember2``() = AssertAutoCompleteContainsNoCoffeeBreak ["let x = 1" @@ -1839,7 +1806,7 @@ let x = new MyClass2(0) [] /// Wrong intellisense for array - [] + [] member public this.``DotOff.Parenthesized.Expr``() = AssertAutoCompleteContainsNoCoffeeBreak ["let string_of_int (x:int) = x.ToString()" @@ -1850,7 +1817,7 @@ let x = new MyClass2(0) [] /// Wrong intellisense for array - [] + [] member public this.``DotOff.ArrayIndexerNotation``() = AssertAutoCompleteContainsNoCoffeeBreak ["let string_of_int (x:int) = x.ToString()" @@ -1861,7 +1828,7 @@ let x = new MyClass2(0) [] /// Wrong intellisense for array - [] + [] member public this.``DotOff.ArraySliceNotation1``() = AssertAutoCompleteContainsNoCoffeeBreak ["let string_of_int (x:int) = x.ToString()" @@ -1873,7 +1840,7 @@ let x = new MyClass2(0) ["Length"] [] - [] + [] member public this.``DotOff.ArraySliceNotation2``() = AssertAutoCompleteContainsNoCoffeeBreak ["let string_of_int (x:int) = x.ToString()" @@ -1885,7 +1852,7 @@ let x = new MyClass2(0) ["Length"] [] - [] + [] member public this.``DotOff.ArraySliceNotation3``() = AssertAutoCompleteContainsNoCoffeeBreak ["let string_of_int (x:int) = x.ToString()" @@ -1897,7 +1864,7 @@ let x = new MyClass2(0) ["Length"] [] - [] + [] member public this.``DotOff.DictionaryIndexer``() = AssertAutoCompleteContainsNoCoffeeBreak ["let dict = new System.Collections.Generic.Dictionary()" @@ -1907,13 +1874,13 @@ let x = new MyClass2(0) [] /// intellisense on DOT - [] + [] member public this.``EmptyFile.Dot.Bug1115``() = this.VerifyAutoCompListIsEmptyAtEndOfMarker( fileContents = "." , marker = ".") - [] + [] member public this.``Identifier.NonDottedNamespace.Bug1347``() = this.AssertCtrlSpaceCompletionContains( ["open System" @@ -1926,7 +1893,7 @@ let x = new MyClass2(0) "let x = Mic", "Microsoft") - [] + [] member public this.``MatchStatement.WhenClause.Bug2519``() = AssertAutoCompleteContainsNoCoffeeBreak ["type DU = X of int" @@ -1938,7 +1905,7 @@ let x = new MyClass2(0) ["CompareTo";"GetHashCode"] [] - [] + [] member public this.``String.BeforeIncompleteModuleDefinition.Bug2385``() = AssertAutoCompleteContainsNoCoffeeBreak ["let s = \"hello\"." @@ -1947,7 +1914,7 @@ let x = new MyClass2(0) ["Substring";"GetHashCode"] [] - [] + [] member public this.``Project.FsFileWithBuildAction``() = AssertAutoCompleteContainsNoCoffeeBreak ["let i = 4" @@ -1958,7 +1925,7 @@ let x = new MyClass2(0) [] /// Dotting off a string literal should work. - [] + [] member public this.``DotOff.String``() = AssertAutoCompleteContainsNoCoffeeBreak ["\"x\". (*marker*)" @@ -1968,7 +1935,7 @@ let x = new MyClass2(0) [] /// FEATURE: Pressing dot (.) after an local variable will produce an Intellisense list of members the user may select. - [] + [] member public this.``BasicLocalMemberList``() = AssertAutoCompleteContainsNoCoffeeBreak ["let MyFunction (s:string) = " @@ -1979,7 +1946,7 @@ let x = new MyClass2(0) ["Substring";"GetHashCode"] [] - [] + [] member public this.``LocalMemberList.WithPartialMemberEntry1``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let MyFunction (s:string) = " @@ -1990,7 +1957,7 @@ let x = new MyClass2(0) ["Substring";"GetHashCode"] [] - [] + [] member public this.``LocalMemberList.WithPartialMemberEntry2``() = AssertAutoCompleteContainsNoCoffeeBreak ["let MyFunction (s:string) = " @@ -2001,8 +1968,7 @@ let x = new MyClass2(0) ["Substring";"GetHashCode"] [] - [] - [] + [] member public this.``CurriedArguments.Regression1``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let fffff x y = 1" @@ -2014,7 +1980,7 @@ let x = new MyClass2(0) ["fffff"] [] - [] + [] member public this.``CurriedArguments.Regression2``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let fffff x y = 1" @@ -2026,7 +1992,7 @@ let x = new MyClass2(0) ["fffff"] [] - [] + [] member public this.``CurriedArguments.Regression3``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let fffff x y = 1" @@ -2038,7 +2004,7 @@ let x = new MyClass2(0) ["ggggg"] [] - [] + [] member public this.``CurriedArguments.Regression4``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let fffff x y = 1" @@ -2050,7 +2016,7 @@ let x = new MyClass2(0) ["ggggg"] [] - [] + [] member public this.``CurriedArguments.Regression5``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let fffff x y = 1" @@ -2062,7 +2028,7 @@ let x = new MyClass2(0) ["ggggg"] [] - [] + [] member public this.``CurriedArguments.Regression6``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let fffff x y = 1" @@ -2075,7 +2041,7 @@ let x = new MyClass2(0) [] // Test whether standard types appear in the completion list under both F# and .NET name - [] + [] member public this.``StandardTypes.Bug4403``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["open System"; "let x=" ] @@ -2084,7 +2050,7 @@ let x = new MyClass2(0) [ ] // Test whether standard types appear in the completion list under both F# and .NET name - [] + [] member public this.``ValueDeclarationHidden.Bug4405``() = AssertAutoCompleteContainsNoCoffeeBreak [ "do " @@ -2094,7 +2060,7 @@ let x = new MyClass2(0) ["IndexOf"; "Substring"] [ ] - [] + [] member public this.``StringFunctions``() = let code = [ @@ -2105,7 +2071,7 @@ let x = new MyClass2(0) MoveCursorToEndOfMarker(file,"String.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." // printf "Completions=%A\n" completions - Assert.IsTrue(completions.Length > 0) + Assert.True(completions.Length > 0) for completion in completions do match completion with | CompletionItem(_,_,_,_,DeclarationType.Method) -> () @@ -2113,7 +2079,7 @@ let x = new MyClass2(0) // FEATURE: Pressing ctrl+space or ctrl+j will give a list of valid completions. - [] + [] //Verified at least "Some" is contained in the Ctrl-Space Completion list member public this.``NonDotCompletion``() = this.AssertCtrlSpaceCompletionContains( @@ -2121,10 +2087,7 @@ let x = new MyClass2(0) "x = S", "Some") - [] - [] - [] - [] + [] // This test case checks Pressing ctrl+space on the provided Type instance method shows list of valid completions member this.``TypeProvider.EditorHideMethodsAttribute.InstanceMethod.CtrlSpaceCompletionContains``() = this.AssertCtrlSpaceCompletionContains( @@ -2135,10 +2098,7 @@ let x = new MyClass2(0) expected = "IM1", addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] // This test case checks Pressing ctrl+space on the provided Type Event shows list of valid completions member this.``TypeProvider.EditorHideMethodsAttribute.Event.CtrlSpaceCompletionContains``() = this.AssertCtrlSpaceCompletionContains( @@ -2149,9 +2109,7 @@ let x = new MyClass2(0) expected = "Event1", addtlRefAssy = [PathRelativeToTestAssembly(@"EditorHideMethodsAttribute.dll")]) - [] - [] - [] + [] // This test case checks Pressing ctrl+space on the provided Type static parameter and verify "int" is in the list just to make sure bad things don't happen and autocomplete window pops up member this.``TypeProvider.EditorHideMethodsAttribute.Type.CtrlSpaceCompletionContains``() = this.AssertCtrlSpaceCompletionContains( @@ -2163,7 +2121,7 @@ let x = new MyClass2(0) // In this bug, pressing dot after this was producing an invalid member list. - [] + [] member public this.``Class.Self.Bug1544``() = this.VerifyAutoCompListIsEmptyAtEndOfMarker( fileContents = " @@ -2172,14 +2130,14 @@ let x = new MyClass2(0) marker = "this.") // No completion list at the end of file. - [] + [] member public this.``Identifier.AfterDefined.Bug1545``() = this.AutoCompletionListNotEmpty ["let x = [|\"hello\"|]" "x."] "x." - [] + [] member public this.``Bug243082.DotAfterNewBreaksCompletion`` () = this.AutoCompletionListNotEmpty [ @@ -2190,7 +2148,7 @@ let x = new MyClass2(0) "let z = new A."] "s." - [] + [] member public this.``Bug243082.DotAfterNewBreaksCompletion2`` () = this.AutoCompletionListNotEmpty [ @@ -2199,9 +2157,7 @@ let x = new MyClass2(0) "new System."] "s." - [] - [] - [] + [] member this.``QueryExpression.CtrlSpaceSmokeTest0``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -2211,9 +2167,7 @@ let x = new MyClass2(0) list = ["sin"], addtlRefAssy=standard40AssemblyRefs ) - [] - [] - [] + [] member this.``QueryExpression.CtrlSpaceSmokeTest0b``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -2223,9 +2177,7 @@ let x = new MyClass2(0) list = ["query"], addtlRefAssy=standard40AssemblyRefs ) - [] - [] - [] + [] member this.``QueryExpression.CtrlSpaceSmokeTest1``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -2235,9 +2187,7 @@ let x = new MyClass2(0) list = ["select"], addtlRefAssy=standard40AssemblyRefs ) - [] - [] - [] + [] member this.``QueryExpression.CtrlSpaceSmokeTest1b``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -2249,9 +2199,7 @@ let x = new MyClass2(0) - [] - [] - [] + [] member this.``QueryExpression.CtrlSpaceSmokeTest2``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -2262,9 +2210,7 @@ let x = new MyClass2(0) addtlRefAssy=standard40AssemblyRefs ) - [] - [] - [] + [] member this.``QueryExpression.CtrlSpaceSmokeTest3``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -2275,8 +2221,7 @@ let x = new MyClass2(0) addtlRefAssy=standard40AssemblyRefs ) - [] - [] + [] member this.``QueryExpression.CtrlSpaceSmokeTest3b``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -2288,8 +2233,7 @@ let x = new MyClass2(0) - [] - [] + [] member this.``QueryExpression.CtrlSpaceSmokeTest3c``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -2300,8 +2244,7 @@ let x = new MyClass2(0) addtlRefAssy=standard40AssemblyRefs ) - [] - [] + [] member this.``AsyncExpression.CtrlSpaceSmokeTest3d``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -2349,11 +2292,8 @@ let x = new MyClass2(0) let y = x + 1 (*TYPING*)""" ] - [] + [] /// This is the case where at (*TYPING*) we first type 1...N-1 characters of the target custom operation and then invoke the completion list, and we check that the completion list contains the custom operation - [] - [] - [] member this.``QueryExpression.CtrlSpaceSystematic1``() = let rec strictPrefixes (s:string) = seq { if s.Length > 1 then let s = s.[0..s.Length-2] in yield s; yield! strictPrefixes s} for customOperation in ["select";"skip";"contains";"groupJoin"] do @@ -2433,10 +2373,7 @@ let x = new MyClass2(0) if failures.Count <> 0 || unexpectedSuccesses.Count <> 0 then raise <| new Exception("there were unexpected results, see console output for details") - [] - [] - [] - [] + [] member this.``QueryExpressions.QueryAndSequenceExpressionWithForYieldLoopSystematic``() = let prefix = """ @@ -2494,9 +2431,7 @@ let aaaaaa = [| "1" |] this.WordByWordSystematicTestWithSpecificExpectations(prefix, suffixes, lines, ["seq";"query"], knownFailures) - [] - [] - [] + [] /// Incrementally enter a seq{ .. while ...} loop and check for availability of intellisense etc. member this.``SequenceExpressions.SequenceExprWithWhileLoopSystematic``() = @@ -2535,10 +2470,7 @@ let aaaaaa = 0 this.WordByWordSystematicTestWithSpecificExpectations(prefix, suffixes, lines, [""], knownFailures) - [] - [] - [] - [] + [] /// Incrementally enter query with a 'join' and check for availability of quick info, auto completion and dot completion member this.``QueryAndOtherExpressions.WordByWordSystematicJoinQueryOnSingleLine``() = @@ -2589,11 +2521,8 @@ let aaaaaa = 0 this.WordByWordSystematicTestWithSpecificExpectations(prefix, suffixes, lines, [""], knownFailures) - [] + [] /// This is a sanity check that the multiple-line case is much the same as the single-line case - [] - [] - [] member this.``QueryAndOtherExpressions.WordByWordSystematicJoinQueryOnMultipleLine``() = let prefix = """ @@ -2739,8 +2668,7 @@ let x = query { for bbbb in abbbbc(*D0*) do this.WordByWordSystematicTestWithSpecificExpectations(prefix, suffixes, lines, [""], knownFailures) - [] - [] + [] /// This is the case where (*TYPING*) nothing has been typed yet and we invoke the completion list /// This is a known failure right now for some of the example files above. member this.``QueryExpression.CtrlSpaceSystematic2``() = @@ -2767,14 +2695,14 @@ let x = query { for bbbb in abbbbc(*D0*) do let completions = time1 CtrlSpaceCompleteAtCursor file "Time of first autocomplete." AssertCompListContainsAll(completions, expected) - [] + [] member public this.``Parameter.CommonCase.Bug2884``() = this.AutoCompleteRecoveryTest ([ "type T1(aaa1) =" " do (" ], "do (", [ "aaa1" ]) - [] + [] member public this.``Parameter.SubsequentLet.Bug2884``() = this.AutoCompleteRecoveryTest ([ @@ -2782,7 +2710,7 @@ let x = query { for bbbb in abbbbc(*D0*) do " do (" "let a = 0" ], "do (", [ "aaa1" ]) - [] + [] member public this.``Parameter.SubsequentMember.Bug2884``() = this.AutoCompleteRecoveryTest ([ @@ -2791,7 +2719,7 @@ let x = query { for bbbb in abbbbc(*D0*) do " do (" " member x.Bar = 0" ], "do (", [ "aaa1"; "aaa2" ]) - [] + [] member public this.``Parameter.System.DateTime.Bug2884``() = this.AutoCompleteRecoveryTest ([ @@ -2799,7 +2727,7 @@ let x = query { for bbbb in abbbbc(*D0*) do " member x.Foo(aaa2) = " " let dt = new System.DateTime(" ], "Time(", [ "aaa1"; "aaa2" ]) - [] + [] member public this.``Parameter.DirectAfterDefined.Bug2884``() = this.AutoCompleteRecoveryTest ([ @@ -2807,21 +2735,21 @@ let x = query { for bbbb in abbbbc(*D0*) do " let aaa1 = 0" " (" ], "(", [ "aaa1" ]) - [] + [] member public this.``NotShowInfo.LetBinding.Bug3602``() = this.VerifyAutoCompListIsEmptyAtEndOfMarker( fileContents = "let s. = \"Hello world\" ()", marker = "let s.") - [] + [] member public this.``NotShowInfo.FunctionParameter.Bug3602``() = this.VerifyAutoCompListIsEmptyAtEndOfMarker( fileContents = "let foo s. = s + \"Hello world\" ()", marker = "let foo s.") - [] + [] member public this.``NotShowInfo.ClassMemberDeclA.Bug3602``() = this.TestCompletionNotShowingWhenFastUpdate [ @@ -2837,7 +2765,7 @@ let x = query { for bbbb in abbbbc(*D0*) do "(*marker*) this." // Another test case for the same thing - this goes through a different code path - [] + [] member public this.``NotShowInfo.ClassMemberDeclB.Bug3602``() = this.TestCompletionNotShowingWhenFastUpdate [ @@ -2852,7 +2780,7 @@ let x = query { for bbbb in abbbbc(*D0*) do "()" ] "marker$" - [] + [] member public this.``ComputationExpression.LetBang``() = AssertAutoCompleteContainsNoCoffeeBreak ["let http(url:string) = " @@ -2884,19 +2812,19 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertCompListContainsAll(completions, expected) gpatcc.AssertExactly(0,0) - [] + [] member public this.``Generics.Typeof``() = this.TestGenericAutoComplete ("let _ = typeof.", [ "Assembly"; "AssemblyQualifiedName"; (* ... *) ]) - [] + [] member public this.``Generics.NonGenericTypeMembers``() = this.TestGenericAutoComplete ("let _ = GT2.", [ "R"; "S" ]) - [] + [] member public this.``Generics.GenericTypeMembers``() = this.TestGenericAutoComplete ("let _ = GT.", [ "P"; "Q" ]) - //[] // keep disabled unless trying to prove that UnhandledExceptionHandler is working + //[] // keep disabled unless trying to prove that UnhandledExceptionHandler is working member public this.EnsureThatUnhandledExceptionsCauseAnAssert() = // Do something that causes LanguageService to load AssertAutoCompleteContains @@ -2913,7 +2841,7 @@ let x = query { for bbbb in abbbbc(*D0*) do t.Start() System.Threading.Thread.Sleep(1000) - [] + [] member public this.``DotBetweenParens.Bug175360.Case1``() = AssertAutoCompleteContains [ @@ -2923,7 +2851,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "ToDecimal" ] // should contain [] // should not contain - [] + [] member public this.``DotBetweenParens.Bug175360.Case2``() = AssertAutoCompleteContains [ "[| 1 |].(0)" ] @@ -2931,8 +2859,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Clone" ] // should contain [] // should not contain - [] - [] + [] member public this.``GenericType.Self.Bug69673_1.01``() = AssertCtrlSpaceCompleteContains ["type Base(o:obj) = class end" @@ -2945,7 +2872,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["this"] [] - [] + [] member public this.``GenericType.Self.Bug69673_1.02``() = AssertCtrlSpaceCompleteContains ["type Base(o:obj) = class end" @@ -2958,7 +2885,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["this"] [] - [] + [] member public this.``GenericType.Self.Bug69673_1.03``() = AssertCtrlSpaceCompleteContains ["type Base(o:obj) = class end" @@ -2971,7 +2898,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["this"] [] - [] + [] member public this.``GenericType.Self.Bug69673_1.04``() = AssertAutoCompleteContains ["type Base(o:obj) = class end" @@ -2984,8 +2911,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["Bar"] [] - [] - [] + [] member public this.``GenericType.Self.Bug69673_2.1``() = AssertAutoCompleteContains ["type Base(o:obj) = class end" @@ -2999,8 +2925,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["this"] [] - [] - [] + [] member public this.``GenericType.Self.Bug69673_2.2``() = AssertAutoCompleteContains ["type Base(o:obj) = class end" @@ -3014,7 +2939,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["this"] [] - [] + [] member public this.``UnitMeasure.Bug78932_1``() = AssertAutoCompleteContains [ @" @@ -3027,7 +2952,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Kg" ] // should contain [ ] // should not contain - [] + [] member public this.``UnitMeasure.Bug78932_2``() = // Note: in this case, pressing '.' does not automatically pop up a completion list in VS, but ctrl-space does get the right list // This is just like how @@ -3044,7 +2969,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Kg" ] // should contain [ ] // should not contain - [] + [] member public this.``Array.AfterOperator...Bug65732_A``() = AssertAutoCompleteContains [ "let r = [1 .. System.Int32.MaxValue]" ] @@ -3052,7 +2977,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Int32" ] // should contain [ "abs" ] // should not contain (from top level) - [] + [] member public this.``Array.AfterOperator...Bug65732_B``() = AssertCtrlSpaceCompleteContains [ "let r = [System.Int32.MaxValue..42]" ] @@ -3060,7 +2985,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "abs" ] // should contain (top level) [ "CompareTo" ] // should not contain (from Int32) - [] + [] member public this.``Array.AfterOperator...Bug65732_B2``() = AssertCtrlSpaceCompleteContains [ "let r = [System.Int32.MaxValue.. 42]" ] @@ -3068,7 +2993,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "abs" ] // should contain (top level) [ "CompareTo" ] // should not contain (from Int32) - [] + [] member public this.``Array.AfterOperator...Bug65732_B3``() = AssertCtrlSpaceCompleteContains [ "let r = [System.Int32.MaxValue .. 42]" ] @@ -3076,7 +3001,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "abs" ] // should contain (top level) [ "CompareTo" ] // should not contain (from Int32) - [] + [] member public this.``Array.AfterOperator...Bug65732_C``() = AssertCtrlSpaceCompleteContains [ "let r = [System.Int32.MaxValue..]" ] @@ -3084,7 +3009,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "abs" ] // should contain (top level) [ "CompareTo" ] // should not contain (from Int32) - [] + [] member public this.``Array.AfterOperator...Bug65732_D``() = AssertCtrlSpaceCompleteContains [ "let r = [System.Int32.MaxValue .. ]" ] @@ -3094,7 +3019,7 @@ let x = query { for bbbb in abbbbc(*D0*) do // Verify the auto completion after the close-parentheses, // there should be auto completion - [] + [] member public this.``Array.AfterParentheses.Bug175360``() = AssertAutoCompleteContainsNoCoffeeBreak [ "let a = 10." @@ -3103,7 +3028,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "ToDecimal" ] // should contain (top level) [ ] // should not contain - [] + [] member public this.``Identifier.FuzzyDefined.Bug67133``() = AssertAutoCompleteContainsNoCoffeeBreak [ "let gDateTime (arr: System.DateTime[]) =" @@ -3112,7 +3037,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["AddDays"] [] - [] + [] member public this.``Identifier.FuzzyDefined.Bug67133.Negative``() = let code = [ "let gDateTime (arr: DateTime[]) =" // Note: no 'open System', so DateTime is unknown " arr.[0]." ] @@ -3124,7 +3049,7 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertCompListContainsExactly(completions, []) // we don't want any completions on . when has unknown type due to errors // (In particular, we don't want the "didn't find any completions, so just show top-level entities like 'abs' here" logic to kick in.) - [] + [] member public this.``Class.Property.Bug69150_A``() = AssertCtrlSpaceCompleteContains [ "type ClassType(x : int) =" @@ -3134,7 +3059,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Value" ] // should contain [ "CompareTo" ] // should not contain (from Int32) - [] + [] member public this.``Class.Property.Bug69150_B``() = AssertCtrlSpaceCompleteContains [ "type ClassType(x : int) =" @@ -3144,7 +3069,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Value" ] // should contain [ "CompareTo" ] // should not contain (from Int32) - [] + [] member public this.``Class.Property.Bug69150_C``() = AssertCtrlSpaceCompleteContains [ "type ClassType(x : int) =" @@ -3155,7 +3080,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Value" ] // should contain [ "CompareTo" ] // should not contain (from Int32) - [] + [] member public this.``Class.Property.Bug69150_D``() = AssertCtrlSpaceCompleteContains [ "type ClassType(x : int) =" @@ -3165,7 +3090,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Value" ] // should contain [ "VolatileFieldAttribute" ] // should not contain (from top-level) - [] + [] member public this.``Class.Property.Bug69150_E``() = AssertCtrlSpaceCompleteContains [ "type ClassType(x : int) =" @@ -3175,7 +3100,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Value" ] // should contain [ "VolatileFieldAttribute" ] // should not contain (from top-level) - [] + [] member public this.``AssignmentToProperty.Bug231283``() = AssertCtrlSpaceCompleteContains [""" @@ -3190,7 +3115,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "AbstractClassAttribute" ] // top-level completions [ "Bar" ] // not stuff from the lhs of assignment - [] + [] member public this.``Dot.AfterOperator.Bug69159``() = AssertAutoCompleteContains [ "let x1 = [|0..1..10|]." ] @@ -3198,7 +3123,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Length" ] // should contain (array) [ "abs" ] // should not contain (top-level) - [] + [] member public this.``Residues1``() = AssertCtrlSpaceCompleteContains [ "System . Int32 . M" ] @@ -3206,7 +3131,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "MaxValue"; "MinValue" ] // should contain [ "MailboxProcessor"; "Map" ] // should not contain (top-level) - [] + [] member public this.``Residues2``() = AssertCtrlSpaceCompleteContains [ "let x = 42" @@ -3215,7 +3140,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "CompareTo" ] // should contain (Int32) [ "CLIEventAttribute"; "Checked"; "Choice" ] // should not contain (top-level) - [] + [] member public this.``Residues3``() = AssertCtrlSpaceCompleteContains [ "let x = 42" @@ -3224,7 +3149,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "CompareTo" ] // should contain (Int32) [ "CLIEventAttribute"; "Checked"; "Choice" ] // should not contain (top-level) - [] + [] member public this.``Residues4``() = AssertCtrlSpaceCompleteContains [ "let x = 42" @@ -3233,7 +3158,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "CompareTo" ] // should contain (Int32) [ "CLIEventAttribute"; "Checked"; "Choice" ] // should not contain (top-level) - [] + [] member public this.``CtrlSpaceInWhiteSpace.Bug133112``() = AssertCtrlSpaceCompleteContains [ """ @@ -3246,7 +3171,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "AbstractClassAttribute" ] // should contain (top-level) [ "A"; "B" ] // should not contain (Foo) - [] + [] member public this.``Residues5``() = AssertCtrlSpaceCompleteContains [ "let x = 42" @@ -3254,7 +3179,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ". " // marker [ "CompareTo" ] // should contain (Int32) [ "CLIEventAttribute"; "Checked"; "Choice" ] // should not contain (top-level) - [] + [] member public this.``CompletionInDifferentEnvs1``() = AssertCtrlSpaceCompleteContains ["let f1 num =" @@ -3265,7 +3190,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["completeword"] // should contain [""] - [] + [] member public this.``CompletionInDifferentEnvs2``() = AssertCtrlSpaceCompleteContains ["let aaa = 1" @@ -3276,7 +3201,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["aaa"; "aab"] ["aac"] - [] + [] member public this.``CompletionInDifferentEnvs3``() = AssertCtrlSpaceCompleteContains ["let mb1 = new MailboxProcessor>(fun inbox -> async { let! msg = inbox.Receive()" @@ -3285,7 +3210,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["msg"] [] - [] + [] member public this.``CompletionInDifferentEnvs4``() = AssertCtrlSpaceCompleteContains ["async {" @@ -3305,7 +3230,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["b"] ["i"] - [] + [] member public this.``CompletionForAndBang_BaseLine0``() = AssertCtrlSpaceCompleteContains ["type Builder() =" @@ -3320,7 +3245,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["xxx3"] [] - [] + [] member public this.``CompletionForAndBang_BaseLine1``() = AssertCtrlSpaceCompleteContains ["type Builder() =" @@ -3337,7 +3262,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["xxx1"; "xxx2"; "xxx3"] [] - [] + [] member public this.``CompletionForAndBang_BaseLine2``() = /// Without closing '}' AssertCtrlSpaceCompleteContains @@ -3354,7 +3279,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["yyy1"; "yyy2"; "yyy3"] [] - [] + [] member public this.``CompletionForAndBang_BaseLine3``() = /// Without closing ')' AssertCtrlSpaceCompleteContains @@ -3371,7 +3296,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["zzz1"; "zzz2"; "zzz3"] [] - [] + [] member public this.``CompletionForAndBang_BaseLine4``() = AssertCtrlSpaceCompleteContains ["type Builder() =" @@ -3386,7 +3311,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["zzz1"; "zzz3"] [] - [] + [] member public this.``CompletionForAndBang_Test_MergeSources_Bind_Return0``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3404,7 +3329,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["xxx3"; "xxx4"] [] - [] + [] member public this.``CompletionForAndBang_Test_MergeSources_Bind_Return1``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3424,7 +3349,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["xxx1"; "xxx2"; "xxx3"; "xxx4"] [] - [] + [] member public this.``CompletionForAndBang_Test_MergeSources_Bind_Return2``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3443,7 +3368,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["yyy1"; "yyy2"; "yyy3"; "yyy4"] [] - [] + [] member public this.``CompletionForAndBang_Test_MergeSources_Bind_Return3``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3462,7 +3387,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["zzz1"; "zzz2"; "zzz3"; "zzz4"] [] - [] + [] member public this.``CompletionForAndBang_Test_MergeSources_Bind_Return4``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3480,7 +3405,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["zzz1"; "zzz3"; "zzz4"] [] - [] + [] member public this.``CompletionForAndBang_Test_Bind2Return0``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3496,7 +3421,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["xxx3"; "xxx4"] [] - [] + [] member public this.``CompletionForAndBang_Test_Bind2Return1``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3514,7 +3439,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["xxx1"; "xxx2"; "xxx3"; "xxx4"] [] - [] + [] member public this.``CompletionForAndBang_Test_Bind2Return2``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3531,7 +3456,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["yyy1"; "yyy2"; "yyy3"; "yyy4"] [] - [] + [] member public this.``CompletionForAndBang_Test_Bind2Return3``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3548,7 +3473,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["zzz1"; "zzz2"; "zzz3"; "zzz4"] [] - [] + [] member public this.``CompletionForAndBang_Test_Bind2Return4``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3565,7 +3490,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [] (**) - [] + [] member public this.``Bug229433.AfterMismatchedParensCauseWeirdParseTreeAndExceptionDuringTypecheck``() = AssertAutoCompleteContains [ """ type T() = @@ -3588,7 +3513,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Bar"; "X" ] [] - [] + [] member public this.``Bug130733.LongIdSet.CtrlSpace``() = AssertCtrlSpaceCompleteContains [ """ type C() = @@ -3600,7 +3525,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "XX" ] [] - [] + [] member public this.``Bug130733.LongIdSet.Dot``() = AssertAutoCompleteContains [ """ type C() = @@ -3612,7 +3537,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "XX" ] [] - [] + [] member public this.``Bug130733.ExprDotSet.CtrlSpace``() = AssertCtrlSpaceCompleteContains [ """ type C() = @@ -3624,7 +3549,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "XX" ] [] - [] + [] member public this.``Bug130733.ExprDotSet.Dot``() = AssertAutoCompleteContains [ """ type C() = @@ -3637,7 +3562,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [] - [] + [] member public this.``Bug130733.Nested.LongIdSet.CtrlSpace``() = AssertCtrlSpaceCompleteContains [ """ type C() = @@ -3650,7 +3575,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "XX" ] [] - [] + [] member public this.``Bug130733.Nested.LongIdSet.Dot``() = AssertAutoCompleteContains [ """ type C() = @@ -3663,7 +3588,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "XX" ] [] - [] + [] member public this.``Bug130733.Nested.ExprDotSet.CtrlSpace``() = AssertCtrlSpaceCompleteContains [ """ type C() = @@ -3676,7 +3601,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "XX" ] [] - [] + [] member public this.``Bug130733.Nested.ExprDotSet.Dot``() = AssertAutoCompleteContains [ """ type C() = @@ -3689,7 +3614,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "XX" ] [] - [] + [] member public this.``Bug130733.NamedIndexedPropertyGet.Dot``() = AssertAutoCompleteContains [ """ let str = "foo" @@ -3698,7 +3623,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "CompareTo" ] // char [] - [] + [] member public this.``Bug130733.NamedIndexedPropertyGet.CtrlSpace``() = AssertCtrlSpaceCompleteContains [ """ let str = "foo" @@ -3707,7 +3632,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "CompareTo" ] // char [] - [] + [] member public this.``Bug230533.NamedIndexedPropertySet.CtrlSpace.Case1``() = AssertCtrlSpaceCompleteContains [ """ type Foo() = @@ -3721,7 +3646,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "MutableInstanceIndexer" ] [] - [] + [] member public this.``Bug230533.NamedIndexedPropertySet.CtrlSpace.Case2``() = AssertCtrlSpaceCompleteContains [ """ type Foo() = @@ -3737,7 +3662,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "MutableInstanceIndexer" ] [] - [] + [] member public this.``Bug230533.ExprDotSet.CtrlSpace.Case1``() = AssertCtrlSpaceCompleteContains [ """ type C() = @@ -3750,7 +3675,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "XX" ] [] - [] + [] member public this.``Bug230533.ExprDotSet.CtrlSpace.Case2``() = AssertCtrlSpaceCompleteContains [ """ type C() = @@ -3763,21 +3688,21 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "XX" ] [] - [] + [] member public this.``Attribute.WhenAttachedToLet.Bug70080``() = this.AutoCompleteBug70080Helper @" open System [] + [] member public this.``Attribute.WhenAttachedToType.Bug70080``() = this.AutoCompleteBug70080Helper(@" open System [] + [] member public this.``Attribute.WhenAttachedToLetInNamespace.Bug70080``() = this.AutoCompleteBug70080Helper @" namespace Foo @@ -3785,7 +3710,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [] + [] member public this.``Attribute.WhenAttachedToTypeInNamespace.Bug70080``() = this.AutoCompleteBug70080Helper(@" namespace Foo @@ -3793,7 +3718,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [] + [] member public this.``Attribute.WhenAttachedToNothingInNamespace.Bug70080``() = this.AutoCompleteBug70080Helper(@" namespace Foo @@ -3801,7 +3726,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [] + [] member public this.``Attribute.WhenAttachedToModuleInNamespace.Bug70080``() = this.AutoCompleteBug70080Helper(@" namespace Foo @@ -3810,7 +3735,7 @@ let x = query { for bbbb in abbbbc(*D0*) do module Foo = let x = 42") - [] + [] member public this.``Attribute.WhenAttachedToModule.Bug70080``() = this.AutoCompleteBug70080Helper(@" open System @@ -3818,7 +3743,7 @@ let x = query { for bbbb in abbbbc(*D0*) do module Foo = let x = 42") - [] + [] member public this.``Identifer.InMatchStatement.Bug72595``() = // in this bug, "match blah with let" caused the lexfilter to go awry, which made things hopeless for the parser, yielding no parse tree and thus no intellisense AssertAutoCompleteContains @@ -3842,7 +3767,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Chars" ] // should contain [ ] // should not contain - [] + [] member public this.``HandleInlineComments1``() = AssertAutoCompleteContains [ "let rrr = System (* boo! *) . Int32 . MaxValue" ] @@ -3850,7 +3775,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Int32"] [ "abs" ] // should not contain (top-level) - [] + [] member public this.``HandleInlineComments2``() = AssertAutoCompleteContains [ "let rrr = System (* boo! *) . Int32 . MaxValue" ] @@ -3858,7 +3783,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "MaxValue" ] // should contain [ "abs" ] // should not contain (top-level) - [] + [] member public this.``OpenNamespaceOrModule.CompletionOnlyContainsNamespaceOrModule.Case1``() = AssertAutoCompleteContains [ "open System." ] @@ -3866,7 +3791,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Collections" ] // should contain (namespace) [ ] // should not contain - [] + [] member public this.``OpenNamespaceOrModule.CompletionOnlyContainsNamespaceOrModule.Case2``() = AssertAutoCompleteContains [ "open Microsoft.FSharp.Collections.Array." ] @@ -3874,7 +3799,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Parallel" ] // should contain (module) [ "map" ] // should not contain (let-bound value) - [] + [] member public this.``BY_DESIGN.CommonScenarioThatBegsTheQuestion.Bug73940``() = AssertAutoCompleteContains [ @" @@ -3887,7 +3812,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ ] // should contain (ideally would be string) [ "Chars" ] // should not contain (documenting the undesirable behavior, that this does not show up) - [] + [] member public this.``BY_DESIGN.ExplicitlyCloseTheParens.Bug73940``() = AssertAutoCompleteContains [ @" @@ -3903,7 +3828,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Chars" ] // should contain (string) [ ] // should not contain - [] + [] member public this.``BY_DESIGN.MismatchedParenthesesAreHardToRecoverFromAndHereIsWhy.Bug73940``() = AssertAutoCompleteContains [ @" @@ -3920,7 +3845,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Chars" ] // should not contain (string) (* - [] + [] member public this.``AutoComplete.Bug72596_A``() = AssertAutoCompleteContains [ "type ClassType() =" @@ -3930,7 +3855,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "foo" ] // should not contain - [] + [] member public this.``AutoComplete.Bug72596_B``() = AssertAutoCompleteContains [ "let f() =" @@ -3940,7 +3865,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "foo" ] // should not contain *) - [] + [] member public this.``Expression.MultiLine.Bug66705``() = AssertAutoCompleteContains [ "let x = 4" @@ -3950,7 +3875,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "ToString" ] // should contain [ ] // should not contain - [] + [] member public this.``Expressions.Computation``() = AssertAutoCompleteContains [ @@ -3962,7 +3887,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Next" ] // should contain [ "GetEnumerator" ] // should not contain - [] + [] member public this.``Identifier.DefineByVal.InFsiFile.Bug882304_1``() = AutoCompleteInInterfaceFileContains [ @@ -3974,7 +3899,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ ] // should contain [ "Equals" ] // should not contain - [] + [] member public this.``NameSpace.InFsiFile.Bug882304_2``() = AutoCompleteInInterfaceFileContains [ @@ -3989,7 +3914,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ] // should contain [ ] // should not contain - [] + [] member public this.``CLIEvents.DefinedInAssemblies.Bug787438``() = AssertAutoCompleteContains [ "let mb = new MailboxProcessor(fun _ -> ())" @@ -3998,7 +3923,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Error" ] // should contain [ "add_Error"; "remove_Error" ] // should not contain - [] + [] member public this.CLIEventsWithByRefArgs() = AssertAutoCompleteContains [ "type MyDelegate = delegate of obj * string byref -> unit" @@ -4009,7 +3934,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "add_myEvent"; "remove_myEvent" ] // should contain [ "myEvent" ] // should not contain - [] + [] member public this.``Identifier.AfterParenthesis.Bug835276``() = AssertAutoCompleteContains [ "let f ( s : string ) =" @@ -4021,7 +3946,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Length" ] // should contain [ ] // should not contain - [] + [] member public this.``Identifier.AfterParenthesis.Bug6484_1``() = AssertAutoCompleteContains [ "for x in 1..10 do" @@ -4030,7 +3955,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "CompareTo" ] // should contain (a method on the 'int' type) [ ] // should not contain - [] + [] member public this.``Identifier.AfterParenthesis.Bug6484_2``() = AssertAutoCompleteContains [ "for x = 1 to 10 do" @@ -4039,7 +3964,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "CompareTo" ] // should contain (a method on the 'int' type) [ ] // should not contain - [] + [] member public this.``Type.Indexers.Bug4898_1``() = AssertAutoCompleteContains [ @@ -4052,7 +3977,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "ToString" ] // should contain [ "Value" ] // should not contain - [] + [] member public this.``Type.Indexers.Bug4898_2``() = AssertAutoCompleteContains [ @@ -4070,7 +3995,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "ToString" ] // should contain [ "Chars" ] // should not contain - [] + [] member public this.``Expressions.Sequence``() = AssertAutoCompleteContains [ @@ -4079,7 +4004,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "GetEnumerator" ] // should contain [ ] // should not contain - [] + [] member public this.``LambdaExpression.WithoutClosing.Bug1346``() = AssertAutoCompleteContains [ @@ -4093,7 +4018,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Length" ] // should contain [ ] // should not contain - [] + [] member public this.``LambdaExpression.WithoutClosing.Bug1346c``() = AssertAutoCompleteContains [ @@ -4107,7 +4032,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Length" ] // should contain [ ] // should not contain - [] + [] member public this.``LambdaExpression.WithoutClosing.Bug1346b``() = AssertAutoCompleteContains [ @@ -4122,7 +4047,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Length" ] // should contain [ ] // should not contain - [] + [] member public this.``IncompleteStatement.If_A``() = AssertAutoCompleteContains [ @@ -4132,7 +4057,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Contains" ] // should contain [ ] // should not contain - [] + [] member public this.``IncompleteStatement.If_C``() = AssertAutoCompleteContains [ @@ -4143,7 +4068,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Contains" ] // should contain [ ] // should not contain - [] + [] member public this.``IncompleteStatement.Try_A``() = AssertAutoCompleteContains [ @@ -4153,7 +4078,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Contains" ] // should contain [ ] // should not contain - [] + [] member public this.``IncompleteStatement.Try_B``() = AssertAutoCompleteContains [ @@ -4163,7 +4088,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Contains" ] // should contain [ ] // should not contain - [] + [] member public this.``IncompleteStatement.Try_C``() = AssertAutoCompleteContains [ @@ -4173,7 +4098,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Contains" ] // should contain [ ] // should not contain - [] + [] member public this.``IncompleteStatement.Try_D``() = AssertAutoCompleteContains [ @@ -4184,7 +4109,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Contains" ] // should contain [ ] // should not contain - [] + [] member public this.``IncompleteStatement.Match_A``() = AssertAutoCompleteContains [ @@ -4194,7 +4119,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Contains" ] // should contain [ ] // should not contain - [] + [] member public this.``IncompleteStatement.Match_C``() = AssertAutoCompleteContains [ @@ -4205,7 +4130,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Contains" ] // should contain [ ] // should not contain - [] + [] member public this.``IncompleteIfClause.Bug4594``() = AssertCtrlSpaceCompleteContains [ "let Bar(xyz) ="; @@ -4219,7 +4144,7 @@ let x = query { for bbbb in abbbbc(*D0*) do (* dot completions on them *) // Obsolete and CompilerMessage(IsError=true) should not appear. - [] + [] member public this.``ObsoleteAndOCamlCompatDontAppear``() = let code= [ @@ -4287,28 +4212,28 @@ let x = query { for bbbb in abbbbc(*D0*) do // When the module isn't empty, we should show completion for the module // (and not type-inference based completion on strings - therefore test for 'Chars') - [] + [] member public this.``Obsolete.TopLevelModule``() = this.AutoCompleteObsoleteTest "level <- O" false [ "None" ] [ "ObsoleteTop"; "Chars" ] - [] + [] member public this.``Obsolete.NestedTypeOrModule``() = this.AutoCompleteObsoleteTest "level <- Module" true [ "Other" ] [ "ObsoleteM"; "ObsoleteT"; "Chars" ] - [] + [] member public this.``Obsolete.CompletionOnObsoleteModule.Bug3992``() = this.AutoCompleteObsoleteTest "level <- Module.ObsoleteM" true [ "A" ] [ "ObsoleteNested"; "Chars" ] - [] + [] member public this.``Obsolete.DoubleNested``() = this.AutoCompleteObsoleteTest "level <- Module.ObsoleteM.ObsoleteNested" true [ "C" ] [ "Chars" ] - [] + [] member public this.``Obsolete.CompletionOnObsoleteType``() = this.AutoCompleteObsoleteTest "level <- Module.ObsoleteT" true [ "B" ] [ "Chars" ] /// BUG: Referencing a nonexistent DLL caused an assert. - [] + [] member public this.``WithNonExistentDll``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -4365,7 +4290,7 @@ let x = query { for bbbb in abbbbc(*D0*) do // This is some tag in the tooltip that also contains the overload name text if descr.Contains("[Signature:") then occurrences - 1 else occurrences - [] + [] member public this.``Duplicates.Bug4103b``() = for args in [ "Test.", "foo", "foo"; @@ -4378,7 +4303,7 @@ let x = query { for bbbb in abbbbc(*D0*) do "TestType.", "Event", "TestType.Event" ] do this.AutoCompleteDuplicatesTest args - [] + [] member public this.``Duplicates.Bug4103c``() = let code = [ @@ -4394,7 +4319,7 @@ let x = query { for bbbb in abbbbc(*D0*) do let occurrences = this.CountMethodOccurrences(descrFunc(), "File.Open") AssertEqualWithMessage(3, occurrences, "Found wrong number of overloads for 'File.Open'.") - [] + [] member public this.``Duplicates.Bug2094``() = let code = [ @@ -4409,7 +4334,7 @@ let x = query { for bbbb in abbbbc(*D0*) do let occurrences = this.CountMethodOccurrences(descrFunc(), "Start") AssertEqualWithMessage(2, occurrences, sprintf "Found wrong number of overloads for 'MailboxProcessor.Start'. Found %A." completions) - [] + [] member public this.``WithinMatchClause.Bug1603``() = let code = [ @@ -4424,11 +4349,11 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"let y = xx.") let completions = AutoCompleteAtCursor file // Should contain something - Assert.AreNotEqual(0,completions.Length) - Assert.IsTrue(completions |> Array.exists (fun (CompletionItem(name,_,_,_,_)) -> name.Contains("AddMilliseconds"))) + Assert.NotEqual(0,completions.Length) + Assert.True(completions |> Array.exists (fun (CompletionItem(name,_,_,_,_)) -> name.Contains("AddMilliseconds"))) // FEATURE: Saving file N does not cause files 1 to N-1 to re-typecheck (but does cause files N to to - [] + [] member public this.``Performance.Bug5774``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -4462,8 +4387,7 @@ let x = query { for bbbb in abbbbc(*D0*) do gpatcc.AssertExactly(notAA[file2], notAA[file2;file3]) /// FEATURE: References added to the project bring corresponding new .NET and F# items into scope. - [] - [] + [] member public this.``AfterAssemblyReferenceAdded``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -4476,18 +4400,17 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"System.Deployment.Application.") let completions = AutoCompleteAtCursor(file) // printf "Completions=%A\n" completions - Assert.AreEqual(0, completions.Length) // Expect none here because reference hasn't been added. + Assert.Equal(0, completions.Length) // Expect none here because reference hasn't been added. // Now, add a reference to the given assembly. this.AddAssemblyReference(project,"System.Deployment") TakeCoffeeBreak(this.VS) let completions = AutoCompleteAtCursor(file) - Assert.AreNotEqual(0, completions.Length, "Expected some items in the list after adding a reference.") + Assert.NotEqual(0, completions.Length) /// FEATURE: Updating the active project configuration influences the language service - [] - [] + [] member public this.``AfterUpdateProjectConfiguration``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -4505,17 +4428,16 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"System.Deployment.Application.") let completions = AutoCompleteAtCursor(file) // printf "Completions=%A\n" completions - Assert.AreEqual(0, completions.Length) // Expect none here because reference hasn't been added. + Assert.Equal(0, completions.Length) // Expect none here because reference hasn't been added. // Now, update active configuration SetConfigurationAndPlatform(project, "Foo|x86") TakeCoffeeBreak(this.VS) let completions = AutoCompleteAtCursor(file) - Assert.AreNotEqual(0, completions.Length, "Expected some items in the list after updating configuration.") + Assert.NotEqual(0, completions.Length) /// FEATURE: Updating the active project platform influences the language service - [] - [] + [] member public this.``AfterUpdateProjectPlatform``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -4534,16 +4456,16 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"System.Deployment.Application.") let completions = AutoCompleteAtCursor(file) // printf "Completions=%A\n" completions - Assert.AreEqual(0, completions.Length) // Expect none here because reference hasn't been added. + Assert.Equal(0, completions.Length) // Expect none here because reference hasn't been added. // Now, update active platform SetConfigurationAndPlatform(project, "Debug|x86") let completions = AutoCompleteAtCursor(file) - Assert.AreNotEqual(0, completions.Length, "Expected some items in the list after updating platform.") + Assert.NotEqual(0, completions.Length) (* /// FEATURE: The fileName on disk and the fileName in the project can differ in case. - [] + [] member this.``Filenames.MayBeDifferentlyCased``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -4556,16 +4478,16 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"System.Deployment.Application.") let completions = AutoCompleteAtCursor(file) // printf "Completions=%A\n" completions - Assert.AreEqual(0, completions.Length) // Expect none here because reference hasn't been added. + Assert.Equal(0, completions.Length) // Expect none here because reference hasn't been added. // Now, add a reference to the given assembly. this.AddAssemblyReference(project,"System.Deployment") let completions = AutoCompleteAtCursor(file) - Assert.AreNotEqual(0, completions.Length, "Expected some items in the list after adding a reference.") + Assert.NotEqual(0, completions.Length, "Expected some items in the list after adding a reference.") *) /// In this bug, a bogus flag caused the rest of flag parsing to be ignored. - [] + [] member public this.``FlagsAndSettings.Bug1969``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -4580,30 +4502,29 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"System.Deployment.Application.") let completions = AutoCompleteAtCursor(file) // printf "Completions=%A\n" completions - Assert.AreEqual(0, completions.Length) // Expect none here because reference hasn't been added. + Assert.Equal(0, completions.Length) // Expect none here because reference hasn't been added. // Add an unknown flag followed by the reference to our assembly. let deploymentAssembly = sprintf @"%s\Microsoft.NET\Framework\v4.0.30319\System.Deployment.dll" (System.Environment.GetEnvironmentVariable("windir")) SetOtherFlags(project,"--doo-da -r:" + deploymentAssembly) let completions = AutoCompleteAtCursor(file) // Now, make sure the reference added after the erroneous reference is still honored. - Assert.AreNotEqual(0, completions.Length, "Expected some items in the list after adding a reference.") + Assert.NotEqual(0, completions.Length) ShowErrors(project) /// In this bug there was an exception if the user pressed dot after a long identifier /// that was unknown. - [] - [] + [] member public this.``OfSystemWindows``() = let code = ["let y=new System.Windows."] let (_, _, file) = this.CreateSingleFileProject(code, references = ["System.Windows.Forms"]) MoveCursorToEndOfMarker(file,"System.Windows.") let completions = AutoCompleteAtCursor(file) printfn "Completions=%A" completions - Assert.AreEqual(3, completions.Length) + Assert.Equal(3, completions.Length) /// Tests whether we're correctly showing both type and module when they have the same name - [] + [] member public this.``ShowSetAsModuleAndType``() = let code = ["let s = Set"] let (_, _, file) = this.CreateSingleFileProject(code) @@ -4619,16 +4540,16 @@ let x = query { for bbbb in abbbbc(*D0*) do Assert.Fail("'Set' not found in the completion list") /// FEATURE: The user may type namespace followed by dot and see a completion list containing members of that namespace. - [] + [] member public this.``AtNamespaceDot``() = let code = ["let y=new System.String()"] let (_, _, file) = this.CreateSingleFileProject(code) MoveCursorToEndOfMarker(file,"System.") let completions = AutoCompleteAtCursor(file) - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) /// FEATURE: The user will see appropriate glyphs in the autocompletion list. - [] + [] member public this.``OfSeveralModuleMembers``() = let code = [ @@ -4670,7 +4591,7 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file," Module.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) for completion in completions do match completion with | CompletionItem("A",_,_,_,DeclarationType.EnumMember) -> () @@ -4700,7 +4621,7 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"AbbreviationModule.") let completions = time1 AutoCompleteAtCursor file "Time of second autocomplete." // printf "Completions=%A\n" completions - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) for completion in completions do match completion with | CompletionItem("Int32",_,_,_,_) @@ -4722,7 +4643,7 @@ let x = query { for bbbb in abbbbc(*D0*) do | CompletionItem("TupleTypeAbbreviation",_,_,_,_) -> () | CompletionItem(name,_,_,_,x) -> failwith (sprintf "Unexpected union member %s seen with declaration type %A" name x) - [] + [] member public this.ListFunctions() = let code = [ @@ -4733,7 +4654,7 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"List.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." // printf "Completions=%A\n" completions - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) for completion in completions do match completion with | CompletionItem("Cons",_,_,_,DeclarationType.Method) -> () @@ -4743,7 +4664,7 @@ let x = query { for bbbb in abbbbc(*D0*) do | CompletionItem(_,_,_,_,DeclarationType.Method) -> () | CompletionItem(name,_,_,_,x) -> failwith (sprintf "Unexpected item %s seen with declaration type %A" name x) - [] + [] member public this.``SystemNamespace``() = let code = [ @@ -4753,7 +4674,7 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"System.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." // printf "Completions=%A\n" completions - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) let AssertIsDecl(name,decl,expected) = if decl<>expected then failwith (sprintf "Expected %A for %s but was %A" expected name decl) @@ -4765,7 +4686,7 @@ let x = query { for bbbb in abbbbc(*D0*) do | _ -> () // If there is a compile error that prevents a data tip from resolving then show that data tip. - [] + [] member public this.``MemberInfoCompileErrorsShowInDataTip``() = let code = [ @@ -4779,7 +4700,7 @@ let x = query { for bbbb in abbbbc(*D0*) do use scope = AutoCompleteMemberDataTipsThrowsScope(this.VS, "Simulated compiler error") let completions = time1 CtrlSpaceCompleteAtCursor file "Time of first autocomplete." - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) for completion in completions do let (CompletionItem(_,_,_,descfunc,_)) = completion let desc = descfunc() @@ -4787,7 +4708,7 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertContains(desc,"Simulated compiler error") // Bunch of crud in empty list. This test asserts that unwanted things don't exist at the top level. - [] + [] member public this.``Editor.WithoutContext.Bug986``() = let code = ["(*mark*)"] let (_,_, file) = this.CreateSingleFileProject(code) @@ -4800,17 +4721,17 @@ let x = query { for bbbb in abbbbc(*D0*) do | CompletionItem("ICorRuntimeHost" as s,_,_,_,_) -> failwith (sprintf "Unexpected item %s at top level." s) | _ -> () - [] + [] member public this.``LetBind.TopLevel.Bug1650``() = let code =["let x = "] let (_,_, file) = this.CreateSingleFileProject(code) let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) MoveCursorToEndOfMarker(file,"let x = ") let completions = time1 CtrlSpaceCompleteAtCursor file "Time of first autocomplete." - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) gpatcc.AssertExactly(0,0) - [] + [] member public this.``Identifier.Invalid.Bug876b``() = let code = [ @@ -4822,9 +4743,9 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"x.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." ShowErrors(project) - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) - [] + [] member public this.``Identifier.Invalid.Bug876c``() = let code = [ @@ -4834,9 +4755,9 @@ let x = query { for bbbb in abbbbc(*D0*) do let (_,_, file) = this.CreateSingleFileProject(code, references = ["System"; "System.Drawing"; "System.Windows.Forms"]) MoveCursorToEndOfMarker(file,"x.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) - [] + [] member public this.``EnumValue.Bug2449``() = let code = [ @@ -4849,7 +4770,7 @@ let x = query { for bbbb in abbbbc(*D0*) do let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." AssertCompListDoesNotContain(completions, "value__") - [] + [] member public this.``EnumValue.Bug4044``() = let code = [ @@ -4866,7 +4787,7 @@ let x = query { for bbbb in abbbbc(*D0*) do /// There was a bug (2584) that IntelliSense should treat 'int' as a type instead of treating it as a function /// However, this is now deprecated behavior. We want the user to use 'System.Int32' and /// we generally prefer information from name resolution (also see 4405) - [] + [] member public this.``PrimTypeAndFunc``() = let code = [ @@ -4883,7 +4804,7 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertCompListDoesNotContain(completions,"MinValue") /// This is related to Bug1605--since the file couldn't parse there was no information to provide the autocompletion list. - [] + [] member public this.``MatchStatement.Clause.AfterLetBinds.Bug1603``() = let code = [ @@ -4898,7 +4819,7 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"xs -> f xs.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." // printf "Completions=%A\n" completions - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) let mutable count = 0 @@ -4915,10 +4836,10 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertIsDecl(name,decl,DeclarationType.Property) | CompletionItem(name,_,_,_,x) -> () - Assert.AreEqual(2,count) + Assert.Equal(2,count) // This was a bug in which the third level of dotting was ignored. - [] + [] member public this.``ThirdLevelOfDotting``() = let code = [ @@ -4928,7 +4849,7 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"Console.Wr") let completions = time1 CtrlSpaceCompleteAtCursor file "Time of first autocomplete." // printf "Completions=%A\n" completions - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) let AssertIsDecl(name,decl,expected) = if decl<>expected then failwith (sprintf "Expected %A for %s but was %A" expected name decl) @@ -4940,7 +4861,7 @@ let x = query { for bbbb in abbbbc(*D0*) do | CompletionItem(name,_,_,_,x) -> () // Test completions in an incomplete computation expression (case 1: for "let") - [] + [] member public this.``ComputationExpressionLet``() = let code = [ @@ -4953,7 +4874,7 @@ let x = query { for bbbb in abbbbc(*D0*) do let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." AssertCompListContainsAll(completions, ["Next"]) - [] + [] member public this.``BestMatch.Bug4320a``() = let code = [ " let x = System." ] let (_, _, file) = this.CreateSingleFileProject(code) @@ -4975,7 +4896,7 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertEqual(Some ("GCCollectionMode", true, true), Match "GCC" (Some "GC")) AssertEqual(Some ("GCCollectionMode", false, false), Match "GCCZ" (Some "GC")) - [] + [] member public this.``BestMatch.Bug4320b``() = let code = [ " let x = List." ] let (_, _, file) = this.CreateSingleFileProject(code) @@ -4987,7 +4908,7 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertEqual(Some ("empty", false, true), Match "e") AssertEqual(Some ("empty", true, true), Match "em") - [] + [] member public this.``BestMatch.Bug5131``() = let code = [ "System.Environment." ] let (_, _, file) = this.CreateSingleFileProject(code) @@ -4998,7 +4919,7 @@ let x = query { for bbbb in abbbbc(*D0*) do // isPrefix=true means it will be selected, instead of just outlined AssertEqual(Some ("OSVersion", true, true), Match "o") - [] + [] member public this.``COMPILED.DefineNotPropagatedToIncrementalBuilder``() = use _guard = this.UsingNewVS() @@ -5026,10 +4947,10 @@ let x = query { for bbbb in abbbbc(*D0*) do let completionItems = AutoCompleteAtCursor(file) |> Array.map (fun (CompletionItem(name, _, _, _, _)) -> name) - Assert.AreEqual(1, completionItems.Length, "Expected 1 item in the list") - Assert.AreEqual("x", completionItems.[0], "Expected 'x' in the list") + Assert.Equal(1, completionItems.Length) + Assert.Equal("x", completionItems.[0]) - [] + [] member public this.``VisualStudio.CloseAndReopenSolution``() = use _guard = this.UsingNewVS() // This test exposes what was once a bug, where closing a solution and then re-opening @@ -5048,17 +4969,16 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"x.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." // printf "Completions=%A\n" completions - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) this.CloseSolution(solution) let project,solution = OpenExistingProject(this.VS, dir, projName) let file = List.item 0 (GetOpenFiles(project)) MoveCursorToEndOfMarker(file,"x.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." // printf "Completions=%A\n" completions - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) - [] - [] + [] member this.``BadCompletionAfterQuicklyTyping.Bug72561``() = let code = [ " " ] let (_, _, file) = this.CreateSingleFileProject(code) @@ -5079,8 +4999,7 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertCompListDoesNotContainAny(completions, ["AbstractClassAttribute"]) gpatcc.AssertExactly(0,0) - [] - [] + [] member this.``BadCompletionAfterQuicklyTyping.Bug72561.Noteworthy.NowWorks``() = let code = [ "123 " ] let (_, _, file) = this.CreateSingleFileProject(code) @@ -5102,8 +5021,7 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertCompListDoesNotContainAny(completions, ["AbstractClassAttribute"]) gpatcc.AssertExactly(0,0) - [] - [] + [] member this.``BadCompletionAfterQuicklyTyping.Bug130733.NowWorks``() = let code = [ "let someCall(x) = null" "let xe = someCall(System.IO.StringReader() "] @@ -5167,7 +5085,7 @@ let x = query { for bbbb in abbbbc(*D0*) do let completions = CtrlSpaceCompleteAtCursor(file) AssertEqual(0,completions.Length) - [] + [] member this.``Expression.WithoutPreDefinedMethods``() = this.VerifyCtrlSpaceListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -5175,7 +5093,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*HERE*)", list = ["FSharpDelegateEvent"; "PrivateMethod"; "PrivateType"]) - [] + [] member this.``Expression.WithPreDefinedMethods``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -5193,7 +5111,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["PrivateField"; "PrivateMethod"; "PrivateType"]) // Regression for bug 2116 -- Consider making selected item in completion list case-insensitive - [] + [] member this.``CaseInsensitive``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -5210,7 +5128,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*Marker1*)", list = ["Xyzzy"; "xYzzy"; "xyZzy"; "xyzZy"; "xyzzY"]) - [] + [] member this.``Attributes.CanSeeOpenNamespaces.Bug268290.Case1``() = AssertCtrlSpaceCompleteContains [""" @@ -5222,7 +5140,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["AttributeUsage"] [] - [] + [] member this.``Selection``() = AssertCtrlSpaceCompleteContains [""" @@ -5234,7 +5152,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [] // Regression test for 1653 -- Both the F# exception and the .NET exception representing it are shown in completion lists - [] + [] member this.``NoDupException.Postive``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -5242,7 +5160,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*MarkerException*)", list = ["MatchFailureException"]) - [] + [] member this.``DotNetException.Negative``() = this.VerifyCtrlSpaceListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -5251,7 +5169,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["MatchFailure"]) // Regression for bug 921 -- intellisense case-insensitive? - [] + [] member this.``CaseInsensitive.MapMethod``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -5261,8 +5179,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["map"]) //Regression for bug 69644 69654 Fsharp: no completion for an identifier when 'use'd inside an 'async' block - [] - [] + [] member this.``InAsyncAndUseBlock``() = this.VerifyCompListContainAllAtStartOfMarker( fileContents = """ @@ -5281,7 +5198,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*Marker1*)", list = ["reader"]) - [] + [] member this.``WithoutOpenNamespace``() = AssertCtrlSpaceCompleteContains [""" @@ -5293,7 +5210,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [] // should ["Single"] // should not - [] + [] member this.``PrivateVisible``() = AssertCtrlSpaceCompleteContains [""" @@ -5315,7 +5232,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["fieldPrivate";"MethodPrivate";"TypePrivate"] [] - [] + [] member this.``InternalVisible``() = AssertCtrlSpaceCompleteContains [""" @@ -5336,8 +5253,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["fieldInternal";"MethodInternal";"TypeInternal"] // should [] // should not - [] - [] + [] // Verify that we display the correct list of Unit of Measure (Names) in the autocomplete window. // This also ensures that no UoM are accidentally added or removed. member public this.``UnitMeasure.UnitNames``() = @@ -5349,8 +5265,7 @@ let x = query { for bbbb in abbbbc(*D0*) do "ohm"; "pascal"; "second"; "siemens"; "sievert"; "tesla"; "volt"; "watt"; "weber";] // should contain; exact match [ ] // should not contain - [] - [] + [] // Verify that we display the correct list of Unit of Measure (Symbols) in the autocomplete window. // This also ensures that no UoM are accidentally added or removed. member public this.``UnitMeasure.UnitSymbols``() = @@ -5371,9 +5286,7 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertCompListContainsAll(completions, contained) gpatcc.AssertExactly(0,0) - [] - [] - [] + [] // Custom operators appear in Intellisense list after entering a valid query operator // on the previous line and invoking Intellisense manually // Including in a nested query @@ -5391,9 +5304,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "do ma", contained = [ "maxBy"; "maxByNullable"; ]) - [] - [] - [] + [] // Custom operators appear in Intellisense list after entering a valid query operator // on the previous line and invoking Intellisense manually // Including in a nested query @@ -5409,7 +5320,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "gro", contained = [ "groupBy"; "groupJoin"; "groupValBy";]) - [] + [] member this.``Namespace.System``() = this.VerifyDotCompListContainAllAtEndOfMarker( fileContents = """ @@ -5422,7 +5333,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "open System", list = [ "IO"; "Collections" ]) - [] + [] member this.``Identifier.String.Positive``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5434,7 +5345,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*usage*)", list = ["Chars"; "ToString"; "Length"; "GetHashCode"]) - [] + [] member this.``Identifier.String.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -5448,7 +5359,7 @@ let x = query { for bbbb in abbbbc(*D0*) do // Verify add_* methods show up for non-standard events. These are events // where the associated delegate type does not return "void" - [] + [] member this.``Event.NonStandard.PrefixMethods``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """System.AppDomain.CurrentDomain(*usage*)""", @@ -5457,28 +5368,28 @@ let x = query { for bbbb in abbbbc(*D0*) do // Verify the events do show up. An error is generated when they are used asking the user to use add_* and remove_* instead. // That is, they are legitimate name resolutions but do not pass type checking. - [] + [] member this.``Event.NonStandard.VerifyLegitimateNameShowUp``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = "System.AppDomain.CurrentDomain(*usage*)", marker = "(*usage*)", list = ["AssemblyResolve"; "ReflectionOnlyAssemblyResolve"; "ResourceResolve"; "TypeResolve" ]) - [] + [] member this.``Array``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = "let arr = [| for i in 1..10 -> i |](*Mexparray*)", marker = "(*Mexparray*)", list = ["Clone"; "IsFixedSize"]) - [] + [] member this.``List``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = "let lst = [ for i in 1..10 -> i](*Mexplist*)", marker = "(*Mexplist*)", list = ["Head"; "Tail"]) - [] + [] member public this.``ExpressionDotting.Regression.Bug187799``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5490,7 +5401,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*marker*)", list = ["Clone"]) // should contain method on array (result of M call) - [] + [] member public this.``ExpressionDotting.Regression.Bug187799.Test2``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5505,7 +5416,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*marker*)", list = ["Clone"]) // should contain method on array (result of M call) - [] + [] member public this.``ExpressionDotting.Regression.Bug187799.Test3``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5520,7 +5431,7 @@ let x = query { for bbbb in abbbbc(*D0*) do - [] + [] member public this.``ExpressionDotting.Regression.Bug187799.Test4``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5533,7 +5444,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*marker*)", list = ["InterfaceMethods"]) - [] + [] member public this.``ExpressionDotting.Regression.Bug187799.Test5``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5545,7 +5456,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*marker*)", list = ["GetEnumerator"]) - [] + [] member public this.``ExpressionDotting.Regression.Bug187799.Test6``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5557,7 +5468,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*marker*)", list = ["AddHandler"]) - [] + [] member public this.``ExpressionDotting.Regression.Bug187799.Test7``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5569,7 +5480,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*marker*)", list = ["Assembly"]) - [] + [] member public this.``ExpressionDotting.Regression.Bug187799.Test8``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5582,7 +5493,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["CompareTo"]) - [] + [] member public this.``ExpressionDotting.Regression.Bug187799.Test9``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5594,11 +5505,8 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*marker*)", list = ["CompareTo"]) - [] - [] - [] // This test case checks that autocomplete on the provided Type DOES NOT show System.Object members - [] + [] member this.``TypeProvider.EditorHideMethodsAttribute.Type.DoesnotContain``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -5608,10 +5516,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["Equals";"GetHashCode"], addtlRefAssy = [PathRelativeToTestAssembly(@"EditorHideMethodsAttribute.dll")]) - [] - [] - [] - [] + [] // This test case checks if autocomplete on the provided Type shows only the Event1 elements member this.``TypeProvider.EditorHideMethodsAttribute.Type.Contains``() = this.VerifyDotCompListContainAllAtStartOfMarker( @@ -5622,10 +5527,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["Event1"], addtlRefAssy = [PathRelativeToTestAssembly(@"EditorHideMethodsAttribute.dll")]) - [] - [] - [] - [] + [] // This test case checks if autocomplete on the provided Type shows the instance method IM1 member this.``TypeProvider.EditorHideMethodsAttribute.InstanceMethod.Contains``() = this.VerifyDotCompListContainAllAtStartOfMarker( @@ -5636,9 +5538,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["IM1"], addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] + [] // This test case checks that nested types show up only statically and not on instances member this.``TypeProvider.TypeContainsNestedType``() = // should have it here @@ -5657,10 +5557,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["SomeNestedType"], addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] // This test case checks if autocomplete on the provided Event shows only the AddHandler/RemoveHandler elements member this.``TypeProvider.EditorHideMethodsAttribute.Event.Contain``() = this.VerifyDotCompListContainAllAtStartOfMarker( @@ -5671,9 +5568,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["AddHandler";"RemoveHandler"], addtlRefAssy = [PathRelativeToTestAssembly(@"EditorHideMethodsAttribute.dll")]) - [] - [] - [] + [] // This test case checks if autocomplete on the provided Method shows no elements // You can see this as a "negative case" (to check that the usage of the attribute on a method is harmless) member this.``TypeProvider.EditorHideMethodsAttribute.Method.Contain``() = @@ -5683,10 +5578,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*Marker*)", addtlRefAssy = [PathRelativeToTestAssembly(@"EditorHideMethodsAttribute.dll")]) - [] - [] - [] - [] + [] // This test case checks if autocomplete on the provided Property (the type of which is not synthetic) shows the usual elements... like GetType() // 1. I think it does not make sense to use this attribute on a synthetic property unless it's type is also synthetic (already covered) // 2. You can see this as a "negative case" (to check that the usage of the attribute is harmless) @@ -5698,7 +5590,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["GetType"; "Equals"], // just a couple of System.Object methods: we expect them to be there! addtlRefAssy = [PathRelativeToTestAssembly(@"EditorHideMethodsAttribute.dll")]) - [] + [] member this.CompListInDiffFileTypes() = let fileContents = """ val x:int = 1 @@ -5718,7 +5610,7 @@ let x = query { for bbbb in abbbbc(*D0*) do let completions = DotCompletionAtStartOfMarker file "(*MarkerInsideSourceFile*)" AssertCompListContainsAll(completions, ["CompareTo"; "Equals"]) - [] + [] member this.ConstrainedTypes() = let fileContents = """ type Pet() = @@ -5748,35 +5640,35 @@ let x = query { for bbbb in abbbbc(*D0*) do let completions = DotCompletionAtStartOfMarker file "(*Mconstrainedtoint*)" AssertCompListContainsAll(completions, ["ToString"]) - [] + [] member this.``Literal.Float``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = "let myfloat = (42.0)(*Mconstantfloat*)", marker = "(*Mconstantfloat*)", list = ["GetType"; "ToString"]) - [] + [] member this.``Literal.String``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """let name = "foo"(*Mconstantstring*)""", marker = "(*Mconstantstring*)", list = ["Chars"; "Clone"]) - [] + [] member this.``Literal.Int``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = "let typeint = (10)(*Mint*)", marker = "(*Mint*)", list = ["GetType";"ToString"]) - [] + [] member this.``Identifier.InLambdaExpression``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = "let funcLambdaExp = fun (x:int)-> x(*MarkerinLambdaExp*)", marker = "(*MarkerinLambdaExp*)", list = ["ToString"; "Equals"]) - [] + [] member this.``Identifier.InClass``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5785,7 +5677,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*MarkerLetBindinClass*)", list = ["ToString"; "Equals"]) - [] + [] member this.``Identifier.InNestedLetBind``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = " @@ -5796,7 +5688,7 @@ let funcNestedLetBinding (x:int) = marker = "(*MarkerNestedLetBind*)", list = ["ToString"; "Equals"]) - [] + [] member this.``Identifier.InModule``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = " @@ -5806,7 +5698,7 @@ module ModuleLetBindIn = marker = "(*MarkerLetBindinModule*)", list = ["ToString"; "Equals"]) - [] + [] member this.``Identifier.InMatchStatement``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = " @@ -5819,7 +5711,7 @@ match x(*MarkerMatchStatement*) with marker = "(*MarkerMatchStatement*)", list = ["ToString"; "Equals"]) - [] + [] member this.``Identifier.InMatchClause``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = " @@ -5834,7 +5726,7 @@ let rec f l = marker = "(*MarkerMatchClause*)", list = ["Add";"Date"]) - [] + [] member this.``Expression.ListItem``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5844,7 +5736,7 @@ let rec f l = marker = "(*MarkerListItem*)", list = ["CompareTo"; "ToString"]) - [] + [] member this.``Expression.FunctionParameter``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5854,7 +5746,7 @@ let rec f l = marker = "(*MarkerParameter*)", list = ["CompareTo"; "ToString"]) - [] + [] member this.``Expression.Function``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5864,7 +5756,7 @@ let rec f l = marker = "(*MarkerFunction*)", list = ["CompareTo"; "ToString"]) - [] + [] member this.``Expression.RecordPattern``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5876,7 +5768,7 @@ let rec f l = marker = "(*MarkerRecordPattern*)", list = ["Value"; "ToString"]) - [] + [] member this.``Expression.2DArray``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5886,7 +5778,7 @@ let rec f l = marker = "(*Marker2DArray*)", list = ["ToString"]) - [] + [] member this.``Expression.LetBind``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5897,7 +5789,7 @@ let rec f l = marker = "(*MarkerContext1*)", list = ["CompareTo";"ToString"]) - [] + [] member this.``Expression.WhileLoop``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5908,14 +5800,14 @@ let rec f l = marker = "(*MarkerContext3*)", list = ["CompareTo";"ToString"]) - [] + [] member this.``Expression.List``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """[1;2](*MarkerList*) """, marker = "(*MarkerList*)", list = ["Head"; "Item"]) - [] + [] member this.``Expression.Nested.InLetBind``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5926,7 +5818,7 @@ let rec f l = marker = "(*MarkerNested1*)", list = ["Chars";"Length"]) - [] + [] member this.``Expression.Nested.InWhileLoop``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5937,7 +5829,7 @@ let rec f l = marker = "(*MarkerNested2*)", list = ["Chars";"Length"]) - [] + [] member this.``Expression.ArrayItem.Positive``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5947,7 +5839,7 @@ let rec f l = marker = "(*MarkerArrayIndexer*)", list = ["Chars";"Split"]) - [] + [] member this.``Expression.ArrayItem.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -5957,7 +5849,7 @@ let rec f l = marker = "(*MarkerArrayIndexer*)", list = ["IsReadOnly";"Rank"]) - [] + [] member this.``ObjInstance.InheritedClass.MethodsDefInBase``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5972,7 +5864,7 @@ let rec f l = marker = "(*Mderived*)", list = ["Name"; "dog"]) - [] + [] member this.``ObjInstance.AnonymousClass.MethodsDefInInterface``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5993,7 +5885,7 @@ let rec f l = marker = "(*Mexpnewtype*)", list = ["DoStuff"; "DoStuff2"]) - [] + [] member this.``SimpleTypes.SystemTime``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6002,7 +5894,7 @@ let rec f l = marker = "(*Mstruct*)", list = ["AddDays"; "Date"]) - [] + [] member this.``SimpleTypes.Record``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6012,7 +5904,7 @@ let rec f l = marker = "(*Mrecord*)", list = ["DateOfBirth"; "Name"]) - [] + [] member this.``SimpleTypes.Enum``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6027,7 +5919,7 @@ let rec f l = marker = "(*Menum*)", list = ["GetType"; "ToString"]) - [] + [] member this.``SimpleTypes.DisUnion``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6043,7 +5935,7 @@ let rec f l = marker = "(*Mdiscriminatedunion*)", list = ["GetType"; "ToString"]) - [] + [] member this.``InheritedClass.BaseClassPrivateMethod.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -6069,7 +5961,7 @@ let rec f l = marker = "(*MUnShowPrivate*)", list = ["MethodPrivate";"fieldPrivate"]) - [] + [] member this.``InheritedClass.BaseClassPublicMethodAndProperty``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6095,14 +5987,14 @@ let rec f l = marker = "(*MShowPublic*)", list = ["MethodPublic";"fieldPublic"]) - [] + [] member this.``Visibility.InternalNestedClass.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """System.Console(*Marker1*)""", marker = "(*Marker1*)", list = ["ControlCDelegateData"]) - [] + [] member this.``Visibility.PrivateIdentifierInDiffModule.Negative``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6116,7 +6008,7 @@ let rec f l = Module1(*Marker1*) """, marker = "(*Marker1*)") - [] + [] member this.``Visibility.PrivateIdentifierInDiffClass.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -6133,7 +6025,7 @@ let rec f l = marker = "(*MarkerOutType*)", list = ["fieldPrivate";"MethodPrivate"]) - [] + [] member this.``Visibility.PrivateFieldInSameClass``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6150,7 +6042,7 @@ let rec f l = marker = "(*MarkerFieldInType*)", list = ["PrivateField"]) - [] + [] member this.``Visibility.PrivateMethodInSameClass``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6167,7 +6059,7 @@ let rec f l = marker = "(*MarkerMethodInType*)", list = ["PrivateMethod"]) -// [] +// [] member this.``VariableIdentifier.AsParameter``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6178,7 +6070,7 @@ let rec f l = marker = "(*Maftervariable1*)", list = ["Tag"]) - [] + [] member this.``VariableIdentifier.InMeasure.DefineInDiffNamespace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6202,7 +6094,7 @@ let rec f l = marker = "(*Maftervariable2*)", list = []) - [] + [] member this.``VariableIdentifier.MethodsInheritFromBase``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6221,7 +6113,7 @@ let rec f l = marker = "(*Maftervariable3*)", list = ["Name";"Speak"]) - [] + [] member this.``VariableIdentifier.AsParameter.DefineInDiffNamespace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6245,7 +6137,7 @@ let rec f l = marker = "(*Maftervariable4*)", list = ["DuType"]) - [] + [] member this.``VariableIdentifier.SystemNamespace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6269,7 +6161,7 @@ let rec f l = marker = "(*Maftervariable5*)", list = ["BinaryReader";"Stream";"Directory"]) - [] + [] member this.``LongIdent.AsAttribute``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6279,7 +6171,7 @@ let rec f l = marker = "(*Mattribute*)", list = ["Obsolete"]) - [] + [] member this.``ImportStatement.System.ImportDirectly``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6288,7 +6180,7 @@ let rec f l = marker = "(*Mimportstatement1*)", list = ["Collections"]) - [] + [] member this.``ImportStatement.System.ImportAsIdentifier``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6297,7 +6189,7 @@ let rec f l = marker = "(*Mimportstatement2*)", list = ["IO"]) - [] + [] member this.``LongIdent.PatternMatch.AsVariable.DefFromDiffNamespace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6317,7 +6209,7 @@ let rec f l = marker = "(*Mpatternmatch1*)", list = ["Direction";"ToString"]) - [] + [] member this.``LongIdent.PatternMatch.AsConstantValue.DefFromDiffNamespace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6337,7 +6229,7 @@ let rec f l = marker = "(*Mpatternmatch2*)", list = ["longident"]) - [] + [] member this.``LongIdent.PInvoke.AsReturnType``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6358,7 +6250,7 @@ let rec f l = marker = "(*Mpinvokereturntype*)", list = ["Boolean";"Int32"]) - [] + [] member this.``LongIdent.PInvoke.AsAttribute``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6379,7 +6271,7 @@ let rec f l = marker = "(*Mpinvokeattribute*)", list = ["SomeAttrib"]) - [] + [] member this.``LongIdent.PInvoke.AsParameterType``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6392,7 +6284,7 @@ let rec f l = marker = "(*Mpinvokeparametertype*)", list = ["Boolean";"Int32"]) - [] + [] member this.``LongIdent.Record.AsField``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6405,7 +6297,7 @@ let rec f l = marker = "(*Mrecord*)", list = ["person"]) - [] + [] member this.``LongIdent.DiscUnion.AsTypeParameter.DefInDiffNamespace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6426,7 +6318,7 @@ let rec f l = marker = "(*Mtypeparameter1*)", list = ["Dog";"DuType"]) - [] + [] member this.``LongIdent.AnonymousFunction.AsTypeParameter.DefFromDiffNamespace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6447,7 +6339,7 @@ let rec f l = marker = "(*Mtypeparameter2*)", list = ["Tag"]) - [] + [] member this.``LongIdent.UnitMeasure.AsTypeParameter.DefFromDiffNamespace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6468,7 +6360,7 @@ let rec f l = marker = "(*Mtypeparameter3*)", list = []) - [] + [] member this.``RedefinedIdentifier.DiffScope.InScope.Positive``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6480,7 +6372,7 @@ let rec f l = marker = "(*MarkerShowLastOneWhenInScope*)", list = ["DayOfWeek"]) - [] + [] member this.``RedefinedIdentifier.DiffScope.InScope.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -6492,7 +6384,7 @@ let rec f l = marker = "(*MarkerShowLastOneWhenInScope*)", list = ["Chars"]) - [] + [] member this.``RedefinedIdentifier.DiffScope.OutScope.Positive``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6504,7 +6396,7 @@ let rec f l = marker = "(*MarkerShowLastOneWhenOutscoped*)", list = ["Chars"]) - [] + [] member this.``ObjInstance.ExtensionMethods.WithoutDef.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -6514,7 +6406,7 @@ let rec f l = marker = "(*MWithoutReference*)", list = ["NextDice";"DiceValue"]) - [] + [] member this.``Class.DefInDiffNameSpace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6546,7 +6438,7 @@ let rec f l = marker = "(*MarkerType*)" , list = ["TestType"]) - [] + [] member this.``Class.DefInDiffNameSpace.WithAttributes.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -6578,7 +6470,7 @@ let rec f l = marker = "(*MarkerType*)", list = ["ObsoleteType";"CompilerMessageType"]) - [] + [] member this.``Method.DefInDiffNameSpace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6611,7 +6503,7 @@ let rec f l = marker = "(*MarkerMethod*)", list = ["TestMethod"; "VisibleMethod";"VisibleMethod2"]) - [] + [] member this.``Method.DefInDiffNameSpace.WithAttributes.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -6642,7 +6534,7 @@ let rec f l = marker = "(*MarkerMethod*)", list = ["ObsoleteMethod";"CompilerMessageMethod";"HiddenMethod"]) - [] + [] member this.``ObjInstance.ExtensionMethods.WithDef.Positive``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6657,7 +6549,7 @@ let rec f l = marker = "(*MWithReference*)", list = ["NextDice";"DiceValue"]) - [] + [] member this.``Keywords.If``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6665,13 +6557,13 @@ let rec f l = () """, marker ="(*MarkerKeywordIf*)") - [] + [] member this.``Keywords.Let``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """let(*MarkerKeywordLet*) a = 1""", marker = "(*MarkerKeywordLet*)") - [] + [] member this.``Keywords.Match``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6679,31 +6571,31 @@ let rec f l = | pattern -> exp""", marker = "(*MarkerKeywordMatch*)") - [] + [] member this.``MacroDirectives.nowarn``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """#nowarn(*MarkerPreProcessNowarn*)""", marker = "(*MarkerPreProcessNowarn*)") - [] + [] member this.``MacroDirectives.light``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """#light(*MarkerPreProcessLight*)""", marker = "(*MarkerPreProcessLight*)") - [] + [] member this.``MacroDirectives.define``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """#define(*MarkerPreProcessDefine*)""", marker = "(*MarkerPreProcessDefine*)") - [] + [] member this.``MacroDirectives.PreProcessDefine``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """#define Foo(*MarkerPreProcessDefineConst*)""", marker = "(*MarkerPreProcessDefineConst*)") - [] + [] member this.``Identifier.InClass.WithoutDef``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6711,7 +6603,7 @@ let rec f l = val mutable x(*MarkerValue*) : string""", marker = "(*MarkerValue*)") - [] + [] member this.``Identifier.InDiscUnion.WithoutDef``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6719,31 +6611,31 @@ let rec f l = |Tag(*MarkerDU*) of int""", marker = "(*MarkerDU*)") - [] + [] member this.``Identifier.InRecord.WithoutDef``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """type Rec = { X(*MarkerRec*) : int }""", marker = "(*MarkerRec*)") - [] + [] member this.``Identifier.AsNamespace``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """namespace Namespace1(*MarkerNamespace*)""", marker = "(*MarkerNamespace*)") - [] + [] member this.``Identifier.AsModule``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """module Module1(*MarkerModule*)""", marker = "(*MarkerModule*)") - [] + [] member this.``Identifier.WithoutDef``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ abcd(*MarkerUndefinedIdentifier*) """, marker = "(*MarkerUndefinedIdentifier*)") - [] + [] member this.``Identifier.InMatch.UnderScore``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6754,7 +6646,7 @@ let rec f l = |_(*MarkerIdentifierIsUnderScore*) -> 0 """, marker = "(*MarkerIdentifierIsUnderScore*)") - [] + [] member this.MemberSelf() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6762,7 +6654,7 @@ let rec f l = member this(*Mmemberself*)""", marker = "(*Mmemberself*)") - [] + [] member this.``Expression.InComment``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6770,14 +6662,14 @@ let rec f l = //open IO = System(*Mcomment*)""", marker = "(*Mcomment*)") - [] + [] member this.``Expression.InString``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """let x = "System.Console(*Minstring*)" """, marker = "(*Minstring*)") // Regression test for 1067 -- Completion lists don't work after generic arguments - for generic functions and for static members of generic types - [] + [] member this.``Regression1067.InstanceOfGenericType``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6800,7 +6692,7 @@ let rec f l = marker = "(*Marker2*)", list = ["P"; "Q"]) - [] + [] member this.``Regression1067.ClassUsingGenericTypeAsAttribute``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6823,7 +6715,7 @@ let rec f l = marker = "(*Marker4*)", list = ["Assembly"; "FullName"; "GUID"]) - [] + [] member this.NoInfiniteLoopInProperties() = let fileContents = """ open System.Windows.Forms @@ -6837,7 +6729,7 @@ let rec f l = AssertCompListDoesNotContainAny(completions, ["Nodes"]) // Regression for bug 3225 -- Invalid intellisense when inside of a quotation - [] + [] member this.``Regression3225.Identifier.InQuotation``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6847,7 +6739,7 @@ let rec f l = list = ["Chars"; "Length"]) // Regression for bug 1911 -- No completion list of expr in match statement - [] + [] member this.``Regression1911.Expression.InMatchStatement``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6860,8 +6752,7 @@ let rec f l = // Bug 3627 - Completion lists should be filtered in many contexts // This blocks six testcases and is slated for Dev11, so these will be disabled for some time. - [] - [] + [] member this.AfterTypeParameter() = let fileContents = """ type Type1 = Tag of string(*MarkerDUTypeParam*) @@ -6890,7 +6781,7 @@ let rec f l = let completions = DotCompletionAtStartOfMarker file "(*MarkerParamTypeof*)" AssertCompListIsEmpty(completions) - [] + [] member this.``Identifier.AsClassName.InInitial``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6898,33 +6789,32 @@ let rec f l = val field: int""", marker = "(*MarkerType*)") - [] + [] member this.``Identifier.AsFunctionName.InInitial``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """let f2(*MarkerFunctionIdentifier*) x = x+1 """, marker = "(*MarkerFunctionIdentifier*)") - [] + [] member this.``Identifier.AsParameter.InInitial``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ let f3 x(*MarkerParam*) = x+1""", marker = "(*MarkerParam*)") - [] + [] member this.``Identifier.AsFunctionName.UsingFunKeyword``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """fun f4(*MarkerFunctionDeclaration*) x -> x+1""", marker = "(*MarkerFunctionDeclaration*)") - [] + [] member public this.``Identifier.EqualityConstraint.Bug65730``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """let g3<'a when 'a : equality> (x:'a) = x(*Marker*)""", marker = "(*Marker*)", list = ["Equals"; "GetHashCode"]) // equality constraint should make these show up - [] - [] + [] member this.``Identifier.InFunctionMatch``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6933,7 +6823,7 @@ let rec f l = | 2 -> printfn "2" """, marker = "(*MarkerFunctionMatch*)") - [] + [] member this.``Identifier.This``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6941,7 +6831,7 @@ let rec f l = member this(*MarkerMemberThis*).Foo () = 3""", marker = "(*MarkerMemberThis*)") - [] + [] member this.``Identifier.AsProperty``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6949,7 +6839,7 @@ let rec f l = member this.Foo(*MarkerMemberThisProperty*) = 1""", marker = "(*MarkerMemberThisProperty*)") - [] + [] member this.``ExpressionPropertyAssignment.Bug217051``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6960,7 +6850,7 @@ let rec f l = marker = "(*Marker*)", list = ["Prop"]) - [] + [] member this.``ExpressionProperty.Bug234687``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6971,8 +6861,7 @@ let rec f l = marker = "(*Marker*)", list = ["CodeBase"]) // expect instance properties of Assembly, not static Assembly methods - [] - [] + [] member this.NotShowAttribute() = let fileContents = """ open System @@ -6995,8 +6884,7 @@ let rec f l = let completions = DotCompletionAtStartOfMarker file "(*Mattribute2*)" AssertCompListIsEmpty(completions) - [] - [] + [] member this.NotShowPInvokeSignature() = let fileContents = """ //open System @@ -7035,7 +6923,7 @@ let rec f l = let completions = DotCompletionAtStartOfMarker file "(*Mparameterlist*)" AssertCompListIsEmpty(completions) - [] + [] member this.``Basic.Completion.UnfinishedLet``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7046,8 +6934,7 @@ let rec f l = marker = "(*Marker*)", list = ["CompareTo"]) - [] - [] + [] member this.``ShortFormSeqExpr.Bug229610``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7061,7 +6948,7 @@ let rec f l = list = ["Value"]) //Regression test for bug 69159 Fsharp: dot completion is mission for an array - [] + [] member this.``Array.InitialUsing..``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """let x1 = [| 0.0 .. 0.1 .. 10.0 |](*Marker*)""", @@ -7069,8 +6956,7 @@ let rec f l = list = ["Length";"Clone";"ToString"]) //Regression test for bug 65740 Fsharp: dot completion is mission after a '#' statement - [] - [] + [] member this.``Identifier.In#Statement``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7086,7 +6972,7 @@ let rec f l = //This test is about CompletionList which should be moved to completionList, it's too special to refactor. //Regression test for bug 72595 typing quickly yields wrong intellisense - [] + [] member this.``BadCompletionAfterQuicklyTyping``() = let code = [ " " ] let (_, _, file) = this.CreateSingleFileProject(code) @@ -7105,7 +6991,7 @@ let rec f l = AssertCompListContainsAll(completions, ["Length"]) AssertCompListDoesNotContainAny(completions, ["AbstractClassAttribute"]) - [] + [] member this.``SelfParameter.InDoKeywordScope``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7115,7 +7001,7 @@ let rec f l = marker = "(*Marker*)", list = ["ToString"]) - [] + [] member this.``SelfParameter.InDoKeywordScope.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -7125,7 +7011,7 @@ let rec f l = marker = "(*Marker*)", list = ["Value";"Contents"]) - [] + [] member this.``ReOpenNameSpace.StaticProperties``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7141,7 +7027,7 @@ let rec f l = marker = "(*Marker1*)", list = ["Prop";"Event"]) - [] + [] member this.``ReOpenNameSpace.EnumTypes``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7158,7 +7044,7 @@ let rec f l = marker = "(*Marker2*)", list = ["Foo"]) - [] + [] member this.``ReOpenNameSpace.SystemLibrary``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7171,7 +7057,7 @@ let rec f l = marker = "(*Marker3*)", list = ["Open"]) - [] + [] member this.``ReOpenNameSpace.FsharpQuotation``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7183,7 +7069,7 @@ let rec f l = marker = "(*Marker4*)", list = ["Value"]) - [] + [] member this.``ReOpenNameSpace.MailboxProcessor``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7195,7 +7081,7 @@ let rec f l = marker = "(*Marker6*)", list = ["Start"]) - [] + [] member this.``ReopenNamespace.Module``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7209,7 +7095,7 @@ let rec f l = marker = "(*Marker7*)", list = ["foo"]) - [] + [] member this.``Expression.InLetScope``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7224,7 +7110,7 @@ let rec f l = marker = "(*Marker1*)", list = ["IsFixedSize";"Initialize"]) - [] + [] member this.``Expression.InFunScope.FirstParameter``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7238,7 +7124,7 @@ let rec f l = marker = "(*Marker2*)", list = ["CompareTo"]) - [] + [] member this.``Expression.InFunScope.SecParameter``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7253,7 +7139,7 @@ let rec f l = marker = "(*Marker3*)", list = ["GetType";"ToString"]) - [] + [] member this.``Expression.InMatchWhenClause``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7269,7 +7155,7 @@ let rec f l = list = ["CompareTo";"ToString"]) //Regression test for bug 3223 in PS: No intellisense at point - [] + [] member this.``Identifier.InActivePattern.Positive``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7288,7 +7174,7 @@ let rec f l = marker = "(*Marker*)", list = ["Attributes";"CallingConvention";"ContainsGenericParameters"]) - [] + [] member this.``Identifier.InActivePattern.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -7308,7 +7194,7 @@ let rec f l = list = ["Head";"ToInt"]) //Regression test of bug 2296:No completion lists on the direct results of a method call - [] + [] member this.``Regression2296.DirectResultsOfMethodCall``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7327,7 +7213,7 @@ let rec f l = marker = "(*Marker1*)", list = ["Attributes";"CallingConvention";"IsFamily"]) - [] + [] member this.``Regression2296.DirectResultsOfMethodCall.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -7346,7 +7232,7 @@ let rec f l = marker = "(*Marker1*)", list = ["value__"]) - [] + [] member this.``Regression2296.Identifier.String.Reflection01``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7369,7 +7255,7 @@ let rec f l = marker = "(*Marker2*)", list = ["CompareTo";"GetType";"ToString"]) - [] + [] member this.``Regression2296.Identifier.String.Reflection01.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -7392,7 +7278,7 @@ let rec f l = marker = "(*Marker2*)", list = ["value__"]) - [] + [] member this.``Regression2296.Identifier.String.Reflection02``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7416,7 +7302,7 @@ let rec f l = marker = "(*Marker3*)", list = ["CompareTo";"GetType";"ToString"]) - [] + [] member this.``Regression2296.Identifier.String.Reflection02.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -7437,7 +7323,7 @@ let rec f l = marker = "(*Marker3*)", list = ["value__"]) - [] + [] member this.``Regression2296.System.StaticMethod.Reflection``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7462,7 +7348,7 @@ let rec f l = marker = "(*Marker4*)", list = ["CompareTo";"GetType";"ToString"]) - [] + [] member this.``Regression2296.System.StaticMethod.Reflection.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -7487,7 +7373,7 @@ let rec f l = marker = "(*Marker4*)", list = ["value__"]) - [] + [] member this.``Seq.NearTheEndOfFile``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7501,8 +7387,7 @@ let rec f l = list = ["cache";"find"]) //Regression test of bug 3879: intellisense glitch for computation expression - [] - [] + [] member this.``ComputationExpression.WithClosingBrace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7520,8 +7405,7 @@ let rec f l = marker = "(*Marker*)", list = ["AsyncGetResponse";"GetResponseAsync";"ToString"]) - [] - [] + [] member this.``ComputationExpression.WithoutClosingBrace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7540,7 +7424,7 @@ let rec f l = list = ["AsyncGetResponse";"GetResponseAsync";"ToString"]) //Regression Test of 4405:intellisense has wrong type for identifier, using most recently bound of same name rather than the one in scope? - [] + [] member this.``Regression4405.Identifier.ReBound``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7552,14 +7436,14 @@ let rec f l = list = ["Chars";"StartsWith"]) //Regression test for FSharp1.0:4702 - [] + [] member this.``Regression4702.SystemWord``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = "System(*Marker*)", marker = "(*Marker*)", list = ["Console";"Byte";"ArgumentException"]) - [] + [] member this.``TypeAbbreviation.Positive``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7569,7 +7453,7 @@ let rec f l = marker = "(*Marker1*)", list = ["int16";"int32";"int64"]) - [] + [] member this.``TypeAbbreviation.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -7580,7 +7464,7 @@ let rec f l = list = ["Int16";"Int32";"Int64"]) //Regression test of bug 3754:tupe forwarder bug? intellisense bug? - [] + [] member this.``Regression3754.TypeOfListForward.Positive``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7604,7 +7488,7 @@ let rec f l = marker = "(*Marker*)", list = ["append";"choose";"isEmpty"]) - [] + [] member this.``Regression3754.TypeOfListForward.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -7628,8 +7512,7 @@ let rec f l = marker = "Marker", list = [""]) - [] - [] + [] member this.``NonApplicableExtensionMembersDoNotAppear.Bug40379``() = let code = [ "open System.Xml.Linq" @@ -7657,7 +7540,7 @@ let rec f l = let completions = AutoCompleteAtCursor file AssertCompListContainsAll(completions, ["Ancestors"; "AncestorsAndSelf"]) - [] + [] member this.``Visibility.InternalMethods.DefInSameAssembly``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7677,8 +7560,7 @@ let rec f l = marker = "(*MarkerSameAssemb*)", list = ["fieldInternal";"MethodInternal"]) - [] - [] + [] member this.``QueryExpression.DotCompletionSmokeTest1``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7689,8 +7571,7 @@ let rec f l = list = ["Chars";"Length"], addtlRefAssy=standard40AssemblyRefs) - [] - [] + [] member this.``QueryExpression.DotCompletionSmokeTest2``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7700,8 +7581,7 @@ let rec f l = list = ["Chars"; "Length"], addtlRefAssy=standard40AssemblyRefs ) - [] - [] + [] member this.``QueryExpression.DotCompletionSmokeTest0``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7712,8 +7592,7 @@ let rec f l = addtlRefAssy=standard40AssemblyRefs ) - [] - [] + [] member this.``QueryExpression.DotCompletionSmokeTest3``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7724,8 +7603,7 @@ let rec f l = addtlRefAssy=standard40AssemblyRefs ) - [] - [] + [] member this.``QueryExpression.DotCompletionSystematic1``() = for customOperation in ["select";"sortBy";"where"] do let fileContentsList = @@ -7783,8 +7661,7 @@ let rec f l = list = ["Chars";"Length"], addtlRefAssy=standard40AssemblyRefs) - [] - [] + [] member public this.``QueryExpression.InsideJoin.Bug204147``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7842,9 +7719,7 @@ let rec f l = let completions = DotCompletionAtStartOfMarker file2 marker AssertCompListContainsAll(completions, list) - [] - [] - [] + [] // Intellisense still appears on arguments when the operator is used in error member public this.``Query.HasErrors.Bug196230``() = this.AssertDotCompletionListInQuery( @@ -7862,10 +7737,8 @@ let rec f l = marker = "(*Marker*)", list = ["ProductID";"ProductName"] ) - [] - [] // Intellisense still appears on arguments when the operator is used in error - [] + [] member public this.``Query.HasErrors2``() = this.AssertDotCompletionListInQuery( fileContents = """ @@ -7879,9 +7752,7 @@ let rec f l = marker = "(*Marker*)", list = ["ProductID";"ProductName"] ) - [] - [] - [] + [] // Shadowed variables have correct Intellisense member public this.``Query.ShadowedVariables``() = this.AssertDotCompletionListInQuery( @@ -7897,9 +7768,7 @@ let rec f l = marker = "(*Marker*)", list = ["Category";"ProductName"] ) - [] - [] - [] + [] // Intellisense works correctly in a nested query member public this.``Query.InNestedQuery``() = let fileContents = """ @@ -7917,9 +7786,7 @@ let rec f l = this.VerifyDotCompListContainAllAtStartOfMarker(fileContents, "(*Marker2*)", ["Equals";"CompareTo"], queryAssemblyRefs ) - [] - [] - [] + [] // Intellisense works correctly in a nested expression within a lamda member public this.``Query.NestedExpressionWithinLamda``() = let fileContents = """ @@ -7935,7 +7802,7 @@ let rec f l = this.VerifyDotCompListContainAllAtStartOfMarker(fileContents, "(*Marker*)", ["Chars";"Length"], queryAssemblyRefs ) - [] + [] member this.``Verify no completion on dot after module definition``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -7945,7 +7812,7 @@ let rec f l = let bar = 1""", marker = "(*Marker*)") - [] + [] member this.``Verify no completion after module definition``() = this.VerifyCtrlSpaceCompListIsEmptyAtEndOfMarker( fileContents = """ @@ -7955,7 +7822,7 @@ let rec f l = let bar = 1""", marker = "module BasicTest ") - [] + [] member this.``Verify no completion in hash directives``() = this.VerifyCtrlSpaceCompListIsEmptyAtEndOfMarker( fileContents = """ @@ -7965,7 +7832,7 @@ let rec f l = let bar = 1""", marker = "(*Marker*)") - [] + [] member public this.``ExpressionDotting.Regression.Bug3709``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -7975,7 +7842,6 @@ let rec f l = list = ["EndsWith"]) // Context project system -[] type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs index 51a8e3f0856..b5cc13f4501 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs @@ -4,7 +4,7 @@ namespace Tests.LanguageService.ErrorList open System open System.IO -open NUnit.Framework +open Xunit open Microsoft.VisualStudio.FSharp open Salsa.Salsa open Salsa.VsOpsUtils @@ -13,14 +13,6 @@ open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem -[] -type public AssemblyResolverTestFixture () = - - [] - member public _.Init () = AssemblyResolver.addResolver () - -[] -[] type UsingMSBuild() as this = inherit LanguageServiceBaseTests() @@ -55,7 +47,7 @@ type UsingMSBuild() as this = let assertContains (errors : list) text = let ok = errors |> List.exists (fun err -> err.Message = text) - Assert.IsTrue(ok, sprintf "Error list should contain '%s' message" text) + Assert.True(ok, sprintf "Error list should contain '%s' message" text) let assertExpectedErrorMessages expected (actual: list) = let normalizeCR input = System.Text.RegularExpressions.Regex.Replace(input, @"\r\n|\n\r|\n|\r", "\r\n") @@ -66,14 +58,7 @@ type UsingMSBuild() as this = |> normalizeCR let expected = expected |> String.concat Environment.NewLine |> normalizeCR - let message = - sprintf """ -=[ expected ]============ -%s -=[ actual ]============== -%s -=========================""" expected actual - Assert.AreEqual(expected, actual, message) + Assert.Equal(expected, actual) //verify the error list Count member private this.VerifyErrorListCountAtOpenProject(fileContents : string, num : int) = @@ -99,7 +84,7 @@ type UsingMSBuild() as this = TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. let warnList = GetWarnings(project) - Assert.AreEqual(expectedNum,warnList.Length) + Assert.Equal(expectedNum,warnList.Length) //verify no the error list member private this.VerifyNoErrorListAtOpenProject(fileContents : string, ?addtlRefAssy : string list) = @@ -110,7 +95,7 @@ type UsingMSBuild() as this = for error in errorList do printfn "%A" error.Severity printf "%s\n" (error.ToString()) - Assert.IsTrue(errorList.IsEmpty) + Assert.True(errorList.IsEmpty) //Verify the error list contained the expected string member private this.VerifyErrorListContainedExpectedString(fileContents : string, expectedStr : string, ?addtlRefAssy : string list) = @@ -132,8 +117,7 @@ type UsingMSBuild() as this = else failwithf "The error list number is not the expected %d" num - [] - [] + [] member public this.``OverloadsAndExtensionMethodsForGenericTypes``() = let fileContent = """ @@ -153,13 +137,13 @@ let g (t : T) = t.Count() this.VerifyNoErrorListAtOpenProject(fileContent) - [] + [] member public this.``ErrorsInScriptFile``() = let (solution, project, file) = this.CreateSingleFileProject("", fileKind = SourceFileKind.FSX) let checkErrors expected = let l = List.length (GetErrors project) - Assert.AreEqual(expected, l, "Unexpected number of errors in error list") + Assert.Equal(expected, l) TakeCoffeeBreak(this.VS) checkErrors 0 @@ -179,8 +163,7 @@ let g (t : T) = t.Count() TakeCoffeeBreak(this.VS) checkErrors 0 - [] - [] + [] member public this.``LineDirective``() = use _guard = this.UsingNewVS() let fileContents = """ @@ -193,12 +176,12 @@ let g (t : T) = t.Count() let file = OpenFile(project, "File1.fs") let _ = OpenFile(project,"File2.fs") - Assert.IsFalse(Build(project).BuildSucceeded) + Assert.False(Build(project).BuildSucceeded) this.VerifyCountAtSpecifiedFile(project,1) VerifyErrorListContainedExpectedStr("The value or constructor 'y' is not defined",project) - [] + [] member public this.``InvalidConstructorOverload``() = let content = """ type X private() = @@ -213,8 +196,7 @@ let g (t : T) = t.Count() CheckErrorList content (assertExpectedErrorMessages expectedMessages) - [] - [] + [] member public this.``Query.InvalidJoinRelation.GroupJoin``() = let content = """ let x = query { @@ -226,12 +208,11 @@ let x = query { fun errors -> match errors with | [err] -> - Assert.AreEqual("Invalid join relation in 'groupJoin'. Expected 'expr expr', where is =, =?, ?= or ?=?.", err.Message) + Assert.Equal("Invalid join relation in 'groupJoin'. Expected 'expr expr', where is =, =?, ?= or ?=?.", err.Message) | errs -> Assert.Fail("Unexpected content of error list") - [] - [] + [] member public this.``Query.NonOpenedNullableModule.Join``() = let content = """ let t = @@ -244,12 +225,11 @@ let t = fun errors -> match errors with | [err] -> - Assert.AreEqual("The operator '?=?' cannot be resolved. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'.", err.Message) + Assert.Equal("The operator '?=?' cannot be resolved. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'.", err.Message) | errs -> Assert.Fail("Unexpected content of error list") - [] - [] + [] member public this.``Query.NonOpenedNullableModule.GroupJoin``() = let content = """ let t = @@ -262,13 +242,12 @@ let t = fun errors -> match errors with | [err] -> - Assert.AreEqual("The operator '?=?' cannot be resolved. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'.", err.Message) + Assert.Equal("The operator '?=?' cannot be resolved. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'.", err.Message) | errs -> Assert.Fail("Unexpected content of error list") - [] - [] + [] member public this.``Query.InvalidJoinRelation.Join``() = let content = """ let x = @@ -282,11 +261,11 @@ let x = fun errors -> match errors with | [err] -> - Assert.AreEqual("Invalid join relation in 'join'. Expected 'expr expr', where is =, =?, ?= or ?=?.", err.Message) + Assert.Equal("Invalid join relation in 'join'. Expected 'expr expr', where is =, =?, ?= or ?=?.", err.Message) | errs -> Assert.Fail("Unexpected content of error list") - [] + [] member public this.``InvalidMethodOverload``() = let content = """ System.Console.WriteLine(null) @@ -294,7 +273,7 @@ let x = let expectedMessages = [ "A unique overload for method 'WriteLine' could not be determined based on type information prior to this program point. A type annotation may be needed.\u001d\u001dKnown type of argument: 'a0 when 'a0: null\u001d\u001dCandidates:\u001d - System.Console.WriteLine(buffer: char array) : unit\u001d - System.Console.WriteLine(format: string, [] arg: obj array) : unit\u001d - System.Console.WriteLine(value: obj) : unit\u001d - System.Console.WriteLine(value: string) : unit" ] CheckErrorList content (assertExpectedErrorMessages expectedMessages) - [] + [] member public this.``InvalidMethodOverload2``() = let content = """ type A<'T>() = @@ -309,7 +288,7 @@ b.Do(1, 1) let expectedMessages = [ "A unique overload for method 'Do' could not be determined based on type information prior to this program point. A type annotation may be needed.\u001d\u001dKnown types of arguments: int * int\u001d\u001dCandidates:\u001d - member A.Do: a: int * b: 'T -> unit\u001d - member A.Do: a: int * b: int -> unit" ] CheckErrorList content (assertExpectedErrorMessages expectedMessages) - [] + [] member public this.``NoErrorInErrList``() = use _guard = this.UsingNewVS() let fileContents1 = """ @@ -343,7 +322,7 @@ b.Do(1, 1) TakeCoffeeBreak(this.VS) this.VerifyCountAtSpecifiedFile(project,0) - [] + [] member public this.``NoLevel4Warning``() = use _guard = this.UsingNewVS() let fileContents = """ @@ -361,14 +340,14 @@ b.Do(1, 1) this.VerifyCountAtSpecifiedFile(project,0) - [] + [] //This is an verify action test & example member public this.``TestErrorMessage``() = let fileContent = """Console.WriteLine("test")""" let expectedStr = "The value, namespace, type or module 'Console' is not defined" this.VerifyErrorListContainedExpectedString(fileContent,expectedStr) - [] + [] member public this.``TestWrongKeywordInInterfaceImplementation``() = let fileContent = """ @@ -382,14 +361,11 @@ type staticInInterface = CheckErrorList fileContent (function | err1 :: _ -> - Assert.IsTrue(err1.Message.Contains("No static abstract member was found that corresponds to this override")) + Assert.True(err1.Message.Contains("No static abstract member was found that corresponds to this override")) | x -> Assert.Fail(sprintf "Unexpected errors: %A" x)) - [] - [] - [] - [] + [] member public this.``TypeProvider.MultipleErrors`` () = let tpRef = PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll") let checkList n = @@ -402,57 +378,51 @@ type staticInInterface = for err in errorList do printfn "Severity: %A, Message: %s" err.Severity err.Message - Assert.IsTrue(List.length errorList = n, "Unexpected size of error list") + Assert.True(List.length errorList = n, "Unexpected size of error list") let uniqueErrors = errorList |> Seq.map (fun m -> m.Message, m.Severity) |> set - Assert.IsTrue(uniqueErrors.Count = n, "List should not contain duplicate errors") + Assert.True(uniqueErrors.Count = n, "List should not contain duplicate errors") for x = 0 to (n - 1) do let expectedName = sprintf "The type provider 'DummyProviderForLanguageServiceTesting.TypeProviderThatThrowsErrors' reported an error: Error %d" x - Assert.IsTrue(Set.contains (expectedName, Microsoft.VisualStudio.FSharp.LanguageService.Severity.Error) uniqueErrors) + Assert.True(Set.contains (expectedName, Microsoft.VisualStudio.FSharp.LanguageService.Severity.Error) uniqueErrors) for i = 1 to 10 do checkList i - [] - [] + [] member public this.``Records.ErrorList.IncorrectBindings1``() = for code in [ "{_}"; "{_ = }"] do printfn "checking %s" code CheckErrorList code <| fun errs -> printfn "%A" errs - Assert.IsTrue((List.length errs) = 2) + Assert.True((List.length errs) = 2) assertContains errs "Field bindings must have the form 'id = expr;'" assertContains errs "'_' cannot be used as field name" - [] - [] + [] member public this.``Records.ErrorList.IncorrectBindings2``() = CheckErrorList "{_ = 1}" <| function - | [err] -> Assert.AreEqual("'_' cannot be used as field name", err.Message) + | [err] -> Assert.Equal("'_' cannot be used as field name", err.Message) | x -> printfn "%A" x; Assert.Fail("unexpected content of error list") - [] - [] + [] member public this.``Records.ErrorList.IncorrectBindings3``() = CheckErrorList "{a = 1; _; _ = 1}" <| fun errs -> - Assert.IsTrue((List.length errs) = 3) + Assert.True((List.length errs) = 3) let groupedErrs = errs |> Seq.groupBy (fun e -> e.Message) |> Seq.toList - Assert.IsTrue((List.length groupedErrs) = 2) + Assert.True((List.length groupedErrs) = 2) for (msg, e) in groupedErrs do - if msg = "'_' cannot be used as field name" then Assert.AreEqual(2, Seq.length e) - elif msg = "Field bindings must have the form 'id = expr;'" then Assert.AreEqual(1, Seq.length e) + if msg = "'_' cannot be used as field name" then Assert.Equal(2, Seq.length e) + elif msg = "Field bindings must have the form 'id = expr;'" then Assert.Equal(1, Seq.length e) else Assert.Fail (sprintf "Unexpected message %s" msg) - [] - [] - [] - [] + [] //This test case Verify the Error List shows the correct error message when the static parameter type is invalid //Intent: We want to make sure that both errors coming from the TP and the compilation of things specific to type provider are properly flagged in the error list. member public this.``TypeProvider.StaticParameters.IncorrectType `` () = @@ -463,10 +433,7 @@ type staticInInterface = this.VerifyErrorListContainedExpectedString(fileContent,expectedStr, addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test case Verify the Error List shows the correct error message when applying invalid static parameter to the provided type member public this.``TypeProvider.StaticParameters.Incorrect `` () = @@ -477,10 +444,7 @@ type staticInInterface = this.VerifyErrorListContainedExpectedString(fileContent,expectedStr, addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test case Verify that Error List shows the correct error message when Type Provider that takes two static parameter is given only one static parameter. member public this.``TypeProvider.StaticParameters.IncorrectNumberOfParameter `` () = @@ -491,9 +455,7 @@ type staticInInterface = this.VerifyErrorListContainedExpectedString(fileContent,expectedStr, addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] + [] member public this.``TypeProvider.ProhibitedMethods`` () = let cases = [ @@ -509,9 +471,7 @@ type staticInInterface = addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")] ) - [] - [] - [] + [] //This test case verify that the Error list count is one in the Error list item when given invalid static parameter that raises an error. member public this.``TypeProvider.StaticParameters.ErrorListItem `` () = @@ -520,10 +480,7 @@ type staticInInterface = type foo = N1.T< const "Hello World",2>""", num = 1) - [] - [] - [] - [] + [] //This test case Verify that there is No Error list count in the Error list item when the file content is correct. member public this.``TypeProvider.StaticParameters.NoErrorListCount `` () = @@ -533,7 +490,7 @@ type staticInInterface = addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] + [] member public this.``NoError.FlagsAndSettings.TargetOptionsRespected``() = let fileContent = """ [] @@ -544,10 +501,9 @@ type staticInInterface = TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. let errorList = GetErrors(project) - Assert.IsTrue(errorList.IsEmpty) + Assert.True(errorList.IsEmpty) - [] - [] + [] member public this.``UnicodeCharacters``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -558,12 +514,12 @@ type staticInInterface = let file = OpenFile(project,"新規baProgram.fsi") let file = OpenFile(project,"新規bcrogram.fs") - Assert.IsFalse(Build(project).BuildSucceeded) - Assert.IsTrue(GetErrors(project) + Assert.False(Build(project).BuildSucceeded) + Assert.True(GetErrors(project) |> List.exists(fun error -> (error.ToString().Contains("新規baProgram")))) // In this bug, particular warns were still present after nowarn - [] + [] member public this.``NoWarn.Bug5424``() = let fileContent = """ #nowarn "67" // this type test or downcast will always hold @@ -576,7 +532,7 @@ type staticInInterface = this.VerifyNoErrorListAtOpenProject(fileContent) /// FEATURE: Errors in flags are sent in Error list. - [] + [] member public this.``FlagsAndSettings.ErrorsInFlagsDisplayed``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -587,7 +543,7 @@ type staticInInterface = TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. VerifyErrorListContainedExpectedStr("nonexistent",project) - [] + [] member public this.``BackgroundComplier``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ @@ -614,7 +570,7 @@ type staticInInterface = """, num = 2) - [] + [] member public this.``CompilerErrorsInErrList1``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ @@ -624,7 +580,7 @@ type staticInInterface = let a = NoVal""", num = 1 ) - // [] disabled for F#8, legacy service, covered in FCS tests instead + // [] disabled for F#8, legacy service, covered in FCS tests instead member public this.``CompilerErrorsInErrList4``() = this.VerifyNoErrorListAtOpenProject( fileContents = """ @@ -644,7 +600,7 @@ type staticInInterface = let _fsyacc_gotos = [| 0us; 1us; 2us|] """ ) - [] + [] member public this.``CompilerErrorsInErrList5``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ @@ -653,7 +609,7 @@ type staticInInterface = let x = 0 """, num = 1) - [] + [] member public this.``CompilerErrorsInErrList6``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ @@ -666,7 +622,7 @@ type staticInInterface = | B = 0N """, num = 2) - [] + [] member public this.``CompilerErrorsInErrList7``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ @@ -697,14 +653,14 @@ type staticInInterface = let foo = 1 """, num = 5) - [] + [] member public this.``CompilerErrorsInErrList8``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ type EnumInt8s = | A1 = - 10y """ , num = 1 ) - [] + [] member public this.``CompilerErrorsInErrList9``() = use _guard = this.UsingNewVS() let fileContents1 = """ @@ -732,7 +688,7 @@ type staticInInterface = Build(project) |> ignore this.VerifyCountAtSpecifiedFile(project,1) - [] + [] member public this.``CompilerErrorsInErrList10``() = let fileContents = """ namespace Errorlist @@ -744,26 +700,26 @@ type staticInInterface = this.VerifyCountAtSpecifiedFile(project,1) - [] + [] member public this.``DoubleClickErrorListItem``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ let x = x """, num = 1) - [] + [] member public this.``FixingCodeAfterBuildRemovesErrors01``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ let x = 4 + "x" """, num = 2) - [] + [] member public this.``FixingCodeAfterBuildRemovesErrors02``() = this.VerifyNoErrorListAtOpenProject( fileContents = "let x = 4" ) - [] + [] member public this.``IncompleteExpression``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ @@ -775,7 +731,7 @@ type staticInInterface = List.map (fun x -> x + 1) """ , num = 2) - [] + [] member public this.``IntellisenseRequest``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ @@ -783,7 +739,7 @@ type staticInInterface = member a.B(*Marker*) : int = "1" """, num = 1) - [] + [] member public this.``TypeChecking1``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ @@ -800,7 +756,7 @@ type staticInInterface = x.Next <- Some x """, num = 1) - [] + [] member public this.``TypeChecking2``() = this.VerifyErrorListContainedExpectedString( fileContents = """ @@ -817,7 +773,7 @@ type staticInInterface = x.Next <- Some x """, expectedStr = "Foo.Thread option") - [] + [] member public this.``TypeChecking3``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ @@ -833,7 +789,7 @@ type staticInInterface = x.Next <- Some 1 """, num = 1) - [] + [] member public this.``TypeChecking4``() = this.VerifyErrorListContainedExpectedString( fileContents = """ @@ -883,7 +839,7 @@ type staticInInterface = AssertContains(tooltip,"string") *) - [] + [] member public this.``Warning.ConsistentWithLanguageService``() = let fileContent = """ open System @@ -892,9 +848,9 @@ type staticInInterface = let (_, project, file) = this.CreateSingleFileProject(fileContent, fileKind = SourceFileKind.FSX) TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. let warnList = GetWarnings(project) - Assert.AreEqual(20,warnList.Length) + Assert.Equal(20,warnList.Length) - [] + [] member public this.``Warning.ConsistentWithLanguageService.Comment``() = let fileContent = """ open System @@ -903,10 +859,9 @@ type staticInInterface = let (_, project, file) = this.CreateSingleFileProject(fileContent, fileKind = SourceFileKind.FSX) TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. let warnList = GetWarnings(project) - Assert.AreEqual(0,warnList.Length) + Assert.Equal(0,warnList.Length) - [] - [] + [] member public this.``Errorlist.WorkwithoutNowarning``() = let fileContent = """ type Fruit (shelfLife : int) as x = @@ -915,12 +870,11 @@ type staticInInterface = """ let (_, project, file) = this.CreateSingleFileProject(fileContent) - Assert.IsTrue(Build(project).BuildSucceeded) + Assert.True(Build(project).BuildSucceeded) TakeCoffeeBreak(this.VS) let warnList = GetErrors(project) - Assert.AreEqual(1,warnList.Length) + Assert.Equal(1,warnList.Length) // Context project system -[] type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorRecovery.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorRecovery.fs index 9b3b00bfa3c..e38c503c17d 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorRecovery.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorRecovery.fs @@ -4,7 +4,7 @@ namespace Tests.LanguageService.ErrorRecovery open System open System.IO -open NUnit.Framework +open Xunit open Salsa.Salsa open Salsa.VsOpsUtils open UnitTests.TestLib.Salsa @@ -12,8 +12,6 @@ open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem -[] -[] type UsingMSBuild() = inherit LanguageServiceBaseTests() @@ -25,14 +23,13 @@ type UsingMSBuild() = [ for i = 0 to errorList.Length - 1 do yield errorList.[i].Message] - Assert.IsTrue(errorList + Assert.True(errorList |> GetErrorMessages |> Seq.exists (fun errorMessage -> errorMessage.Contains(expectedStr))) // Not a recovery case, but make sure we get a squiggle at the unfinished Main() - [] - [] + [] member public this.``ErrorRecovery.Bug4538_3``() = let fileContent = """ type MyType() = @@ -43,8 +40,7 @@ type UsingMSBuild() = this.VerifyErrorListContainedExpectedString(fileContent,expectedStr) // Not a recovery case, but make sure we get a squiggle at the unfinished Main() - [] - [] + [] member public this.``ErrorRecovery.Bug4538_4``() = let fileContent = """ type MyType() = @@ -54,8 +50,7 @@ type UsingMSBuild() = let expectedStr = "The block following this 'use' is unfinished. Every code block is an expression and must have a result. 'use' cannot be the final code element in a block. Consider giving this block an explicit result." this.VerifyErrorListContainedExpectedString(fileContent,expectedStr) - [] - [] + [] member public this.``ErrorRecovery.Bug4881_1``() = let code = ["let s = \"\"" @@ -70,8 +65,7 @@ type UsingMSBuild() = let completions = AutoCompleteAtCursor file AssertCompListContains(completions,"Split") - [] - [] + [] member public this.``ErrorRecovery.Bug4881_2``() = let code = ["let s = \"\"" @@ -87,8 +81,7 @@ type UsingMSBuild() = let completions = AutoCompleteAtCursor file AssertCompListContains(completions,"Split") - [] - [] + [] member public this.``ErrorRecovery.Bug4881_3``() = let code = ["let s = \"\"" @@ -105,8 +98,7 @@ type UsingMSBuild() = AssertCompListContains(completions,"Split") - [] - [] + [] member public this.``ErrorRecovery.Bug4881_4``() = let code = ["let s = \"\"" @@ -122,8 +114,7 @@ type UsingMSBuild() = // This case was fixed while investigating 4538. - [] - [] + [] member public this.``ErrorRecovery.NotFixing4538_1``() = let code = ["type MyType() = " @@ -139,8 +130,7 @@ type UsingMSBuild() = AssertCompListContains(completions,"MyType") // This case was fixed while investigating 4538. - [] - [] + [] member public this.``ErrorRecovery.NotFixing4538_2``() = let code = ["type MyType() = " @@ -156,8 +146,7 @@ type UsingMSBuild() = AssertCompListContains(completions,"MyType") // This case was fixed while investigating 4538. - [] - [] + [] member public this.``ErrorRecovery.NotFixing4538_3``() = let code = ["type MyType() = " @@ -171,8 +160,7 @@ type UsingMSBuild() = let completions = CtrlSpaceCompleteAtCursor file AssertCompListContains(completions,"MyType") - [] - [] + [] member public this.``ErrorRecovery.Bug4538_1``() = let code = ["type MyType() = " @@ -187,8 +175,7 @@ type UsingMSBuild() = let completions = CtrlSpaceCompleteAtCursor file AssertCompListContains(completions,"MyType") - [] - [] + [] member public this.``ErrorRecovery.Bug4538_2``() = let code = ["type MyType() = " @@ -207,8 +194,7 @@ type UsingMSBuild() = - [] - [] + [] member public this.``ErrorRecovery.Bug4538_5``() = let code = ["type MyType() = " @@ -224,8 +210,7 @@ type UsingMSBuild() = AssertCompListContains(completions,"MyType") - [] - [] + [] member public this.``ErrorRecovery.Bug4594_1``() = let code = ["let Bar(xyz) =" @@ -241,7 +226,7 @@ type UsingMSBuild() = /// In this bug, the Module. at the very end of the file was treated as if it were in the scope /// of Module rather than right after it. This check just makes sure we can see a data tip because /// Module is available. - [] + [] member public this.``ErrorRecovery.5878_1``() = Helper.AssertMemberDataTipContainsInOrder ( @@ -268,6 +253,5 @@ type UsingMSBuild() = // Context project system -[] type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) \ No newline at end of file diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs index 96911faaa3b..a86a6ad5126 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs @@ -2,7 +2,7 @@ namespace Tests.LanguageService.General -open NUnit.Framework +open Xunit open System open System.IO open System.Reflection @@ -21,10 +21,9 @@ open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem -[][] module IFSharpSource_DEPRECATED = - [] + [] let MultipleSourceIsDirtyCallsChangeTimestamps() = let recolorizeWholeFile() = () let recolorizeLine (_line:int) = () @@ -42,8 +41,8 @@ module IFSharpSource_DEPRECATED = let secondDirtyTime = source.DirtyTime let lastTickCount = System.Environment.TickCount - Assert.AreEqual(originalChangeCount + 1, secondChangeCount) - Assert.AreNotEqual(secondDirtyTime, originalDirtyTime) + Assert.Equal(originalChangeCount + 1, secondChangeCount) + Assert.NotEqual(secondDirtyTime, originalDirtyTime) // Here's the test. NeedsVisualRefresh is true now, we call RecordChangeToView() and it should cause a new changeCount and dirty time. while System.Environment.TickCount = lastTickCount do @@ -52,13 +51,12 @@ module IFSharpSource_DEPRECATED = let thirdChangeCount = source.ChangeCount let thirdDirtyTime = source.DirtyTime - Assert.AreEqual(secondChangeCount + 1, thirdChangeCount) - Assert.AreNotEqual(thirdDirtyTime, secondDirtyTime) + Assert.Equal(secondChangeCount + 1, thirdChangeCount) + Assert.NotEqual(thirdDirtyTime, secondDirtyTime) -[][] type UsingMSBuild() = inherit LanguageServiceBaseTests() @@ -104,7 +102,7 @@ type UsingMSBuild() = n ) 0 - [] + [] member public this.``ReconcileErrors.Test1``() = let (_solution, project, file) = this.CreateSingleFileProject(["erroneous"]) Build project |> ignore @@ -112,7 +110,7 @@ type UsingMSBuild() = () /// FEATURE: (Project System only) Adding a file outside the project directory creates a link - [] + [] member public this.``ProjectSystem.FilesOutsideProjectDirectoryBecomeLinkedFiles``() = use _guard = this.UsingNewVS() if OutOfConeFilesAreAddedAsLinks(this.VS) then @@ -127,7 +125,7 @@ type UsingMSBuild() = let projFileText = System.IO.File.ReadAllText(ProjectFile(project)) AssertMatchesRegex '<' @"\s*\s*link.fs" projFileText - [] + [] member public this.``Lexer.CommentsLexing.Bug1548``() = let scan = new FSharpScanner_DEPRECATED(fun source -> let fileName = "test.fs" @@ -195,7 +193,7 @@ type UsingMSBuild() = // This was a bug in ReplaceAllText (subsequent calls to SetMarker would fail) - [] + [] member public this.``Salsa.ReplaceAllText``() = let code = ["#light"; @@ -225,7 +223,7 @@ type UsingMSBuild() = // Make sure that possible overloads (and other related errors) are shown in the error list - [] + [] member public this.``ErrorLogging.Bug5144``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -242,13 +240,13 @@ type UsingMSBuild() = "p.Plot(sin, 0., 0.)"]) let build = time1 Build project "Time to build project" - Assert.IsTrue(not build.BuildSucceeded, "Expected build to fail") + Assert.True(not build.BuildSucceeded, "Expected build to fail") if SupportsOutputWindowPane(this.VS) then Helper.AssertListContainsInOrder(GetOutputWindowPaneLines(this.VS), ["error FS0041: A unique overload for method 'Plot' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: member N.M.LineChart.Plot : f:(float -> float) * xmin:float * xmax:float -> unit, member N.M.LineChart.Plot : f:System.Func * xmin:float * xmax:float -> unit"]) - [] + [] member public this.``ExhaustivelyScrutinize.ThisOnceAsserted``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -258,7 +256,7 @@ type UsingMSBuild() = """ else [],"" """ ] ) - [] + [] member public this.``ExhaustivelyScrutinize.ThisOnceAssertedToo``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -268,7 +266,7 @@ type UsingMSBuild() = " member _.CompareTo(v:obj) = 1" ] ) - [] + [] member public this.``ExhaustivelyScrutinize.ThisOnceAssertedThree``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -278,7 +276,7 @@ type UsingMSBuild() = " with get() = x.Data" " and set(v) = x.Data <- v" ] ) - [] + [] member public this.``ExhaustivelyScrutinize.ThisOnceAssertedFour``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -286,12 +284,11 @@ type UsingMSBuild() = "let z=4" ] ) - [] + [] member public this.``ExhaustivelyScrutinize.ThisOnceAssertedFive``() = Helper.ExhaustivelyScrutinize(this.TestRunner, [ """CSV.File<@"File1.txt">.[0].""" ]) // <@ is one token, wanted < @"... - [] - [] + [] member public this.``ExhaustivelyScrutinize.Bug2277``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -305,8 +302,7 @@ type UsingMSBuild() = "let pp= plot(Area(xs,ys))" ] ) - [] - [] + [] member public this.``ExhaustivelyScrutinize.Bug2283``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -322,7 +318,7 @@ type UsingMSBuild() = /// Verifies that token info returns correct trigger classes /// - this is used in MPF for triggering various intellisense features - [] + [] member public this.``TokenInfo.TriggerClasses``() = let important = [ // Member select for dot completions @@ -340,7 +336,7 @@ type UsingMSBuild() = let info = TestExpose.TokenInfo tok AssertEqual(expected, info) - [] + [] member public this.``MatchingBraces.VerifyMatches``() = let content = [| @@ -383,15 +379,15 @@ type UsingMSBuild() = let (endRow, endCol) = getPos endMarker let checkTextSpan (actual : TextSpan) expectedRow expectedCol = - Assert.IsTrue(actual.iStartLine = actual.iEndLine, "Start and end of the span should be on the same line") - Assert.AreEqual(expectedRow, actual.iStartLine, "Unexpected row") - Assert.AreEqual(expectedCol, actual.iStartIndex, "Unexpected column") - Assert.IsTrue(actual.iEndIndex = (actual.iStartIndex + expectedSpanLen), sprintf "Span should have length == %d" expectedSpanLen) + Assert.True(actual.iStartLine = actual.iEndLine, "Start and end of the span should be on the same line") + Assert.Equal(expectedRow, actual.iStartLine) + Assert.Equal(expectedCol, actual.iStartIndex) + Assert.True(actual.iEndIndex = (actual.iStartIndex + expectedSpanLen), sprintf "Span should have length == %d" expectedSpanLen) let checkBracesForPosition row col = setPos row col let braces = GetMatchingBracesForPositionAtCursor(file) - Assert.AreEqual(1, braces.Length, "One result expected") + Assert.Equal(1, braces.Length) let (lbrace, rbrace) = braces.[0] checkTextSpan lbrace startRow startCol @@ -412,7 +408,6 @@ type UsingMSBuild() = // Context project system -[] type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.GotoDefinition.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.GotoDefinition.fs index 5b3a685b1ea..8c2d8613c7c 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.GotoDefinition.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.GotoDefinition.fs @@ -4,7 +4,7 @@ namespace Tests.LanguageService.GotoDefinition open System open System.IO -open NUnit.Framework +open Xunit open Salsa.Salsa open Salsa.VsOpsUtils open UnitTests.TestLib.Salsa @@ -15,9 +15,8 @@ open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.EditorServices +open Xunit -[] -[] type UsingMSBuild() = inherit LanguageServiceBaseTests() @@ -37,11 +36,11 @@ type UsingMSBuild() = let (_, _, file) = this.CreateSingleFileProject(fileContents, ?references = extraRefs) MoveCursorToStartOfMarker (file, marker) let result = GotoDefinitionAtCursor file - Assert.IsTrue(result.Success, "result.Success") + Assert.True(result.Success, "result.Success") let actualPos = (result.Span.iStartLine, result.Span.iStartIndex) let line = GetLineNumber file (result.Span.iStartLine + 1) printfn "Actual line:%s, actual pos:%A" line actualPos - Assert.AreEqual(pos, actualPos, "pos") + Assert.Equal(pos, actualPos) //GoToDefinitionFail Helper Function member private this.VerifyGoToDefnFailAtStartOfMarker(fileContents : string, marker :string,?addtlRefAssy : string list) = @@ -84,7 +83,7 @@ type UsingMSBuild() = file result - [] + [] member this.``Operators.TopLevel``() = this.VerifyGotoDefnSuccessForNonIdentifierAtStartOfMarker( fileContents = """ @@ -95,7 +94,7 @@ type UsingMSBuild() = pos=(1,21) ) - [] + [] member this.``Operators.Member``() = this.VerifyGotoDefnSuccessForNonIdentifierAtStartOfMarker( fileContents = """ @@ -108,7 +107,7 @@ type UsingMSBuild() = pos=(3,35) ) - [] + [] member public this.``Value``() = this.VerifyGoToDefnSuccessAtStartOfMarker( fileContents = """ @@ -123,7 +122,7 @@ type UsingMSBuild() = marker = "valueX (*GotoValDef*)", definitionCode = "let valueX = Beta(1.0M, ())(*GotoTypeDef*)") - [] + [] member public this.``DisUnionMember``() = this.VerifyGoToDefnSuccessAtStartOfMarker( fileContents = """ @@ -138,7 +137,7 @@ type UsingMSBuild() = marker = "Beta(1.0M, ())(*GotoTypeDef*)", definitionCode = "| Beta of decimal * unit") - [] + [] member public this.``PrimitiveType``() = this.VerifyGoToDefnFailAtStartOfMarker( fileContents = """ @@ -146,7 +145,7 @@ type UsingMSBuild() = let bi = 123456I""", marker = "123456I") - [] + [] member public this.``OnTypeDefinition``() = this.VerifyGoToDefnSuccessAtStartOfMarker( fileContents = """ @@ -157,7 +156,7 @@ type UsingMSBuild() = marker = "One (*Marker1*)", definitionCode = "type One (*Marker1*) = One") - [] + [] member public this.``Parameter``() = this.VerifyGoToDefnSuccessAtStartOfMarker( fileContents = """ @@ -168,13 +167,10 @@ type UsingMSBuild() = marker = "One (*Marker2*)", definitionCode = "type One (*Marker1*) = One") - [] - [] - [] // This test case check the GotoDefinition (i.e. the TypeProviderDefinitionLocation Attribute) - [] // We expect the correct FilePath, Line and Column on provided: Type, Event, Method, and Property // TODO: add a case for a provided Field + [] member public this.``GotoDefinition.TypeProvider.DefinitionLocationAttribute``() = use _guard = this.UsingNewVS() // Note that the verification helped method is custom because we *do* care about the column as well, @@ -207,8 +203,8 @@ type UsingMSBuild() = let column' = column - 2 match result.ToOption() with - | Some(span,_) -> Assert.AreEqual(column',span.iStartIndex, "The cursor landed on the incorrect column!") - | None -> Assert.Fail <| sprintf "Expected to find the definition at column '%d' but GotoDefn failed." column' + | Some(span,_) -> Assert.Equal(column',span.iStartIndex) + | None -> failwithf "Expected to find the definition at column '%d' but GotoDefn failed." column' // Basic scenario on a provided Type let ``Type.BasicScenario``() = @@ -293,19 +289,19 @@ type UsingMSBuild() = ``Event.BasicScenario``() - [] + [] member public this.``GotoDefinition.NoSourceCodeAvailable``() = this.VerifyGoToDefnFailAtStartOfMarker ( fileContents = "System.String.Format(\"\")", marker = "ormat", f = (fun (_, result) -> - Assert.IsFalse(result.Success) - Assert.IsTrue(result.ErrorDescription.Contains("Source code is not available")) + Assert.False(result.Success) + Assert.True(result.ErrorDescription.Contains("Source code is not available")) ) ) - [] + [] member public this.``GotoDefinition.NoIdentifierAtLocation``() = let useCases = [ @@ -319,12 +315,12 @@ type UsingMSBuild() = fileContents = source, marker = marker, f = (fun (_, result) -> - Assert.IsFalse(result.Success) - Assert.IsTrue(result.ErrorDescription.Contains("Cursor is not on identifier")) + Assert.False(result.Success) + Assert.True(result.ErrorDescription.Contains("Cursor is not on identifier")) ) ) - [] + [] member public this.``GotoDefinition.ProvidedTypeNoDefinitionLocationAttribute``() = this.VerifyGoToDefnFailAtStartOfMarker @@ -333,12 +329,11 @@ type UsingMSBuild() = type T = N1.T<"", 1> """, marker = "T<", - f = (fun (_, result) -> Assert.IsFalse(result.Success) ), + f = (fun (_, result) -> Assert.False(result.Success) ), addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")] ) - [] - [] + [] member public this.``GotoDefinition.ProvidedMemberNoDefinitionLocationAttribute``() = let useCases = [ @@ -359,15 +354,13 @@ type UsingMSBuild() = fileContents = source, marker = marker, f = (fun (_, result) -> - Assert.IsFalse(result.Success) + Assert.False(result.Success) let expectedText = sprintf "provided member '%s'" name - Assert.IsTrue(result.ErrorDescription.Contains(expectedText)) + Assert.True(result.ErrorDescription.Contains(expectedText)) ), addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")] ) - [] - [] - [] + [] // This test case is when the TypeProviderDefinitionLocationAttribute filepath doesn't exist for TypeProvider Type member public this.``GotoDefinition.TypeProvider.DefinitionLocationAttribute.Type.FileDoesnotExist``() = this.VerifyGoToDefnFailAtStartOfMarker( @@ -379,10 +372,7 @@ type UsingMSBuild() = marker = "T(*GotoValDef*)", addtlRefAssy = [PathRelativeToTestAssembly(@"DefinitionLocationAttributeFileDoesnotExist.dll")]) - [] - [] - [] - [] + [] //This test case is when the TypeProviderDefinitionLocationAttribute Line doesn't exist for TypeProvider Type member public this.``GotoDefinition.TypeProvider.DefinitionLocationAttribute.Type.LineDoesnotExist``() = this.VerifyGoToDefnFailAtStartOfMarker( @@ -394,9 +384,7 @@ type UsingMSBuild() = marker = "T(*GotoValDef*)", addtlRefAssy = [PathRelativeToTestAssembly(@"DefinitionLocationAttributeLineDoesnotExist.dll")]) - [] - [] - [] + [] // This test case is when the TypeProviderDefinitionLocationAttribute filepath doesn't exist for TypeProvider Constructor member public this.``GotoDefinition.TypeProvider.DefinitionLocationAttribute.Constructor.FileDoesnotExist``() = this.VerifyGoToDefnFailAtStartOfMarker( @@ -410,9 +398,7 @@ type UsingMSBuild() = - [] - [] - [] + [] //This test case is when the TypeProviderDefinitionLocationAttribute filepath doesn't exist for TypeProvider Method member public this.``GotoDefinition.TypeProvider.DefinitionLocationAttribute.Method.FileDoesnotExist``() = this.VerifyGoToDefnFailAtStartOfMarker( @@ -424,9 +410,7 @@ type UsingMSBuild() = marker = "M(*GotoValDef*)", addtlRefAssy = [PathRelativeToTestAssembly(@"DefinitionLocationAttributeFileDoesnotExist.dll")]) - [] - [] - [] + [] // This test case is when the TypeProviderDefinitionLocationAttribute filepath doesn't exist for TypeProvider Property member public this.``GotoDefinition.TypeProvider.DefinitionLocationAttribute.Property.FileDoesnotExist``() = this.VerifyGoToDefnFailAtStartOfMarker( @@ -438,9 +422,7 @@ type UsingMSBuild() = marker = "StaticProp(*GotoValDef*)", addtlRefAssy = [PathRelativeToTestAssembly(@"DefinitionLocationAttributeFileDoesnotExist.dll")]) - [] - [] - [] + [] //This test case is when the TypeProviderDefinitionLocationAttribute filepath doesn't exist for TypeProvider Event member public this.``GotoDefinition.TypeProvider.DefinitionLocationAttribute.Event.FileDoesnotExist``() = this.VerifyGoToDefnFailAtStartOfMarker( @@ -453,7 +435,7 @@ type UsingMSBuild() = marker = "Event1(*GotoValDef*)", addtlRefAssy = [PathRelativeToTestAssembly(@"DefinitionLocationAttributeFileDoesnotExist.dll")]) - [] + [] member public this.``ModuleDefinition``() = this.VerifyGoToDefnSuccessAtStartOfMarker( fileContents = """ @@ -464,7 +446,7 @@ type UsingMSBuild() = marker = "Foo (*MarkerModuleDefinition*)", definitionCode = "module Foo (*MarkerModuleDefinition*) =") - [] + [] member public this.``Record.Field.Definition``() = this.VerifyGoToDefnSuccessAtStartOfMarker( fileContents = """ @@ -481,7 +463,7 @@ type UsingMSBuild() = marker = "myX (*MarkerXFieldDefinition*)", definitionCode = "{ myX (*MarkerXFieldDefinition*) : int") - [] + [] member public this.``Record.Field.Usage``() = this.VerifyGoToDefnSuccessAtStartOfMarker( fileContents = """ @@ -508,14 +490,14 @@ type UsingMSBuild() = member internal this.GotoDefinitionCheckResultAgainst (exp : (string * string * string) option)(file : OpenFile)(act : GotoDefnResult) : unit = match (exp, act.ToOption()) with | (Some (toFind, expLine, expFile), Some (span, actFile)) -> printfn "%s" "Result received, as expected; checking." - Assert.AreEqual (expFile, actFile) + Assert.Equal (expFile, actFile) printfn "%s" "Filename matches expected." MoveCursorTo(file, span.iStartLine + 1, span.iStartIndex + 1) // adjust & move to the identifier match GetIdentifierAtCursor file with // REVIEW: actually check that we're on the leftmost character of the identifier | None -> Assert.Fail("No identifier at cursor!") - | Some (id, _) -> Assert.AreEqual (toFind, id) // are we on the identifier we expect? + | Some (id, _) -> Assert.Equal (toFind, id) // are we on the identifier we expect? printfn "%s" "Identifier at cursor matches expected." - Assert.AreEqual (expLine.Trim (), (span.iStartLine |> (+) 1 |> GetLineNumber file).Trim ()) // ignore initial- / final-whitespace-introduced noise; adjust for difference in index numbers + Assert.Equal (expLine.Trim (), (span.iStartLine |> (+) 1 |> GetLineNumber file).Trim ()) // ignore initial- / final-whitespace-introduced noise; adjust for difference in index numbers printfn "%s" "Line at cursor matches expected." | (None, None) -> printfn "%s" "No result received, as expected." // sometimes we may expect GotoDefinition to fail, e.g., when the cursor isn't placed on a valid position (i.e., over an identifier, and, maybe, a constant if we decide to support that) | (Some _, None) -> Assert.Fail("No result received, but one was expected!") // distinguish this and the following case to give insight in case of failure @@ -528,11 +510,11 @@ type UsingMSBuild() = member internal this.GotoDefinitionCheckResultAgainstAnotherFile (proj : OpenProject)(exp : (string * string) option)(act : GotoDefnResult) : unit = match (exp, act.ToOption()) with | (Some (toFind, expFile), Some (span, actFile)) -> printfn "%s" "Result received, as expected; checking." - Assert.AreEqual (expFile, Path.GetFileName actFile) + Assert.Equal (expFile, Path.GetFileName actFile) printfn "%s" "Filename matches expected." let file = OpenFile (proj, actFile) let line = span.iStartLine |> ((+) 1) |> GetLineNumber file // need to adjust line number here - Assert.AreEqual (toFind, line.Substring (span.iStartIndex, toFind.Length)) + Assert.Equal (toFind, line.Substring (span.iStartIndex, toFind.Length)) printfn "%s" "Identifier at cursor matches expected." | (None, None) -> printfn "%s" "No result received, as expected." // sometimes we may expect GotoDefinition to fail, e.g., when the cursor isn't placed on a valid position (i.e., over an identifier, and, maybe, a constant if we decide to support that) | (Some _, None) -> Assert.Fail("No result received, but one was expected!") // distinguish this and the following case to give insight in case of failure @@ -542,7 +524,7 @@ type UsingMSBuild() = member this.GotoDefinitionTestWithSimpleFile (startLoc : string)(exp : (string * string) option) : unit = this.SolutionGotoDefinitionTestWithSimpleFile startLoc exp - [] + [] member this.``GotoDefinition.OverloadResolution``() = let lines = [ "type D() =" @@ -559,7 +541,7 @@ type UsingMSBuild() = "d.ToString$4$(\"aaa\") " ] this.GotoDefinitionTestWithMarkup lines - [] + [] member this.``GotoDefinition.OverloadResolutionForProperties``() = let lines = [ "type D() =" " member this.#1##2#Foo" @@ -577,7 +559,7 @@ type UsingMSBuild() = ] this.GotoDefinitionTestWithMarkup lines - [] + [] member this.``GotoDefinition.OverloadResolutionWithOverrides``() = let lines = [ "[]" @@ -596,7 +578,7 @@ type UsingMSBuild() = ] this.GotoDefinitionTestWithMarkup lines - [] + [] member this.``GotoDefinition.OverloadResolutionStatics``() = let lines = [ "type T =" @@ -608,7 +590,7 @@ type UsingMSBuild() = ] this.GotoDefinitionTestWithMarkup lines - [] + [] member this.``GotoDefinition.Constructors``() = let lines = [ "type #1a##1b##1c##1d#B() =" @@ -677,12 +659,12 @@ type UsingMSBuild() = MoveCursorTo(file, line, col) let res = GotoDefinitionAtCursor file match res.ToOption() with - | None -> Assert.IsFalse(targets.ContainsKey(marker), sprintf "%s: definition not found " marker) + | None -> Assert.False(targets.ContainsKey(marker), sprintf "%s: definition not found " marker) | Some (span,text) -> match targets.TryGetValue(marker) with | false, _ -> Assert.Fail(sprintf "%s: unexpected definition found" marker) | true, (line1, col1) -> - Assert.IsTrue(span.iStartIndex = col1 && span.iStartLine = line1, + Assert.True(span.iStartIndex = col1 && span.iStartLine = line1, sprintf "%s: wrong definition found expected %d %d but found %d %d %s" marker line1 col1 span.iStartLine span.iStartIndex text ) @@ -890,7 +872,7 @@ type UsingMSBuild() = // ensure that we've found the correct position (i.e., these must be unique // in any given test source file) - [] + [] member this.``GotoDefinition.InheritedMembers``() = let lines = [ "[]" @@ -910,299 +892,298 @@ type UsingMSBuild() = /// let #x = () in $x - [] + [] member public this.``GotoDefinition.InsideClass.Bug3176`` () = this.GotoDefinitionTestWithSimpleFile "id77 (*loc-77*)" (Some("val id77 (*loc-77*) : int", "id77")) /// let #x = () in $x - [] + [] member public this.``GotoDefinition.Simple.Binding.TrivialLetRHS`` () = this.GotoDefinitionTestWithSimpleFile "x (*loc-1*)" (Some("let x = () (*loc-2*)", "x")) /// let #x = () in x$ - [] + [] member public this.``GotoDefinition.Simple.Binding.TrivialLetRHSToRight`` () = this.GotoDefinitionTestWithSimpleFile " (*loc-1*)" (Some("let x = () (*loc-2*)", "x")) /// let $x = () in x - [] + [] member public this.``GotoDefinition.Simple.Binding.TrivialLetLHS`` () = this.GotoDefinitionTestWithSimpleFile "x = () (*loc-2*)" (Some("let x = () (*loc-2*)", "x")) /// let x = () in let #x = () in $x - [] + [] member public this.``GotoDefinition.Simple.Binding.NestedLetWithSameNameRHS`` () = this.GotoDefinitionTestWithSimpleFile "x (*loc-4*)" (Some("let x = () (*loc-3*)", "x")) /// let x = () in let $x = () in x - [] + [] member public this.``GotoDefinition.Simple.Binding.NestedLetWithSameNameLHSInner`` () = this.GotoDefinitionTestWithSimpleFile "x = () (*loc-3*)" (Some("let x = () (*loc-3*)", "x")) /// let $x = () in let x = () in x - [] + [] member public this.``GotoDefinition.Simple.Binding.NestedLetWithSameNameLHSOuter`` () = this.GotoDefinitionTestWithSimpleFile "x = () (*loc-5*)" (Some("let x = () (*loc-5*)", "x")) /// let #x = () in let x = $x in () - [] + [] member public this.``GotoDefinition.Simple.Binding.NestedLetWithXIsX`` () = this.GotoDefinitionTestWithSimpleFile "x (*loc-6*)" (Some("let x = () (*loc-7*)", "x")) /// let x = () in let rec #x = fun y -> $x y in () - [] + [] member public this.``GotoDefinition.Simple.Binding.NestedLetWithXRec`` () = this.GotoDefinitionTestWithSimpleFile "x y (*loc-8*)" (Some("let rec x = (*loc-9*)", "x")) /// let x = () in let rec x = fun #y -> x $y in () - [] + [] member public this.``GotoDefinition.Simple.Binding.NestedLetWithXRecParam`` () = this.GotoDefinitionTestWithSimpleFile "y (*loc-8*)" (Some("fun y -> (*loc-10*)", "y")) /// let #(+) x _ = x in 2 $+ 3 - [] - [] + [] member public this.``GotoDefinition.Simple.Binding.Operator`` () = this.GotoDefinitionTestWithSimpleFile "+ 3 (*loc-11*)" (Some("let (+) x _ = x (*loc-2*)", "+")) /// type #Zero = /// let f (_ : $Zero) = 0 - [] + [] member public this.``GotoDefinition.Simple.Datatype.NullType`` () = this.GotoDefinitionTestWithSimpleFile "Zero) : 'a = failwith \"hi\" (*loc-14*)" (Some("type Zero = (*loc-13*)", "Zero")) /// type One = $One - [] + [] member public this.``GotoDefinition.Simple.Datatype.UnitTypeConsDef`` () = this.GotoDefinitionTestWithSimpleFile "One (*loc-15*)" (Some("One (*loc-15*)", "One")) /// type $One = One - [] + [] member public this.``GotoDefinition.Simple.Datatype.UnitTypeTypenameDef`` () = this.GotoDefinitionTestWithSimpleFile "One = (*loc-16*)" (Some("type One = (*loc-16*)", "One")) /// type One = #One /// let f (_ : One) = $One - [] + [] member public this.``GotoDefinition.Simple.Datatype.UnitTypeCons`` () = this.GotoDefinitionTestWithSimpleFile "One (*loc-18*)" (Some("One (*loc-15*)", "One")) /// type #One = One /// let f (_ : $One) = One - [] + [] member public this.``GotoDefinition.Simple.Datatype.UnitTypeTypename`` () = this.GotoDefinitionTestWithSimpleFile "One) = (*loc-17*)" (Some("type One = (*loc-16*)", "One")) /// type $Nat = Suc of Nat | Zro - [] + [] member public this.``GotoDefinition.Simple.Datatype.NatTypeTypenameDef`` () = this.GotoDefinitionTestWithSimpleFile "Nat = (*loc-19*)" (Some("type Nat = (*loc-19*)", "Nat")) /// type #Nat = Suc of $Nat | Zro - [] + [] member public this.``GotoDefinition.Simple.Datatype.NatTypeConsArg`` () = this.GotoDefinitionTestWithSimpleFile "Nat (*loc-20*)" (Some("type Nat = (*loc-19*)", "Nat")) /// type Nat = Suc of Nat | #Zro /// fun m -> match m with | $Zro -> () | _ -> () - [] + [] member public this.``GotoDefinition.Simple.Datatype.NatPatZro`` () = this.GotoDefinitionTestWithSimpleFile "Zro -> (*loc-24*)" (Some("| Zro (*loc-21*)", "Zro")) /// type Nat = $Suc of Nat | Zro /// fun m -> match m with | Zro -> () | $Suc _ -> () - [] + [] member public this.``GotoDefinition.Simple.Datatype.NatPatSuc`` () = this.GotoDefinitionTestWithSimpleFile "Suc m -> (*loc-25*)" (Some("| Suc of Nat (*loc-20*)", "Suc")) /// let rec plus m n = match m with | Zro -> n | Suc #m -> Suc (plus $m n) - [] + [] member public this.``GotoDefinition.Simple.Datatype.NatPatSucVarUse`` () = this.GotoDefinitionTestWithSimpleFile "m n) (*loc-26*)" (Some("| Suc m -> (*loc-25*)", "m")) /// let rec plus m n = match m with | Zro -> n | Suc #m -> Suc (plus $m n) - [] + [] member public this.``GotoDefinition.Simple.Datatype.NatPatSucOuterVarUse`` () = this.GotoDefinitionTestWithSimpleFile "n) (*loc-26*)" (Some("let rec plus m n = (*loc-23*)", "n")) /// type $MyRec = { myX : int ; myY : int } - [] + [] member public this.``GotoDefinition.Simple.Datatype.RecordTypenameDef`` () = this.GotoDefinitionTestWithSimpleFile "MyRec = (*loc-27*)" (Some("type MyRec = (*loc-27*)", "MyRec")) /// type MyRec = { $myX : int ; myY : int } - [] + [] member public this.``GotoDefinition.Simple.Datatype.RecordField1Def`` () = this.GotoDefinitionTestWithSimpleFile "myX : int (*loc-28*)" (Some("{ myX : int (*loc-28*)", "myX")) /// type MyRec = { myX : int ; $myY : int } - [] + [] member public this.``GotoDefinition.Simple.Datatype.RecordField2Def`` () = this.GotoDefinitionTestWithSimpleFile "myY : int (*loc-29*)" (Some("myY : int (*loc-29*)", "myY")) /// type MyRec = { #myX : int ; myY : int } /// let rDefault = { $myX = 2 ; myY = 3 } - [] + [] member public this.``GotoDefinition.Simple.Datatype.RecordField1Use`` () = this.GotoDefinitionTestWithSimpleFile "myX = 2 (*loc-30*)" (Some("{ myX : int (*loc-28*)", "myX")) /// type MyRec = { myX : int ; #myY : int } /// let rDefault = { myX = 2 ; $myY = 3 } - [] + [] member public this.``GotoDefinition.Simple.Datatype.RecordField2Use`` () = this.GotoDefinitionTestWithSimpleFile "myY = 3 (*loc-31*)" (Some("myY : int (*loc-29*)", "myY")) /// type MyRec = { #myX : int ; myY : int } /// let rDefault = { myX = 2 ; myY = 3 } /// let _ = { rDefault with $myX = 7 } - [] + [] member public this.``GotoDefinition.Simple.Datatype.RecordField1UseInWith`` () = this.GotoDefinitionTestWithSimpleFile "myX = 7 } (*loc-32*)" (Some("{ myX : int (*loc-28*)", "myX")) /// let a = () in let id (x : '$a) : 'a = x - [] + [] member public this.``GotoDefinition.Simple.Polymorph.Leftmost`` () = this.GotoDefinitionTestWithSimpleFile "a) (*loc-33*)" (Some("let id (x : 'a) (*loc-33*)", "'a")) /// let a = () in let id (x : 'a) : '$a = x - [] + [] member public this.``GotoDefinition.Simple.Polymorph.NotLeftmost`` () = this.GotoDefinitionTestWithSimpleFile "a = x (*loc-34*)" (Some("let id (x : 'a) (*loc-33*)", "'a")) /// let foo = () in let f (_ as $foo) = foo in () - [] + [] member public this.``GotoDefinition.Simple.Tricky.AsPatLHS`` () = this.GotoDefinitionTestWithSimpleFile "foo) = (*loc-35*)" (Some("let f (_ as foo) = (*loc-35*)", "foo")) /// let foo = () in let f (_ as #foo) = $foo in () - [] + [] member public this.``GotoDefinition.Simple.Tricky.AsPatRHS`` () = this.GotoDefinitionTestWithSimpleFile "foo (*loc-36*)" (Some("let f (_ as foo) = (*loc-35*)", "foo")) /// fun $x x -> x - [] + [] member public this.``GotoDefinition.Simple.Tricky.LambdaMultBind1`` () = this.GotoDefinitionTestWithSimpleFile "x (*loc-37*)" (Some("fun x (*loc-37*)", "x")) /// fun x $x -> x - [] + [] member public this.``GotoDefinition.Simple.Tricky.LambdaMultBind2`` () = this.GotoDefinitionTestWithSimpleFile "x -> (*loc-38*)" (Some("x -> (*loc-38*)", "x")) /// fun x $x -> x - [] + [] member public this.``GotoDefinition.Simple.Tricky.LambdaMultBindBody`` () = this.GotoDefinitionTestWithSimpleFile "x (*loc-39*)" (Some("x -> (*loc-38*)", "x")) /// let f = () in let $f = function f -> f in () - [] + [] member public this.``GotoDefinition.Simple.Tricky.LotsOfFsFunc`` () = this.GotoDefinitionTestWithSimpleFile "f = (*loc-41*)" (Some("let f = (*loc-41*)", "f")) /// let f = () in let f = function $f -> f in () - [] + [] member public this.``GotoDefinition.Simple.Tricky.LotsOfFsPat`` () = this.GotoDefinitionTestWithSimpleFile "f -> (*loc-42*)" (Some("function f -> (*loc-42*)", "f")) /// let f = () in let f = function #f -> $f in () - [] + [] member public this.``GotoDefinition.Simple.Tricky.LotsOfFsUse`` () = this.GotoDefinitionTestWithSimpleFile "f (*loc-43*)" (Some("function f -> (*loc-42*)", "f")) /// let f x = match x with | Suc $x | x -> x - [] + [] member public this.``GotoDefinition.Simple.Tricky.OrPatLeft`` () = this.GotoDefinitionTestWithSimpleFile "x (*loc-44*)" (Some("| Suc x (*loc-44*)", "x")) /// let f x = match x with | Suc x | $x -> x - [] + [] member public this.``GotoDefinition.Simple.Tricky.OrPatRight`` () = this.GotoDefinitionTestWithSimpleFile "x (*loc-45*)" (Some("| Suc x (*loc-44*)", "x")) // NOTE: or-patterns bind at first occurrence of the variable /// let f x = match x with | Suc #y & z -> $y - [] + [] member public this.``GotoDefinition.Simple.Tricky.AndPat`` () = this.GotoDefinitionTestWithSimpleFile "y (*loc-46*)" (Some("| Suc y & z -> (*loc-47*)", "y")) /// let f xs = match xs with | #x :: xs -> $x - [] + [] member public this.``GotoDefinition.Simple.Tricky.ConsPat`` () = this.GotoDefinitionTestWithSimpleFile "x (*loc-48*)" (Some("| x :: xs -> (*loc-49*)", "x")) /// let f p = match p with (#y, z) -> $y - [] + [] member public this.``GotoDefinition.Simple.Tricky.PairPat`` () = this.GotoDefinitionTestWithSimpleFile "y (*loc-50*)" (Some("| (y : int, z) -> (*loc-51*)", "y")) /// fun xs -> match xs with x :: #xs when $xs <> [] -> x :: xs - [] + [] member public this.``GotoDefinition.Simple.Tricky.ConsPatWhenClauseInWhen`` () = this.GotoDefinitionTestWithSimpleFile "xs <> [] -> (*loc-52*)" (Some("| x :: xs (*loc-54*)", "xs")) /// fun xs -> match xs with #x :: xs when xs <> [] -> $x :: xs - [] + [] member public this.``GotoDefinition.Simple.Tricky.ConsPatWhenClauseInWhenRhsX`` () = this.GotoDefinitionTestWithSimpleFile "x :: xs (*loc-53*)" (Some("| x :: xs (*loc-54*)", "x")) /// fun xs -> match xs with x :: #xs when xs <> [] -> x :: $xs - [] + [] member public this.``GotoDefinition.Simple.Tricky.ConsPatWhenClauseInWhenRhsXs`` () = this.GotoDefinitionTestWithSimpleFile "xs (*loc-53*)" (Some("| x :: xs (*loc-54*)", "xs")) /// let x = "$x" - [] + [] member public this.``GotoDefinition.Simple.Tricky.InStringFails`` () = this.GotoDefinitionTestWithSimpleFile "x(*loc-72*)" None /// let x = "hello /// $x /// " - [] + [] member public this.``GotoDefinition.Simple.Tricky.InMultiLineStringFails`` () = this.GotoDefinitionTestWithSimpleFile "x(*loc-73*)" None - [] + [] member public this.``GotoDefinition.Simple.Tricky.QuotedKeyword`` () = this.GotoDefinitionTestWithSimpleFile "let`` = (*loc-74*)" (Some("let rec ``let`` = (*loc-74*)", "``let``")) /// module $Too = let foo = () - [] + [] member public this.``GotoDefinition.Simple.Module.DefModname`` () = this.GotoDefinitionTestWithSimpleFile "Too = (*loc-55*)" (Some("module Too = (*loc-55*)", "Too")) /// module Too = $foo = () - [] + [] member public this.``GotoDefinition.Simple.Module.DefMember`` () = this.GotoDefinitionTestWithSimpleFile "foo = 0 (*loc-56*)" (Some("let foo = 0 (*loc-56*)", "foo")) /// module #Too = foo = () /// module Bar = open $Too - [] + [] member public this.``GotoDefinition.Simple.Module.Open`` () = this.GotoDefinitionTestWithSimpleFile "Too (*loc-57*)" (Some("module Too = (*loc-55*)", "Too")) /// module #Too = foo = () /// $Too.foo - [] + [] member public this.``GotoDefinition.Simple.Module.QualifiedModule`` () = this.GotoDefinitionTestWithSimpleFile "Too.foo (*loc-58*)" (Some("module Too = (*loc-55*)", "Too")) /// module Too = #foo = () /// Too.$foo - [] + [] member public this.``GotoDefinition.Simple.Module.QualifiedMember`` () = this.GotoDefinitionTestWithSimpleFile "foo (*loc-58*)" (Some("let foo = 0 (*loc-56*)", "foo")) /// type Parity = Even | Odd /// let (|$Even|Odd|) x = if x % 0 = 0 then Even else Odd - [] + [] member public this.``GotoDefinition.Simple.ActivePat.ConsDefLHS`` () = this.GotoDefinitionTestWithSimpleFile "Even|Odd|) x = (*loc-59*)" (Some("let (|Even|Odd|) x = (*loc-59*)", "|Even|Odd|")) /// type Parity = Even | Odd /// let (|#Even|Odd|) x = if x % 0 = 0 then $Even else Odd - [] + [] member public this.``GotoDefinition.Simple.ActivePat.ConsDefRhs`` () = this.GotoDefinitionTestWithSimpleFile "Even (*loc-60*)" (Some("let (|Even|Odd|) x = (*loc-59*)", "|Even|Odd|")) @@ -1212,17 +1193,16 @@ type UsingMSBuild() = /// match x with /// | $Even -> 1 /// | Odd -> 0 - [] + [] member public this.``GotoDefinition.Simple.ActivePat.PatUse`` () = this.GotoDefinitionTestWithSimpleFile "Even -> 1 (*loc-61*)" (Some("let (|Even|Odd|) x = (*loc-59*)", "|Even|Odd|")) /// let patval = (|Even|Odd|) (*loc-61b*) - [] + [] member public this.``GotoDefinition.Simple.ActivePat.PatUseValue`` () = this.GotoDefinitionTestWithSimpleFile "en|Odd|) (*loc-61b*)" (Some("let (|Even|Odd|) x = (*loc-59*)", "|Even|Odd|")) - [] - [] + [] member public this.``GotoDefinition.Library.InitialTest`` () = this.GotoDefinitionTestWithLib "map (*loc-1*)" (Some("map", "lis.fs")) @@ -1230,32 +1210,32 @@ type UsingMSBuild() = /// type #Class$ () = /// member c.Method () = () - [] + [] member public this.``GotoDefinition.ObjectOriented.ClassNameDef`` () = this.GotoDefinitionTestWithSimpleFile " () = (*loc-62*)" (Some("type Class () = (*loc-62*)", "Class")) /// type Class () = /// member c.#Method$ () = () - [] + [] member public this.``GotoDefinition.ObjectOriented.ILMethodDef`` () = this.GotoDefinitionTestWithSimpleFile " () = () (*loc-63*)" (Some("member c.Method () = () (*loc-63*)", "c.Method")) /// type Class () = /// member #c$.Method () = () - [] + [] member public this.``GotoDefinition.ObjectOriented.ThisDef`` () = this.GotoDefinitionTestWithSimpleFile ".Method () = () (*loc-63*)" (Some("member c.Method () = () (*loc-63*)", "c")) /// type Class () = /// static member #Foo$ () = () - [] + [] member public this.``GotoDefinition.ObjectOriented.StaticMethodDef`` () = this.GotoDefinitionTestWithSimpleFile " () = () (*loc-64*)" (Some("static member Foo () = () (*loc-64*)", "Foo")) /// type #Class () = /// member Method () = () /// let c = Class$ () - [] + [] member public this.``GotoDefinition.ObjectOriented.ConstructorUse`` () = this.GotoDefinitionTestWithSimpleFile " () (*loc-65*)" (Some("type Class () = (*loc-62*)", "Class")) @@ -1263,27 +1243,27 @@ type UsingMSBuild() = /// member #Method () = () /// let c = Class () /// c.Method$ () - [] + [] member public this.``GotoDefinition.ObjectOriented.MethodInvocation`` () = this.GotoDefinitionTestWithSimpleFile " () (*loc-66*)" (Some("member c.Method () = () (*loc-63*)", "c.Method")) /// type Class () = /// static member #Foo () = () /// Class.Foo$ () - [] + [] member public this.``GotoDefinition.ObjectOriented.StaticMethodInvocation`` () = this.GotoDefinitionTestWithSimpleFile " () (*loc-67*)" (Some("static member Foo () = () (*loc-64*)", "Foo")) /// type Class () = /// member c.Method# () = c.Method$ () - [] + [] member public this.``GotoDefinition.ObjectOriented.MethodSelfInvocation`` () = this.GotoDefinitionTestWithSimpleFile " () (*loc-68*)" (Some("member c.Method () = c.Method () (*loc-68*)", "c.Method")) /// type Class () = /// member c.Method1 () = c.Method2$ () /// member #c.Method2 () = c.Method1 () - [] + [] member public this.``GotoDefinition.ObjectOriented.MethodToMethodForward`` () = this.GotoDefinitionTestWithSimpleFile " () (*loc-69*)" (Some("member c.Method2 () = c.Method1 () (*loc-70*)", "c.Method2")) @@ -1293,7 +1273,7 @@ type UsingMSBuild() = /// member c.Method () = /// let #c = Class () /// c$.Method () - [] + [] member public this.``GotoDefinition.ObjectOriented.ShadowThis`` () = this.GotoDefinitionTestWithSimpleFile ".Method () (*loc-71*)" (Some("let c = Class ()", "c")) @@ -1303,11 +1283,11 @@ type UsingMSBuild() = /// member c.Method () = /// let c = Class () /// c.Method$ () - [] + [] member public this.``GotoDefinition.ObjectOriented.ShadowThisMethodInvocation`` () = this.GotoDefinitionTestWithSimpleFile " () (*loc-71*)" (Some("member c.Method () = () (*loc-63*)", "c.Method")) - [] + [] member this.``GotoDefinition.ObjectOriented.StructConstructor`` () = let lines = [ "#light" @@ -1350,7 +1330,7 @@ type UsingMSBuild() = match (QuickParse.GetCompleteIdentifierIsland tolerate s n, exp) with | (Some (s1, _, _), Some s2) -> printfn "%s" "Received result, as expected." - Assert.AreEqual (s1, s2) + Assert.Equal (s1, s2) | (None, None) -> printfn "%s" "Received no result, as expected." | (Some _, None) -> @@ -1358,53 +1338,53 @@ type UsingMSBuild() = | (None, Some _) -> Assert.Fail("Expected result, but didn't receive one!") - [] + [] member public this.``GetCompleteIdTest.TrivialBefore`` () = for tolerate in [true;false] do this.GetCompleteIdTest tolerate "let $ThisIsAnIdentifier = ()" (Some "ThisIsAnIdentifier") - [] + [] member public this.``GetCompleteIdTest.TrivialMiddle`` () = for tolerate in [true;false] do this.GetCompleteIdTest tolerate "let This$IsAnIdentifier = ()" (Some "ThisIsAnIdentifier") - [] + [] member public this.``GetCompleteIdTest.TrivialEnd`` () = this.GetCompleteIdTest true "let ThisIsAnIdentifier$ = ()" (Some "ThisIsAnIdentifier") this.GetCompleteIdTest false "let ThisIsAnIdentifier$ = ()" None - [] + [] member public this.``GetCompleteIdTest.GetsUpToDot1`` () = for tolerate in [true;false] do this.GetCompleteIdTest tolerate "let ThisIsAnIdentifier = Te$st.Moo.Foo.bar" (Some "Test") - [] + [] member public this.``GetCompleteIdTest.GetsUpToDot2`` () = for tolerate in [true;false] do this.GetCompleteIdTest tolerate "let ThisIsAnIdentifier = Test.Mo$o.Foo.bar" (Some "Test.Moo") - [] + [] member public this.``GetCompleteIdTest.GetsUpToDot3`` () = for tolerate in [true;false] do this.GetCompleteIdTest tolerate "let ThisIsAnIdentifier = Test.Moo.Fo$o.bar" (Some "Test.Moo.Foo") - [] + [] member public this.``GetCompleteIdTest.GetsUpToDot4`` () = for tolerate in [true;false] do this.GetCompleteIdTest tolerate "let ThisIsAnIdentifier = Test.Moo.Foo.ba$r" (Some "Test.Moo.Foo.bar") - [] + [] member public this.``GetCompleteIdTest.GetsUpToDot5`` () = this.GetCompleteIdTest true "let ThisIsAnIdentifier = Test.Moo.Foo.bar$" (Some "Test.Moo.Foo.bar") this.GetCompleteIdTest false "let ThisIsAnIdentifier = Test.Moo.Foo.bar$" None - [] + [] member public this.``GetCompleteIdTest.GetOperator`` () = for tolerate in [true;false] do this.GetCompleteIdTest tolerate "let ThisIsAnIdentifier = 3 +$ 4" None - [] + [] member public this.``Identifier.IsConstructor.Bug2516``() = let fileContents = """ module GotoDefinition @@ -1413,7 +1393,7 @@ type UsingMSBuild() = let definitionCode = "type One(*Mark1*) = One" this.VerifyGoToDefnSuccessAtStartOfMarker(fileContents,"(*Mark1*)",definitionCode) - [] + [] member public this.``Identifier.IsTypeName.Bug2516``() = let fileContents = """ module GotoDefinition @@ -1422,7 +1402,7 @@ type UsingMSBuild() = let definitionCode = "type One(*Mark1*) = One" this.VerifyGoToDefnSuccessAtStartOfMarker(fileContents,"(*Mark2*)",definitionCode) - [] + [] member public this.``ModuleName.OnDefinitionSite.Bug2517``() = let fileContents = """ namespace GotoDefinition @@ -1432,7 +1412,7 @@ type UsingMSBuild() = this.VerifyGoToDefnSuccessAtStartOfMarker(fileContents,"(*Mark*)",definitionCode) /// GotoDef on abbreviation - [] + [] member public this.``GotoDefinition.Abbreviation.Bug193064``() = let fileContents = """ type X = int @@ -1442,7 +1422,7 @@ type UsingMSBuild() = /// Verify the GotoDefinition on UoM yield does NOT jump out error dialog, /// will do nothing in automation lab machine or GTD SI.fs on dev machine with enlistment. - [] + [] member public this.``GotoDefinition.UnitOfMeasure.Bug193064``() = let fileContents = """ open Microsoft.FSharp.Data.UnitSystems.SI @@ -1451,6 +1431,5 @@ type UsingMSBuild() = // Context project system -[] type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.NavigationBar.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.NavigationBar.fs index 06c9bc76a62..99422f89e91 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.NavigationBar.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.NavigationBar.fs @@ -3,7 +3,7 @@ namespace Tests.LanguageService.NavigationBar open System -open NUnit.Framework +open Xunit open Salsa.Salsa open Salsa.VsOpsUtils open UnitTests.TestLib.Salsa @@ -11,9 +11,6 @@ open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem -[] -[] -[] type UsingMSBuild() = inherit LanguageServiceBaseTests() @@ -100,6 +97,5 @@ type UsingMSBuild() = // Context project system -[] type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) \ No newline at end of file diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs index 4ccfee95276..de36960f819 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs @@ -3,7 +3,7 @@ namespace Tests.LanguageService.ParameterInfo open System -open NUnit.Framework +open Xunit open Salsa.Salsa open Salsa.VsOpsUtils open UnitTests.TestLib.Salsa @@ -16,8 +16,6 @@ module ParamInfoStandardSettings = let standard40AssemblyRefs = [| "System"; "System.Core"; "System.Numerics" |] let queryAssemblyRefs = [ "System.Xml.Linq"; "System.Core" ] -[] -[] type UsingMSBuild() = inherit LanguageServiceBaseTests() @@ -28,7 +26,7 @@ type UsingMSBuild() = yield display ] ] let AssertEmptyMethodGroup(resultMethodGroup:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED option) = - Assert.IsTrue(resultMethodGroup.IsNone, "Expected an empty method group") + Assert.True(resultMethodGroup.IsNone, "Expected an empty method group") let AssertMethodGroupDescriptionsDoNotContain(methods:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED, expectNotToBeThere) = for i = 0 to methods.GetCount() - 1 do @@ -38,10 +36,10 @@ type UsingMSBuild() = AssertNotContains(description,expectNotToBeThere) let AssertMethodGroup(resultMethodGroup:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED option, expectedParamNamesSet:string list list) = - Assert.IsTrue(resultMethodGroup.IsSome, "Expected a method group") + Assert.True(resultMethodGroup.IsSome, "Expected a method group") let resultMethodGroup = resultMethodGroup.Value - Assert.AreEqual(expectedParamNamesSet.Length, resultMethodGroup.GetCount()) - Assert.IsTrue(resultMethodGroup + Assert.Equal(expectedParamNamesSet.Length, resultMethodGroup.GetCount()) + Assert.True(resultMethodGroup |> GetParamDisplays |> Seq.forall (fun paramDisplays -> expectedParamNamesSet |> List.exists (fun expectedParamNames -> @@ -50,9 +48,9 @@ type UsingMSBuild() = paramDisplay.Contains(expectedParamName))))) let AssertMethodGroupContain(resultMethodGroup:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED option, expectedParamNames:string list) = - Assert.IsTrue(resultMethodGroup.IsSome, "Expected a method group") + Assert.True(resultMethodGroup.IsSome, "Expected a method group") let resultMethodGroup = resultMethodGroup.Value - Assert.IsTrue(resultMethodGroup + Assert.True(resultMethodGroup |> GetParamDisplays |> Seq.exists (fun paramDisplays -> expectedParamNames.Length = paramDisplays.Length && @@ -84,48 +82,48 @@ type UsingMSBuild() = //Verify the parameterInfo of one of the list order member private this.VerifyParameterInfoOverloadMethodIndex(fileContents : string, marker : string, index : int, expectedParams:string list, ?addtlRefAssy : string list) = let methodstr = this.GetMethodListForAMethodTip(fileContents,marker,?addtlRefAssy=addtlRefAssy) - Assert.IsTrue(methodstr.IsSome, "Expected a method group") + Assert.True(methodstr.IsSome, "Expected a method group") let methodstr = methodstr.Value let paramDisplays = [ for i = 0 to methodstr.GetParameterCount(index) - 1 do let (name,display,description) = methodstr.GetParameterInfo(index,i) yield display] - Assert.IsTrue((expectedParams, paramDisplays) ||> List.forall2 (fun expectedParam paramDisplay -> paramDisplay.Contains(expectedParam))) + Assert.True((expectedParams, paramDisplays) ||> List.forall2 (fun expectedParam paramDisplay -> paramDisplay.Contains(expectedParam))) //Verify there is at least one parameterInfo member private this.VerifyHasParameterInfo(fileContents : string, marker : string) = let methodstr = this.GetMethodListForAMethodTip(fileContents,marker) - Assert.IsTrue(methodstr.IsSome, "Expected a method group") + Assert.True(methodstr.IsSome, "Expected a method group") let methodstr = methodstr.Value - Assert.IsTrue (methodstr.GetCount() > 0) + Assert.True (methodstr.GetCount() > 0) //Verify return content after the colon member private this.VerifyFirstParameterInfoColonContent(fileContents : string, marker : string, expectedStr : string, ?addtlRefAssy : string list) = let methodstr = this.GetMethodListForAMethodTip(fileContents,marker,?addtlRefAssy=addtlRefAssy) - Assert.IsTrue(methodstr.IsSome, "Expected a method group") + Assert.True(methodstr.IsSome, "Expected a method group") let methodstr = methodstr.Value - Assert.AreEqual(expectedStr, methodstr.GetReturnTypeText(0)) // Expecting a method info like X(a:int,b:int) : int [used to be X(a:int,b:int) -> int] + Assert.Equal(expectedStr, methodstr.GetReturnTypeText(0)) // Expecting a method info like X(a:int,b:int) : int [used to be X(a:int,b:int) -> int] member private this.VerifyParameterCount(fileContents : string, marker : string, expectedCount: int) = let methodstr = this.GetMethodListForAMethodTip(fileContents,marker) - Assert.IsTrue(methodstr.IsSome, "Expected a method group") + Assert.True(methodstr.IsSome, "Expected a method group") let methodstr = methodstr.Value - Assert.AreEqual(0, methodstr.GetParameterCount(expectedCount)) + Assert.Equal(0, methodstr.GetParameterCount(expectedCount)) - [] + [] member public this.``Regression.OnConstructor.881644``() = let fileContent = """new System.IO.StreamReader((*Mark*)""" let methodstr = this.GetMethodListForAMethodTip(fileContent,"(*Mark*)") - Assert.IsTrue(methodstr.IsSome, "Expected a method group") + Assert.True(methodstr.IsSome, "Expected a method group") let methodstr = methodstr.Value if not (methodstr.GetDescription(0).Contains("#ctor")) then failwith "Expected parameter info to contain #ctor" - [] + [] member public this.``Regression.InsideWorkflow.6437``() = let fileContent = """ open System.IO @@ -134,13 +132,13 @@ type UsingMSBuild() = let! buffer = file.AsyncRead((*Mark*)0) return 0 }""" let methodstr = this.GetMethodListForAMethodTip(fileContent,"(*Mark*)") - Assert.IsTrue(methodstr.IsSome, "Expected a method group") + Assert.True(methodstr.IsSome, "Expected a method group") let methodstr = methodstr.Value if not (methodstr.GetDescription(0).Contains("AsyncRead")) then failwith "Expected parameter info to contain AsyncRead" - [] + [] member public this.``Regression.MethodInfo.WithColon.Bug4518_1``() = let fileContent = """ type T() = @@ -149,7 +147,7 @@ type UsingMSBuild() = ((new T()).X((*Mark*)""" this.VerifyFirstParameterInfoColonContent(fileContent,"(*Mark*)",": int") - [] + [] member public this.``Regression.MethodInfo.WithColon.Bug4518_2``() = let fileContent = """ type IFoo = interface @@ -159,7 +157,7 @@ type UsingMSBuild() = i.f((*Mark*)""" this.VerifyFirstParameterInfoColonContent(fileContent,"(*Mark*)",": int") - [] + [] member public this.``Regression.MethodInfo.WithColon.Bug4518_3``() = let fileContent = """ type M() = @@ -168,7 +166,7 @@ type UsingMSBuild() = m.f((*Mark*)""" this.VerifyFirstParameterInfoColonContent(fileContent,"(*Mark*)",": unit") - [] + [] member public this.``Regression.MethodInfo.WithColon.Bug4518_4``() = let fileContent = """ type T() = @@ -177,14 +175,14 @@ type UsingMSBuild() = t.Foo((*Mark*)""" this.VerifyFirstParameterInfoColonContent(fileContent,"(*Mark*)",": string") - [] + [] member public this.``Regression.MethodInfo.WithColon.Bug4518_5``() = let fileContent = """ let f x y = x + y f((*Mark*)""" this.VerifyFirstParameterInfoColonContent(fileContent,"(*Mark*)",": (int -> int) ") - [] + [] member public this.``Regression.StaticVsInstance.Bug3626.Case1``() = let fileContent = """ type Foo() = @@ -193,7 +191,7 @@ type UsingMSBuild() = let z = Foo.Bar((*Mark*))""" this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Mark*)",[["staticReturnsInt"]]) - [] + [] member public this.``Regression.StaticVsInstance.Bug3626.Case2``() = let fileContent = """ type Foo() = @@ -203,21 +201,21 @@ type UsingMSBuild() = let y = Hoo.Bar((*Mark*)""" this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Mark*)",[["instanceReturnsString"]]) - [] + [] member public this.``Regression.MethodInfo.Bug808310``() = let fileContent = """System.Console.WriteLine((*Mark*)""" let methodGroup = this.GetMethodListForAMethodTip(fileContent,"(*Mark*)") - Assert.IsTrue(methodGroup.IsSome, "Expected a method group") + Assert.True(methodGroup.IsSome, "Expected a method group") let methodGroup = methodGroup.Value let description = methodGroup.GetDescription(0) // Make sure that System.Console.WriteLine is not mentioned anywhere exception in the XML comment signature let xmlCommentIndex = description.IndexOf("System.Console.WriteLine]") let noBracket = description.IndexOf("System.Console.WriteLine") - Assert.IsTrue(noBracket>=0) - Assert.AreEqual(noBracket, xmlCommentIndex) + Assert.True(noBracket>=0) + Assert.Equal(noBracket, xmlCommentIndex) - [] + [] member public this.``NoArguments``() = // we want to see e.g. // g() : int @@ -240,20 +238,19 @@ type UsingMSBuild() = this.VerifyParameterCount(fileContents,"(*3*)", 0) this.VerifyParameterCount(fileContents,"(*4*)", 0) - [] + [] member public this.``Single.Constructor1``() = let fileContent = """new System.DateTime((*Mark*)""" this.VerifyHasParameterInfo(fileContent, "(*Mark*)") - [] + [] member public this.``Single.Constructor2``() = let fileContent = """ open System new DateTime((*Mark*)""" this.VerifyHasParameterInfo(fileContent, "(*Mark*)") - [] - [] + [] member public this.``Single.DotNet.StaticMethod``() = let code = ["#light" @@ -266,26 +263,26 @@ type UsingMSBuild() = AssertMethodGroup(methodGroup, [["objA"; "objB"]]) gpatcc.AssertExactly(0,0) - [] + [] member public this.``Regression.NoParameterInfo.100I.Bug5038``() = let fileContent = """100I((*Mark*)""" this.VerifyNoParameterInfoAtStartOfMarker(fileContent,"(*Mark*)") - [] + [] member public this.``Single.DotNet.InstanceMethod``() = let fileContent = """ let s = "Hello" s.Substring((*Mark*)""" this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Mark*)",[["startIndex"]; ["startIndex"; "length"]]) - [] + [] member public this.``Single.BasicFSharpFunction``() = let fileContent = """ let foo(x) = 1 foo((*Mark*)""" this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Mark*)",[["'a"]]) - // [] disabled for F#8, legacy service, covered in FCS tests instead + // [] disabled for F#8, legacy service, covered in FCS tests instead member public this.``Single.DiscriminatedUnion.Construction``() = let fileContent = """ type MyDU = @@ -305,7 +302,7 @@ type UsingMSBuild() = this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Mark3*)",[["``Long Name`` : int"; "string"]]) this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Mark4*)",[["int"]]) - // [] disabled for F#8, legacy service, covered in FCS tests instead + // [] disabled for F#8, legacy service, covered in FCS tests instead member public this.``Single.Exception.Construction``() = let fileContent = """ exception E1 of int * string @@ -321,10 +318,7 @@ type UsingMSBuild() = this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Mark2*)",[["V1: int"; "string"; "V3: bool" ]]) this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Mark3*)",[["``Long Name`` : int"; "string" ]]) - [] - [] - [] - [] + [] //This test verifies that ParamInfo on a provided type that exposes one (static) method that takes one argument works normally. member public this.``TypeProvider.StaticMethodWithOneParam`` () = let fileContent = """ @@ -333,10 +327,7 @@ type UsingMSBuild() = this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Marker*)",[["arg1"]], addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test verifies that ParamInfo on a provided type that exposes a (static) method that takes >1 arguments works normally. member public this.``TypeProvider.StaticMethodWithMoreParam`` () = let fileContent = """ @@ -345,12 +336,9 @@ type UsingMSBuild() = this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Marker*)",[["arg1";"arg2"]], addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] + [] //This test case verify the TypeProvider static method return type or colon content of the method //This test verifies that ParamInfo on a provided type that exposes one (static) method that takes one argument - [] //and returns something works correctly (more precisely, it checks that the return type is 'int') member public this.``TypeProvider.StaticMethodColonContent`` () = let fileContent = """ @@ -360,10 +348,7 @@ type UsingMSBuild() = addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test verifies that ParamInfo on a provided type that exposes a Constructor that takes no argument works normally. member public this.``TypeProvider.ConstructorWithNoParam`` () = let fileContent = """ @@ -372,10 +357,7 @@ type UsingMSBuild() = this.VerifyParameterInfoOverloadMethodIndex(fileContent,"(*Marker*)",0,[], addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test verifies that ParamInfo on a provided type that exposes a Constructor that takes one argument works normally. member public this.``TypeProvider.ConstructorWithOneParam`` () = let fileContent = """ @@ -384,10 +366,7 @@ type UsingMSBuild() = this.VerifyParameterInfoOverloadMethodIndex(fileContent,"(*Marker*)",1,["arg1"], addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test verifies that ParamInfo on a provided type that exposes a Constructor that takes >1 argument works normally. member public this.``TypeProvider.ConstructorWithMoreParam`` () = let fileContent = """ @@ -396,10 +375,7 @@ type UsingMSBuild() = this.VerifyParameterInfoOverloadMethodIndex(fileContent,"(*Marker*)",2,["arg1";"arg2"], addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test verifies that ParamInfo on a provided type that exposes a static parameter that takes >1 argument works normally. member public this.``TypeProvider.Type.WhenOpeningBracket`` () = let fileContent = """ @@ -408,10 +384,7 @@ type UsingMSBuild() = this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Marker*)",[["Param1";"ParamIgnored"]], addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test verifies that after closing bracket ">" the ParamInfo isn't showing on a provided type that exposes a static parameter that takes >1 argument works normally. //This is a regression test for Bug DevDiv:181000 member public this.``TypeProvider.Type.AfterCloseBracket`` () = @@ -421,10 +394,7 @@ type UsingMSBuild() = this.VerifyNoParameterInfoAtStartOfMarker(fileContent,"(*Marker*)", addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test verifies that ParamInfo is showing after delimiter "," on a provided type that exposes a static parameter that takes >1 argument works normally. member public this.``TypeProvider.Type.AfterDelimiter`` () = let fileContent = """ @@ -434,8 +404,7 @@ type UsingMSBuild() = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``Single.InMatchClause``() = let v461 = Version(4,6,1) let fileContent = """ @@ -534,23 +503,22 @@ type UsingMSBuild() = let methodGroup = GetParameterInfoAtCursor file if (methReq = []) then - Assert.IsTrue(methodGroup.IsNone, "Expected no method group") + Assert.True(methodGroup.IsNone, "Expected no method group") else AssertMethodGroup(methodGroup, methReq) // Test on .NET functions with no parameter - [] + [] member public this.``Single.DotNet.NoParameters`` () = this.TestSystematicParameterInfo("x.ToUpperInvariant(", [ [] ]) // Test on .NET function with one parameter - [] + [] member public this.``Single.DotNet.OneParameter`` () = this.TestSystematicParameterInfo("System.DateTime.Today.AddYears(", [ ["value: int"] ] ) // Test appearance of PI on second parameter of .NET function - [] - [] + [] member public this.``Single.DotNet.OnSecondParameter`` () = this.TestSystematicParameterInfo("loc-1*),", [ ["format"; "args"]; ["format"; "arg0"]; @@ -558,8 +526,7 @@ type UsingMSBuild() = ["format"; "arg0"; "arg1"]; ["format"; "arg0"; "arg1"; "arg2"] ] ) // Test on .NET functions with parameter array - [] - [] + [] member public this.``Single.DotNet.ParameterArray`` () = this.TestSystematicParameterInfo("loc-2*),", [ ["format"; "args"]; ["format"; "arg0"]; @@ -567,69 +534,63 @@ type UsingMSBuild() = ["format"; "arg0"; "arg1"]; ["format"; "arg0"; "arg1"; "arg2"] ] ) // Test on .NET indexers - [] - [] + [] member public this.``Single.DotNet.IndexerParameter`` () = this.TestSystematicParameterInfo("alist.[", [ ["index: int"] ] ) // Test on .NET parameters passed with 'out' keyword (byref) - [] - [] + [] member public this.``Single.DotNet.ParameterByReference`` () = this.TestSystematicParameterInfo("Int32.TryParse(s,", [ ["s: string"; "result: int byref"]; ["s"; "style"; "provider"; "result"] ] ) // Test on reference type and value type parameters (e.g. string & DateTime) - [] + [] member public this.``Single.DotNet.RefTypeValueType`` () = this.TestSystematicParameterInfo("loc-3*)Emp(", [ []; ["name: string"; "dob: System.DateTime"]; ["name: string"; "salary: float"; "dob: System.DateTime"] ] ) // Test PI does not pop up at point of definition/declaration - [] - [] + [] member public this.``Single.Locations.PointOfDefinition`` () = this.TestSystematicParameterInfo("loc-4*)new(", [ ] ) this.TestSystematicParameterInfo("member ConvertToInt32 (", [ ] ) this.TestSystematicParameterInfo("member this.IncreaseBy(", [ ] ) // Test PI does not pop up on whitespace after type annotation - [] - [] + [] member public this.``Single.Locations.AfterTypeAnnotation`` () = this.TestSystematicParameterInfo("(*loc-5*)", [], true) // Test PI does not pop up after non-parameterized properties - [] + [] member public this.``Single.Locations.AfterProperties`` () = this.TestSystematicParameterInfo("System.DateTime.Today", []) //this.TestSystematicParameterInfo("(*loc-8*)", [], true) // Test PI does not pop up after non-function values - [] + [] member public this.``Single.Locations.AfterValues`` () = this.TestSystematicParameterInfo("(*loc-8*)", [], true) // Test PI does not pop up after non-parameterized properties and after values - [] - [] + [] member public this.``Single.Locations.EndOfFile`` () = this.TestSystematicParameterInfo("System.Console.ReadLine(", [ [] ]) // Test PI pop up on parameter list for attributes - [] - [] + [] member public this.``Single.OnAttributes`` () = this.TestSystematicParameterInfo("(*loc-6*)", [ []; [ "check: bool" ] ], true) // Test PI when quoted identifiers are used as parameter - [] + [] member public this.``Single.QuotedIdentifier`` () = this.TestSystematicParameterInfo("(*loc-7*)", [ []; [ "maxValue" ]; [ "minValue"; "maxValue" ] ], true) // Test PI with parameters of custom type - [] + [] member public this.``Single.RecordAndUnionType`` () = this.TestSystematicParameterInfo("(*loc-9*)", [ [ "Fruit"; "KeyValuePair" ] ], true) @@ -643,65 +604,55 @@ type UsingMSBuild() = MoveCursorToEndOfMarker(file, testLine) let methodGroup = GetParameterInfoAtCursor file if (methReq = []) then - Assert.IsTrue(methodGroup.IsNone, "expected no method group") + Assert.True(methodGroup.IsNone, "expected no method group") else AssertMethodGroup(methodGroup, methReq) - [] + [] member public this.``Single.Generics.Typeof``() = this.TestGenericParameterInfo("typeof(", []) - [] - [] + [] member public this.``Single.Generics.MathAbs``() = let sevenTimes l = [ l; l; l; l; l; l; l ] this.TestGenericParameterInfo("Math.Abs(", sevenTimes ["value"]) - [] - [] + [] member public this.``Single.Generics.ExchangeInt``() = let sevenTimes l = [ l; l; l; l; l; l; l ] this.TestGenericParameterInfo("Interlocked.Exchange(", sevenTimes ["location1"; "value"]) - [] - [] + [] member public this.``Single.Generics.Exchange``() = let sevenTimes l = [ l; l; l; l; l; l; l ] this.TestGenericParameterInfo("Interlocked.Exchange(", sevenTimes ["location1"; "value"]) - [] - [] + [] member public this.``Single.Generics.ExchangeUnder``() = let sevenTimes l = [ l; l; l; l; l; l; l ] this.TestGenericParameterInfo("Interlocked.Exchange<_> (", sevenTimes ["location1"; "value"]) - [] - [] + [] member public this.``Single.Generics.Dictionary``() = this.TestGenericParameterInfo("System.Collections.Generic.Dictionary<_, option>(", [ []; ["capacity"]; ["comparer"]; ["capacity"; "comparer"]; ["dictionary"]; ["dictionary"; "comparer"] ]) - [] - [] + [] member public this.``Single.Generics.List``() = this.TestGenericParameterInfo("new System.Collections.Generic.List< _ > ( ", [ []; ["capacity"]; ["collection"] ]) - [] - [] + [] member public this.``Single.Generics.ListInt``() = this.TestGenericParameterInfo("System.Collections.Generic.List(", [ []; ["capacity"]; ["collection"] ]) - [] - [] + [] member public this.``Single.Generics.EventHandler``() = this.TestGenericParameterInfo("new System.EventHandler( ", [ [""] ]) // function arg doesn't have a name - [] - [] + [] member public this.``Single.Generics.EventHandlerEventArgs``() = this.TestGenericParameterInfo("System.EventHandler(", [ [""] ]) // function arg doesn't have a name - [] - [] + [] member public this.``Single.Generics.EventHandlerEventArgsNew``() = this.TestGenericParameterInfo("new System.EventHandler ( ", [ [""] ]) // function arg doesn't have a name @@ -727,7 +678,7 @@ type UsingMSBuild() = let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) MoveCursorToEndOfMarker(file, cursorPrefix) let info = GetParameterInfoAtCursor file - Assert.IsTrue(info.IsNone, "expected no parameter info") + Assert.True(info.IsNone, "expected no parameter info") gpatcc.AssertExactly(0,0) member public this.TestParameterInfoLocation (testLine, expectedPos, ?addtlRefAssy : string list) = @@ -740,7 +691,7 @@ type UsingMSBuild() = let (_, _, file) = this.CreateSingleFileProject(code, ?references = addtlRefAssy) MoveCursorToEndOfMarker(file, cursorPrefix) let info = GetParameterInfoAtCursor file - Assert.IsTrue(info.IsSome, "expected parameter info") + Assert.True(info.IsSome, "expected parameter info") let info = info.Value AssertEqual(expectedPos, info.GetColumnOfStartOfLongId()) @@ -748,83 +699,72 @@ type UsingMSBuild() = // There are more comments below that explain particular tricky cases - [] + [] member public this.``Single.Locations.Simple``() = this.TestParameterInfoLocation("let a = System.Math.Sin($", 8) - [] + [] member public this.``Single.Locations.LineWithSpaces``() = this.TestParameterInfoLocation("let r =\n"+ " System.Math.Abs($0)", 3) // on the beginning of "System", not line! - [] + [] member public this.``Single.Locations.FullCall``() = this.TestParameterInfoLocation("System.Math.Abs($0)", 0) - [] + [] member public this.``Single.Locations.SpacesAfterParen``() = this.TestParameterInfoLocation("let a = Math.Sign( $-10 )", 8) - [] + [] member public this.``Single.Locations.WithNamespace``() = this.TestParameterInfoLocation("let a = System.Threading.Interlocked.Exchange($", 8) - [] + [] member public this.``ParameterInfo.Locations.WithoutNamespace``() = this.TestParameterInfoLocation("let a = Interlocked.Exchange($", 8) - [] - [] + [] member public this.``Single.Locations.WithGenericArgs``() = this.TestParameterInfoLocation("Interlocked.Exchange($", 0) - [] + [] member public this.``Single.Locations.FunctionWithSpace``() = this.TestParameterInfoLocation("let a = sin 0$.0", 8) - [] + [] member public this.``Single.Locations.MethodCallWithoutParens``() = this.TestParameterInfoLocation("let n = Math.Sin 1$0.0", 8) - [] + [] member public this.``Single.Locations.GenericCtorWithNamespace``() = this.TestParameterInfoLocation("let _ = new System.Collections.Generic.Dictionary<_, _>($)", 12) // on the beginning of "System" (not on "new") - [] + [] member public this.``Single.Locations.GenericCtor``() = this.TestParameterInfoLocation("let _ = new Dictionary<_, _>($)", 12) // on the beginning of "System" (not on "new") - [] - [] - [] - [] + [] //This test verifies that ParamInfo location on a provided type with namespace that exposes static parameter that takes >1 argument works normally. member public this.``TypeProvider.Type.ParameterInfoLocation.WithNamespace`` () = this.TestParameterInfoLocation("type boo = N1.T<$",11, addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test verifies that ParamInfo location on a provided type without the namespace that exposes static parameter that takes >1 argument works normally. member public this.``TypeProvider.Type.ParameterInfoLocation.WithOutNamespace`` () = this.TestParameterInfoLocation("open N1 \n"+"type boo = T<$", expectedPos = 11, addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] + [] //This test verifies that no ParamInfo in a string for a provided type that exposes static parameter that takes >1 argument works normally. //The intent here to make sure the ParamInfo is not shown when inside a string member public this.``TypeProvider.Type.Negative.InString`` () = this.TestParameterInfoNegative("type boo = \"N1.T<$\"", addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] + [] //This test verifies that no ParamInfo in a Comment for a provided type that exposes static parameter that takes >1 argument works normally. //The intent here to make sure the ParamInfo is not shown when inside a comment member public this.``TypeProvider.Type.Negative.InComment`` () = @@ -837,35 +777,35 @@ type UsingMSBuild() = // we *must* look at the previous line to find the location where NameRes info ends // so in these cases we can find the identifier and location of tooltip is beginning of it // (but in general, we don't search for it) - [] + [] member public this.``Single.Locations.Multiline.IdentOnPrevLineWithGenerics``() = this.TestParameterInfoLocation("let d = Dictionary<_, option< int >> \n" + " ( $ )", 8) // on the "D" (line untestable) - [] + [] member public this.``Single.Locations.Multiline.IdentOnPrevLine``() = this.TestParameterInfoLocation("do Console.WriteLine\n" + " ($\"Multiline\")", 3) - [] + [] member public this.``Single.Locations.Multiline.IdentOnPrevPrevLine``() = this.TestParameterInfoLocation("do Console.WriteLine\n" + " ( \n" + " $ \"Multiline\")", 3) - [] + [] member public this.``Single.Locations.GenericCtorWithoutNew``() = this.TestParameterInfoLocation("let d = System.Collections.Generic.Dictionary<_, option< int >> ( $ )", 8) // on "S" - standard - [] + [] member public this.``Single.Locations.Multiline.GenericTyargsOnTheSameLine``() = this.TestParameterInfoLocation("let dict3 = System.Collections.Generic.Dictionary<_, \n" + " option< int>>( $ )", 12) // on "S" (beginning of "System") - [] + [] member public this.``Single.Locations.Multiline.LongIdentSplit``() = this.TestParameterInfoLocation("let ll = new System.Collections.\n" + " Generic.List< _ > ($)", 13) // on "S" (beginning of "System") - [] + [] member public this.``Single.Locations.OperatorTrick3``() = this.TestParameterInfoLocation ("let mutable n = null\n" + @@ -874,32 +814,31 @@ type UsingMSBuild() = // A several cases that are tricky and we don't want to show anything // in the following cases, we may return a location of an operator (its ambiguous), but we don't want to show info about it! - [] + [] member public this.``Single.Negative.OperatorTrick1``() = this.TestParameterInfoNegative ("let fooo = 0\n" + " >($ 1 )") // this may be end of a generic args specification - [] + [] member public this.``Single.Negative.OperatorTrick2``() = this.TestParameterInfoNegative ("let fooo = 0\n" + " <($ 1 )") /// No intellisense in comments/strings! - [] + [] member public this.``Single.InString``() = this.TestParameterInfoNegative ("let s = \"System.Console.WriteLine($)\"") /// No intellisense in comments/strings! - [] + [] member public this.``Single.InComment``() = this.TestParameterInfoNegative ("// System.Console.WriteLine($)") - [] - [] + [] member this.``Regression.LocationOfParams.AfterQuicklyTyping.Bug91373``() = let code = [ "let f x = x " "let f1 y = y " @@ -917,14 +856,13 @@ type UsingMSBuild() = "let z = f(f1( " ] ) MoveCursorToEndOfMarker(file, "f1(") let info = GetParameterInfoAtCursor file // this will fall back to using the name environment, which is stale, but sufficient to look up the call to 'f1' - Assert.IsTrue(info.IsSome, "expected parameter info") + Assert.True(info.IsSome, "expected parameter info") let info = info.Value AssertEqual("f1", info.GetName(0)) // note about (5,0): service.fs adds three lines of empty text to the end of every file, so it reports the location of 'end of file' as first the char, 3 lines past the last line of the file AssertEqual([|(2,10);(2,12);(2,13);(3,0)|], info.GetParameterLocations()) - [] - [] + [] member this.``LocationOfParams.AfterQuicklyTyping.CallConstructor``() = let code = [ "type Foo() = class end" ] let (_, _, file) = this.CreateSingleFileProject(code) @@ -940,7 +878,7 @@ type UsingMSBuild() = MoveCursorToEndOfMarker(file, "new Foo(") // Note: no TakeCoffeeBreak(this.VS) let info = GetParameterInfoAtCursor file // this will fall back to using the name environment, which is stale, but sufficient to look up the call to 'f1' - Assert.IsTrue(info.IsSome, "expected parameter info") + Assert.True(info.IsSome, "expected parameter info") let info = info.Value AssertEqual("Foo", info.GetName(0)) // note about (4,0): service.fs adds three lines of empty text to the end of every file, so it reports the location of 'end of file' as first the char, 3 lines past the last line of the file @@ -950,7 +888,7 @@ type UsingMSBuild() = (* This does not currently work, because the 'fallback to name environment' does weird QuickParse-ing and mangled the long id "Bar.Foo". We really need to rewrite some code paths here to use the real parse tree rather than QuickParse-ing. - [] + [] member this.``ParameterInfo.LocationOfParams.AfterQuicklyTyping.CallConstructorViaLongId.Bug94333``() = let solution = CreateSolution(this.VS) let project = CreateProject(solution,"testproject") @@ -974,7 +912,7 @@ We really need to rewrite some code paths here to use the real parse tree rather AssertEqual([|(1,14);(1,21);(1,21);(4,0)|], info.GetParameterLocations()) *) - [] + [] member public this.``ParameterInfo.NamesOfParams``() = let testLines = [ "type Foo =" @@ -985,7 +923,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let (_, _, file) = this.CreateSingleFileProject(testLines) MoveCursorToStartOfMarker(file, "0") let info = GetParameterInfoAtCursor file - Assert.IsTrue(info.IsSome, "expected parameter info") + Assert.True(info.IsSome, "expected parameter info") let info = info.Value let names = info.GetParameterNames() AssertEqual([| null; null; "d"; "e"; "c" |], names) @@ -1019,7 +957,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let (_, _, file) = this.CreateSingleFileProject(testLines, references = references) MoveCursorToEndOfMarker(file, cursorPrefix) let info = GetParameterInfoAtCursor file - Assert.IsTrue(info.IsSome, "expected parameter info") + Assert.True(info.IsSome, "expected parameter info") let info = info.Value AssertEqual(expectedLocs, info.GetParameterLocations()) @@ -1040,17 +978,17 @@ We really need to rewrite some code paths here to use the real parse tree rather let (_, _, file) = this.CreateSingleFileProject(testLines, references = references) MoveCursorToEndOfMarker(file, cursorPrefix) let info = GetParameterInfoAtCursor file - Assert.IsTrue(info.IsNone, "expected no parameter info for this particular test, though it would be nice if this has started to work") + Assert.True(info.IsNone, "expected no parameter info for this particular test, though it would be nice if this has started to work") - [] + [] member public this.``LocationOfParams.Case1``() = this.TestParameterInfoLocationOfParams("""^System.Console.WriteLine^(^"hel$lo"^)""") - [] + [] member public this.``LocationOfParams.Case2``() = this.TestParameterInfoLocationOfParams("""^System.Console.WriteLine^ (^ "hel$lo {0}" ,^ "Brian" ^)""") - [] + [] member public this.``LocationOfParams.Case3``() = this.TestParameterInfoLocationOfParams( """^System.Console.WriteLine^ @@ -1058,11 +996,11 @@ We really need to rewrite some code paths here to use the real parse tree rather "hel$lo {0}" ,^ "Brian" ^) """) - [] + [] member public this.``LocationOfParams.Case4``() = this.TestParameterInfoLocationOfParams("""^System.Console.WriteLine^ (^ "hello {0}" ,^ ("tuples","don't $ confuse it") ^)""") - [] + [] member public this.``ParameterInfo.LocationOfParams.Bug112688``() = let testLines = [ "let f x y = ()" @@ -1078,7 +1016,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let info = GetParameterInfoAtCursor file () - [] + [] member public this.``ParameterInfo.LocationOfParams.Bug112340``() = let testLines = [ """let a = typeof] - [] + [] member public this.``Regression.LocationOfParams.Bug91479``() = this.TestParameterInfoLocationOfParams("""let z = fun x -> x + ^System.Int16.Parse^(^$ """, markAtEOF=true) - [] + [] member public this.``LocationOfParams.Attributes.Bug230393``() = this.TestParameterInfoLocationOfParams(""" let paramTest((strA : string),(strB : string)) = @@ -1105,30 +1042,30 @@ We really need to rewrite some code paths here to use the real parse tree rather type RMB """) - [] + [] member public this.``LocationOfParams.InfixOperators.Case1``() = // infix operators like '+' do not give their own param info this.TestParameterInfoLocationOfParams("""^System.Console.WriteLine^(^"" + "$"^)""") - [] + [] member public this.``LocationOfParams.InfixOperators.Case2``() = // infix operators like '+' do give param info when used as prefix ops this.TestParameterInfoLocationOfParams("""System.Console.WriteLine((^+^)(^$3^)(4))""") - [] + [] member public this.``LocationOfParams.GenericMethodExplicitTypeArgs()``() = this.TestParameterInfoLocationOfParams(""" type T<'a> = static member M(x:int, y:string) = x + y.Length let x = ^T.M^(^1,^ $"test"^) """) - [] + [] member public this.``LocationOfParams.InsideAMemberOfAType``() = this.TestParameterInfoLocationOfParams(""" type Widget(z) = member x.a = (1 <> ^System.Int32.Parse^(^"$"^)) """) - [] + [] member public this.``LocationOfParams.InsidePropertyGettersAndSetters.Case1``() = this.TestParameterInfoLocationOfParams(""" type Widget(z) = @@ -1138,7 +1075,7 @@ We really need to rewrite some code paths here to use the real parse tree rather member x.P2 with get() = System.Int32.Parse("") member x.P2 with set(z) = System.Int32.Parse("") |> ignore """) - [] + [] member public this.``LocationOfParams.InsidePropertyGettersAndSetters.Case2``() = this.TestParameterInfoLocationOfParams(""" type Widget(z) = @@ -1148,7 +1085,7 @@ We really need to rewrite some code paths here to use the real parse tree rather member x.P2 with get() = System.Int32.Parse("") member x.P2 with set(z) = System.Int32.Parse("") |> ignore """) - [] + [] member public this.``LocationOfParams.InsidePropertyGettersAndSetters.Case3``() = this.TestParameterInfoLocationOfParams(""" type Widget(z) = @@ -1158,7 +1095,7 @@ We really need to rewrite some code paths here to use the real parse tree rather member x.P2 with get() = ^System.Int32.Parse^(^"$"^) member x.P2 with set(z) = System.Int32.Parse("") |> ignore """) - [] + [] member public this.``LocationOfParams.InsidePropertyGettersAndSetters.Case4``() = this.TestParameterInfoLocationOfParams(""" type Widget(z) = @@ -1168,48 +1105,46 @@ We really need to rewrite some code paths here to use the real parse tree rather member x.P2 with get() = System.Int32.Parse("") member x.P2 with set(z) = ^System.Int32.Parse^(^"$"^) |> ignore """) - [] + [] member public this.``LocationOfParams.InsideObjectExpression``() = this.TestParameterInfoLocationOfParams(""" let _ = { new ^System.Object^(^$^) with member _.GetHashCode() = 2}""") - [] + [] member public this.``LocationOfParams.Nested1``() = this.TestParameterInfoLocationOfParams("""System.Console.WriteLine("hello {0}" , ^sin^ (^4$2.0 ^) )""") - [] + [] member public this.``LocationOfParams.MatchGuard``() = this.TestParameterInfoLocationOfParams("""match [1] with | [x] when ^box^(^$x^) <> null -> ()""") - [] + [] member public this.``LocationOfParams.Nested2``() = this.TestParameterInfoLocationOfParams("""System.Console.WriteLine("hello {0}" , ^sin^ 4^$2.0^ )""") - [] + [] member public this.``LocationOfParams.Generics1``() = this.TestParameterInfoLocationOfParams(""" let f<'T,'U>(x:'T, y:'U) = (y,x) let r = ^f^(^4$2,^""^)""") - [] + [] member public this.``LocationOfParams.Generics2``() = this.TestParameterInfoLocationOfParams("""let x = ^System.Collections.Generic.Dictionary^(^42,^n$ull^)""") - [] + [] member public this.``LocationOfParams.Unions1``() = this.TestParameterInfoLocationOfParams(""" type MyDU = | FOO of int * string let r = ^FOO^(^42,^"$"^) """) - [] - [] + [] member public this.``LocationOfParams.EvenWhenOverloadResolutionFails.Case1``() = this.TestParameterInfoLocationOfParams("""let a = new ^System.IO.FileStream^(^$^)""") - [] - [] + [] member public this.``LocationOfParams.EvenWhenOverloadResolutionFails.Case2``() = this.TestParameterInfoLocationOfParams(""" open System.Collections.Generic @@ -1217,8 +1152,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let l = List([||]) ^l.Aggregate^(^$^) // was once a bug""") - [] - [] + [] member public this.``LocationOfParams.BY_DESIGN.WayThatMismatchedParensFailOver.Case1``() = // when only one 'statement' after the mismatched parens after a comma, the comma swallows it and it becomes a badly-indented // continuation of the expression from the previous line @@ -1229,8 +1163,7 @@ We really need to rewrite some code paths here to use the real parse tree rather ^c.M^(^1,^2,^3,^ $ c.M(1,2,3,4)""", markAtEOF=true) - [] - [] + [] member public this.``LocationOfParams.BY_DESIGN.WayThatMismatchedParensFailOver.Case2``() = // when multiple 'statements' after the mismatched parens after a comma, the parser sees a single argument to the method that // is a statement sequence, e.g. a bunch of discarded expressions. That is, @@ -1253,18 +1186,17 @@ We really need to rewrite some code paths here to use the real parse tree rather c.M(1,2,3,4) c.M(1,2,3,4)""", markAtEOF=true) - [] + [] member public this.``LocationOfParams.Tuples.Bug91360.Case1``() = this.TestParameterInfoLocationOfParams(""" ^System.Console.WriteLine^(^ (4$2,43) ^) // oops""") - [] + [] member public this.``LocationOfParams.Tuples.Bug91360.Case2``() = this.TestParameterInfoLocationOfParams(""" ^System.Console.WriteLine^(^ $(42,43) ^) // oops""") - [] - [] + [] member public this.``LocationOfParams.Tuples.Bug123219``() = this.TestParameterInfoLocationOfParams(""" type Expr = | Num of int @@ -1274,14 +1206,14 @@ We really need to rewrite some code paths here to use the real parse tree rather ^x.M1^(^(1,$ """, markAtEOF=true) - [] + [] member public this.``LocationOfParams.UnmatchedParens.Bug91609.OtherCases.Open``() = this.TestParameterInfoLocationOfParams(""" let arr = Array.create 4 1 arr.[1] <- ^System.Int32.Parse^(^$ open^ System""") - [] + [] member public this.``LocationOfParams.UnmatchedParens.Bug91609.OtherCases.Module``() = this.TestParameterInfoLocationOfParams(""" let arr = Array.create 4 1 @@ -1289,7 +1221,7 @@ We really need to rewrite some code paths here to use the real parse tree rather ^module Foo = let x = 42""") - [] + [] member public this.``LocationOfParams.UnmatchedParens.Bug91609.OtherCases.Namespace``() = this.TestParameterInfoLocationOfParams(""" namespace Foo @@ -1298,7 +1230,7 @@ We really need to rewrite some code paths here to use the real parse tree rather arr.[1] <- ^System.Int32.Parse^(^$ namespace^ Other""") - [] + [] member this.``LocationOfParams.InheritsClause.Bug192134``() = this.TestParameterInfoLocationOfParams(""" type B(x : int) = @@ -1306,7 +1238,7 @@ We really need to rewrite some code paths here to use the real parse tree rather type A() = inherit ^B^(^1$,^2^)""") - [] + [] member public this.``LocationOfParams.ThisOnceAsserted``() = this.TestNoParameterInfo(""" module CSVTypeProvider @@ -1325,7 +1257,7 @@ We really need to rewrite some code paths here to use the real parse tree rather match types |> Array.tryFind (fun ty -> ty.Name = typeName^) with _ -> ()""") - [] + [] member public this.``LocationOfParams.ThisOnceAssertedToo``() = this.TestNoParameterInfo(""" let readString() = @@ -1337,7 +1269,7 @@ We really need to rewrite some code paths here to use the real parse tree rather while true do ($) """) - [] + [] member public this.``LocationOfParams.UnmatchedParensBeforeModuleKeyword.Bug245850.Case2a``() = this.TestParameterInfoLocationOfParams(""" module Repro = @@ -1391,92 +1323,84 @@ We really need to rewrite some code paths here to use the real parse tree rather this.TestParameterInfoLocationOfParams (allText, markAtEOF=needMarkAtEnd, ?additionalReferenceAssemblies=additionalReferenceAssemblies) ) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Basic``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ "fo$o",^ 42 ^>""", additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.BasicNamed``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ "fo$o",^ ParamIgnored=42 ^>""", additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Prefix0``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ $ """, // missing all params, just have < markAtEnd = true, additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Prefix1``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ "fo$o",^ 42 """, // missing > markAtEnd = true, additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Prefix1Named``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ "fo$o",^ ParamIgnored=42 """, // missing > markAtEnd = true, additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Prefix2``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ "fo$o",^ """, // missing last param markAtEnd = true, additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Prefix2Named1``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ "fo$o",^ ParamIgnored= """, // missing last param after name with equals markAtEnd = true, additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Prefix2Named2``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ "fo$o",^ ParamIgnored """, // missing last param after name sans equals markAtEnd = true, additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] + [] member public this.``LocationOfParams.TypeProviders.Negative1``() = this.TestNoParameterInfo(""" type D = ^System.Collections.Generic.Dictionary^<^ in$t, int ^>""") - [] + [] member public this.``LocationOfParams.TypeProviders.Negative2``() = this.TestNoParameterInfo(""" type D = ^System.Collections.Generic.List^<^ in$t ^>""") - [] + [] member public this.``LocationOfParams.TypeProviders.Negative3``() = this.TestNoParameterInfo(""" let i = 42 let b = ^i^<^ 4$2""") - [] + [] member public this.``LocationOfParams.TypeProviders.Negative4.Bug181000``() = this.TestNoParameterInfo(""" type U = ^N1.T^<^ "foo",^ 42 ^>$ """, // when the caret is right of the '>', we should not report any param info additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] + [] member public this.``LocationOfParams.TypeProviders.BasicWithinExpr``() = this.TestNoParameterInfo(""" let f() = @@ -1484,8 +1408,7 @@ We really need to rewrite some code paths here to use the real parse tree rather r """, additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.BasicWithinExpr.DoesNotInterfereWithOuterFunction``() = this.TestParameterInfoLocationOfParams(""" let f() = @@ -1493,36 +1416,31 @@ We really need to rewrite some code paths here to use the real parse tree rather r """, additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Bug199744.ExcessCommasShouldNotAssertAndShouldGiveInfo.Case1``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ "fo$o",^ 42,^ ,^ ^>""", additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Bug199744.ExcessCommasShouldNotAssertAndShouldGiveInfo.Case2``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ "fo$o",^ ,^ ^>""", additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Bug199744.ExcessCommasShouldNotAssertAndShouldGiveInfo.Case3``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ ,^$ ^>""", additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.StaticParametersAtConstructorCallSite``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" let x = new ^N1.T^<^ "fo$o",^ 42 ^>()""", additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``TypeProvider.FormatOfNamesOfSystemTypes``() = let code = ["""type TTT = N1.T< "foo", ParamIgnored=42 > """] let references = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")] @@ -1530,7 +1448,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) MoveCursorToEndOfMarker(file,"foo") let methodGroup = GetParameterInfoAtCursor file - Assert.IsTrue(methodGroup.IsSome, "expected parameter info") + Assert.True(methodGroup.IsSome, "expected parameter info") let methodGroup = methodGroup.Value let actualDisplays = [ for i = 0 to methodGroup.GetCount() - 1 do @@ -1541,7 +1459,7 @@ We really need to rewrite some code paths here to use the real parse tree rather AssertEqual(expected, actualDisplays) gpatcc.AssertExactly(0,0) - [] + [] member public this.``ParameterNamesInFunctionsDefinedByLetBindings``() = let useCases = [ @@ -1583,13 +1501,13 @@ We really need to rewrite some code paths here to use the real parse tree rather MoveCursorToEndOfMarker(file, marker) let methodGroup = GetParameterInfoAtCursor file - Assert.IsTrue(methodGroup.IsSome, "expected parameter info") + Assert.True(methodGroup.IsSome, "expected parameter info") let methodGroup = methodGroup.Value - Assert.AreEqual(1, methodGroup.GetCount(), "Only one function expected") + Assert.Equal(1, methodGroup.GetCount()) let expectedParamsCount = List.length expectedParams - Assert.AreEqual(expectedParamsCount, methodGroup.GetParameterCount(0), sprintf "%d parameters expected" expectedParamsCount) + Assert.Equal(expectedParamsCount, methodGroup.GetParameterCount(0)) let actualParams = [ for i = 0 to (expectedParamsCount - 1) do yield methodGroup.GetParameterInfo(0, i) ] let ok = @@ -1600,15 +1518,15 @@ We really need to rewrite some code paths here to use the real parse tree rather printfn "==Parameters don't match==" printfn "Expected parameters %A" expectedParams printfn "Actual parameters %A" actualParams - Assert.Fail() + failwith "Parameters don't match" (* Tests for multi-parameterinfos ------------------------------------------------------------------ *) - [] + [] member public this.``ParameterInfo.ArgumentsWithParamsArrayAttribute``() = let content = """let _ = System.String.Format("",(*MARK*))""" let methodTip = this.GetMethodListForAMethodTip(content, "(*MARK*)") - Assert.IsTrue(methodTip.IsSome, "expected parameter info") + Assert.True(methodTip.IsSome, "expected parameter info") let methodTip = methodTip.Value let overloadWithTwoParamsOpt = @@ -1627,16 +1545,16 @@ We really need to rewrite some code paths here to use the real parse tree rather ) |> Seq.tryFind(fun (i, _) -> i = 2) match overloadWithTwoParamsOpt with - | Some(_, [_;(_name, display, _description)]) -> Assert.IsTrue(display.Contains("[] args")) + | Some(_, [_;(_name, display, _description)]) -> Assert.True(display.Contains("[] args")) | x -> Assert.Fail(sprintf "Expected overload not found, current result %A" x) (* DotNet functions for multi-parameterinfo tests -------------------------------------------------- *) - [] + [] member public this.``Multi.DotNet.StaticMethod``() = let fileContents = """System.Console.WriteLine("Today is {0:dd MMM yyyy}",(*Mark*)System.DateTime.Today)""" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["string";"obj"]) - [] + [] member public this.``Multi.DotNet.StaticMethod.WithinClassMember``() = let fileContents = """ type Widget(z) = @@ -1646,18 +1564,17 @@ We really need to rewrite some code paths here to use the real parse tree rather 45""" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["string";"System.Globalization.NumberStyles"]) - [] - [] + [] member public this.``Multi.DotNet.StaticMethod.WithinLambda``() = let fileContents = """let z = fun x -> x + System.Int16.Parse("",(*Mark*)""" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["string";"System.Globalization.NumberStyles"]) - [] + [] member public this.``Multi.DotNet.StaticMethod.WithinLambda2``() = let fileContents = "let _ = fun file -> new System.IO.FileInfo((*Mark*)" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["string"]]) - [] + [] member public this.``Multi.DotNet.InstanceMethod``() = let fileContents = """ let s = "Hello" @@ -1665,18 +1582,17 @@ We really need to rewrite some code paths here to use the real parse tree rather this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["int";"int"]) (* Common functions for multi-parameterinfo tests -------------------------------------------------- *) - [] - [] + [] member public this.``Multi.DotNet.Constructor``() = let fileContents = "let _ = new System.DateTime(2010,12,(*Mark*)" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["int";"int";"int"]) - [] + [] member public this.``Multi.Constructor.WithinObjectExpression``() = let fileContents = "let _ = { new System.Object((*Mark*)) with member _.GetHashCode() = 2}" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",[]) - [] + [] member public this.``Multi.Function.InTheClassMember``() = let fileContents = """ type Foo() = @@ -1687,14 +1603,14 @@ We really need to rewrite some code paths here to use the real parse tree rather member this.A(a : string, b:int) = ()""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int";"int"]]) - [] + [] member public this.``Multi.ParamAsTupleType``() = let fileContents = """ let tuple((a : int, b : int), c : int) = a * b + c let result = tuple((1, 2)(*Mark*), 3)""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int * int";"int"]]) - [] + [] member public this.``Multi.ParamAsCurryType``() = let fileContents = """ let multi (x : float) (y : float) = 0 @@ -1702,7 +1618,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let rtnValue = sum(multi (1.0(*Mark*)) 3.0, 5)""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["float"]]) - [] + [] member public this.``Multi.MethodInMatchCause``() = let fileContents = """ let rec f l = @@ -1711,8 +1627,7 @@ We really need to rewrite some code paths here to use the real parse tree rather | x :: xs -> f xs""" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["string";"obj"]) - [] - [] + [] member public this.``Regression.Multi.IndexerProperty.Bug93945``() = let fileContents = """ type Year2(year : int) = @@ -1729,8 +1644,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let randomDay = O'seven.[12,(*Mark*)""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int";"int"]]) - [] - [] + [] member public this.``Regression.Multi.ExplicitAnnotate.Bug93188``() = let fileContents = """ type LiveAnimalAttribute(a : int, b: string) = @@ -1740,7 +1654,7 @@ We really need to rewrite some code paths here to use the real parse tree rather type Wombat() = class end""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int";"string"]]) - [] + [] member public this.``Multi.Function.WithRecordType``() = let fileContents = """ type Vector = @@ -1749,7 +1663,7 @@ We really need to rewrite some code paths here to use the real parse tree rather foo(12, { X = 10.0; Y = (*Mark*)20.0; Z = 30.0 })""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int";"Vector"]]) - [] + [] member public this.``Multi.Function.AsParameter``() = let fileContents = """ let isLessThanZero x = (x < 0) @@ -1761,15 +1675,14 @@ We really need to rewrite some code paths here to use the real parse tree rather let _ = Option.get(containsNegativeNumbers [6; 20; (*Mark*)8; 45; 5])""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int list"]]) - [] - [] + [] member public this.``Multi.Function.WithOptionType``() = let fileContents = """ let foo( a : int option, b : string ref) = 0 let _ = foo(Some(12),(*Mark*)""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int option";"string ref"]]) - [] + [] member public this.``Multi.Function.WithOptionType2``() = let fileContents = """ let multi (x : float) (y : float) = x * y @@ -1778,8 +1691,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let rtnOption = options(Some(sum(1, 3)), (*Mark*)Some(multi 3.1 5.0)) """ this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int option";"float option"]]) - [] - [] + [] member public this.``Multi.Function.WithRefType``() = let fileContents = """ let foo( a : int ref, b : string ref) = 0 @@ -1788,12 +1700,12 @@ We really need to rewrite some code paths here to use the real parse tree rather (* Overload list/Adjust method's param for multi-parameterinfo tests ------------------------------ *) - [] + [] member public this.``Multi.OverloadMethod.OrderedParameters``() = let fileContents = "new System.DateTime(2000,12,(*Mark*)" this.VerifyParameterInfoOverloadMethodIndex(fileContents,"(*Mark*)",3(*The fourth method*),["int";"int";"int"]) - [] + [] member public this.``Multi.Overload.WithSameParameterCount``() = let fileContents = """ type Foo() = @@ -1803,7 +1715,7 @@ We really need to rewrite some code paths here to use the real parse tree rather foo.A1(1,1,(*Mark*)""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int";"int";"string";"bool"];["int";"string";"int";"bool"]]) - [] + [] member public this.``ExtensionMethod.Overloads``() = let fileContents = """ module MyCode = @@ -1819,8 +1731,7 @@ We really need to rewrite some code paths here to use the real parse tree rather foo.Method((*Mark*)""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["string"];["int"]]) - [] - [] + [] member public this.``ExtensionProperty.Overloads``() = let fileContents = """ module MyCode = @@ -1838,68 +1749,66 @@ We really need to rewrite some code paths here to use the real parse tree rather (* Generic functions for multi-parameterinfo tests ------------------------------------------------ *) - [] + [] member public this.``Multi.Generic.ExchangeInt``() = let fileContents = "System.Threading.Interlocked.Exchange(123,(*Mark*)" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["byref";"int"]) - [] + [] member public this.``Multi.Generic.Exchange.``() = let fileContents = "System.Threading.Interlocked.Exchange(12.0,(*Mark*)" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["byref";"float"]) - [] + [] member public this.``Multi.Generic.ExchangeUnder``() = let fileContents = "System.Threading.Interlocked.Exchange<_> (obj,(*Mark*)" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["byref";"obj"]) - [] + [] member public this.``Multi.Generic.Dictionary``() = let fileContents = "System.Collections.Generic.Dictionary<_, option>(12,(*Mark*)" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["int";"System.Collections.Generic.IEqualityComparer"]) - [] - [] + [] member public this.``Multi.Generic.HashSet``() = let fileContents = "System.Collections.Generic.HashSet({ 1 ..12 },(*Mark*)" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["Seq<'a>";"System.Collections.Generic.IEqualityComparer<'a>"]) - [] - [] + [] member public this.``Multi.Generic.SortedList``() = let fileContents = "System.Collections.Generic.SortedList<_,option> (12,(*Mark*)" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["int";"System.Collections.Generic.IComparer<'TKey>"]) (* No Param Info Shown for multi-parameterinfo tests ---------------------------------------------- *) - [] + [] member public this.``ParameterInfo.Multi.NoParameterInfo.InComments``() = let fileContents = "//let _ = System.Object((*Mark*))" this.VerifyNoParameterInfoAtStartOfMarker(fileContents,"(*Mark*)") - [] + [] member public this.``Multi.NoParameterInfo.InComments2``() = let fileContents = """(*System.Console.WriteLine((*Mark*)"Test on Fsharp style comments.")*)""" this.VerifyNoParameterInfoAtStartOfMarker(fileContents,"(*Mark*)") - [] + [] member public this.``Multi.NoParameterInfo.OnFunctionDeclaration``() = let fileContents = "let Foo(x : int, (*Mark*)b : string) = ()" this.VerifyNoParameterInfoAtStartOfMarker(fileContents,"(*Mark*)") - [] + [] member public this.``Multi.NoParameterInfo.WithinString``() = let fileContents = """let s = "new System.DateTime(2000,12(*Mark*)" """ this.VerifyNoParameterInfoAtStartOfMarker(fileContents,"(*Mark*)") - [] + [] member public this.``Multi.NoParameterInfo.OnProperty``() = let fileContents = """ let s = "Hello" let _ = s.Length(*Mark*)""" this.VerifyNoParameterInfoAtStartOfMarker(fileContents,"(*Mark*)") - [] + [] member public this.``Multi.NoParameterInfo.OnValues``() = let fileContents = """ type Foo = class @@ -1911,13 +1820,13 @@ We really need to rewrite some code paths here to use the real parse tree rather (* Regression tests/negative tests for multi-parameterinfos --------------------------------------- *) // To be added when the bugs are fixed... - [] + [] //[] member public this.``Regression.ParameterWithOperators.Bug90832``() = let fileContents = """System.Console.WriteLine("This(*Mark*) is a" + " bug.")""" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["string"]) - [] + [] member public this.``Regression.OptionalArguments.Bug4042``() = let fileContents = """ module ParameterInfo @@ -1932,7 +1841,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let tt = TT((*Mark*)""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int";"int"]]) - [] + [] //[] member public this.``Regression.ParameterFirstTypeOpenParen.Bug90798``() = let fileContents = """ @@ -1942,7 +1851,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let p = 10""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["'Arg -> Async<'T>"]]) - [] + [] // regression test for bug 3878: no parameter info triggered by "(" member public this.``Regression.NoParameterInfoTriggeredByOpenBrace.Bug3878``() = let fileContents = """ @@ -1954,7 +1863,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let y = 1""" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",[""]) - [] + [] // regression test for bug 4495 : Should alway sort method lists in order of argument count member public this.``Regression.MethodSortedByArgumentCount.Bug4495.Case1``() = let fileContents = """ @@ -1964,7 +1873,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let m = a1.GetType("System.Decimal").GetConstructor((*Mark*)null)""" this.VerifyParameterInfoOverloadMethodIndex(fileContents,"(*Mark*)",0,["System.Type array"]) - [] + [] member public this.``Regression.MethodSortedByArgumentCount.Bug4495.Case2``() = let fileContents = """ module ParameterInfo @@ -1976,8 +1885,7 @@ We really need to rewrite some code paths here to use the real parse tree rather "System.Type array"; "System.Reflection.ParameterModifier array"]) - [] - [] + [] member public this.``BasicBehavior.WithReference``() = let fileContents = """ open System.ServiceModel @@ -1991,22 +1899,20 @@ We really need to rewrite some code paths here to use the real parse tree rather let expected = ["System.Type";"System.Uri []"] AssertMethodGroupContain(methodstr,expected) - [] + [] member public this.``BasicBehavior.CommonFunction``() = let fileContents = """ let f(x) = 1 f((*Mark*))""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["'a"]]) - [] + [] member public this.``BasicBehavior.DotNet.Static``() = let fileContents = """System.String.Format((*Mark*)""" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["string";"obj array"]) (*------------------------------------------IDE Query automation start -------------------------------------------------*) - [] - [] - [] + [] // ParamInfo works normally for calls as query operator arguments // works fine In nested queries member public this.``Query.InNestedQuery``() = @@ -2025,11 +1931,9 @@ We really need to rewrite some code paths here to use the real parse tree rather this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Marker1*)",["obj"],queryAssemblyRefs) this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Marker2*)",["string";"obj array"],queryAssemblyRefs) - [] - [] + [] // ParamInfo works normally for calls as query operator arguments // ParamInfo Still works when an error exists - [] member public this.``Query.WithErrors``() = let fileContents = """ let tuples = [ (1, 8, 9); (56, 45, 3)] @@ -2041,10 +1945,8 @@ We really need to rewrite some code paths here to use the real parse tree rather }""" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Marker*)",["obj"],queryAssemblyRefs) - [] - [] + [] // ParamInfo works normally for calls as query operator arguments - [] member public this.``Query.OperatorWithParentheses``() = let fileContents = """ type Product() = @@ -2070,8 +1972,7 @@ We really need to rewrite some code paths here to use the real parse tree rather this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Marker1*)",[],queryAssemblyRefs) this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Marker2*)",[],queryAssemblyRefs) - [] - [] + [] // ParamInfo works normally for calls as query operator arguments // ParamInfo Still works when there is an optional argument member public this.``Query.OptionalArgumentsInQuery``() = @@ -2094,11 +1995,9 @@ We really need to rewrite some code paths here to use the real parse tree rather }""" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Marker*)",["int";"int"],queryAssemblyRefs) - [] - [] + [] // ParamInfo works normally for calls as query operator arguments // ParamInfo Still works when there are overload methods with the same param count - [] member public this.``Query.OverloadMethod.InQuery``() = let fileContents = """ let numbers = [ 1;2; 8; 9; 15; 23; 3; 42; 4;0; 55;] @@ -2118,6 +2017,5 @@ We really need to rewrite some code paths here to use the real parse tree rather // Context project system -[] type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs index 1d62dd3c399..1df4a6a6413 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs @@ -3,21 +3,20 @@ namespace Tests.LanguageService.QuickInfo open System -open NUnit.Framework +open Xunit open Salsa.Salsa open Salsa.VsOpsUtils open UnitTests.TestLib.Salsa open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem +open Xunit [] module QuickInfoStandardSettings = let standard40AssemblyRefs = [ "System"; "System.Core"; "System.Numerics" ] let queryAssemblyRefs = [ "System.Xml.Linq"; "System.Core" ] -[] -[] type UsingMSBuild() = inherit LanguageServiceBaseTests() @@ -41,8 +40,8 @@ type UsingMSBuild() = let checkTooltip expected ((tooltip, span : TextSpan), (row, col)) = AssertContains(tooltip, expected) // cursor should be inside the span - Assert.IsTrue(row = (span.iStartLine + 1) && row = (span.iEndLine + 1), "Cursor should be one the same line with the tooltip span") - Assert.IsTrue(col >= span.iStartIndex && col <= span.iEndIndex, "Cursor should be located inside the span") + Assert.True(row = (span.iStartLine + 1) && row = (span.iEndLine + 1), "Cursor should be one the same line with the tooltip span") + Assert.True(col >= span.iStartIndex && col <= span.iEndIndex, "Cursor should be located inside the span") // (* Tests for QuickInfos ---------------------------------------------------------------- *) @@ -118,7 +117,7 @@ type UsingMSBuild() = let tooltip = time1 GetQuickInfoAtCursor file "Time of first tooltip" AssertContainsInOrder(tooltip, expectedExactOrder) - [] + [] member public this.``NestedTypesOrder``() = this.VerifyOrderOfNestedTypesInQuickInfo( source = "type t = System.Runtime.CompilerServices.RuntimeHelpers(*M*)", @@ -126,7 +125,7 @@ type UsingMSBuild() = expectedExactOrder = ["GetHashCode"; "GetObjectValue"] ) - [] + [] member public this.``Operators.TopLevel``() = let source = """ /// tooltip for operator @@ -137,10 +136,10 @@ type UsingMSBuild() = code = source, marker = "== \"\"", atStart = true, - f = (fun ((text, _), _) -> printfn "actual %s" text; Assert.IsTrue(text.Contains "tooltip for operator")) + f = (fun ((text, _), _) -> printfn "actual %s" text; Assert.True(text.Contains "tooltip for operator")) ) - [] + [] member public this.``Operators.Member``() = let source = """ type U = U @@ -153,10 +152,10 @@ type UsingMSBuild() = code = source, marker = "++ U", atStart = true, - f = (fun ((text, _), _) -> printfn "actual %s" text; Assert.IsTrue(text.Contains "tooltip for operator")) + f = (fun ((text, _), _) -> printfn "actual %s" text; Assert.True(text.Contains "tooltip for operator")) ) - [] + [] member public this.``QuickInfo.HiddenMember``() = // Tooltips showed hidden members - #50 let source = """ @@ -174,10 +173,10 @@ type UsingMSBuild() = code = source, marker = "ypeU =", atStart = true, - f = (fun ((text, _), _) -> printfn "actual %s" text; Assert.IsFalse(text.Contains "member _Print")) + f = (fun ((text, _), _) -> printfn "actual %s" text; Assert.False(text.Contains "member _Print")) ) - [] + [] member public this.``QuickInfo.ObsoleteMember``() = // Tooltips showed obsolete members - #50 let source = """ @@ -193,11 +192,10 @@ type UsingMSBuild() = code = source, marker = "ypeU =", atStart = true, - f = (fun ((text, _), _) -> printfn "actual %s" text; Assert.IsFalse(text.Contains "member Print1")) + f = (fun ((text, _), _) -> printfn "actual %s" text; Assert.False(text.Contains "member Print1")) ) - [] - [] + [] member public this.``QuickInfo.HideBaseClassMembersTP``() = let fileContents = "type foo = HiddenMembersInBaseClass.HiddenBaseMembersTP(*Marker*)" @@ -207,7 +205,7 @@ type UsingMSBuild() = expected = "type HiddenBaseMembersTP =\n inherit TPBaseTy", addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] + [] member public this.``QuickInfo.OverridenMethods``() = let source = """ type A() = @@ -231,10 +229,10 @@ type UsingMSBuild() = code = source, marker = marker, atStart = false, - f = (fun ((text : string, _), _) -> printfn "expected %s, actual %s" expected text; Assert.IsTrue (text.Contains(expected))) + f = (fun ((text : string, _), _) -> printfn "expected %s, actual %s" expected text; Assert.True (text.Contains(expected))) ) - [] + [] member public this.``QuickInfoForQuotedIdentifiers``() = let source = """ /// The fff function @@ -246,7 +244,7 @@ type UsingMSBuild() = for i = 1 to (identifier.Length - 1) do let marker = "+ " + (identifier.Substring(0, i)) this.CheckTooltip (source, marker, false, checkTooltip "gg gg") - [] + [] member public this.``QuickInfoSingleCharQuotedIdentifier``() = let source = """ let ``x`` = 10 @@ -254,7 +252,7 @@ type UsingMSBuild() = """ this.CheckTooltip(source, "x``|>", true, checkTooltip "x") - [] + [] member public this.QuickInfoForTypesWithHiddenRepresentation() = let source = """ let x = Async.AsBeginEnd @@ -277,9 +275,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.CheckTooltip(source, "Asyn", false, checkTooltip expectedTooltip) - [] - [] - [] + [] member public this.``TypeProviders.NestedTypesOrder``() = let code = "type t = N1.TypeWithNestedTypes(*M*)" let tpReference = PathRelativeToTestAssembly( @"DummyProviderForLanguageServiceTesting.dll") @@ -290,7 +286,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") extraRefs = [tpReference] ) - [] + [] member public this.``GetterSetterInsideInterfaceImpl.ThisOnceAsserted``() = let fileContent =""" type IFoo = @@ -304,7 +300,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.AssertQuickInfoContainsAtStartOfMarker(fileContent, "id", "Operators.id") //regression test for bug 3184 -- intellisense should normalize to ¡°int[]¡± so that [] is not mistaken for list. - [] + [] member public this.IntArrayQuickInfo() = let fileContents = """ @@ -315,7 +311,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.AssertQuickInfoContainsAtStartOfMarker (fileContents, "y(*MInt[]*)", "int array") //Verify no quickinfo -- link name string have - [] + [] member public this.LinkNameStringQuickInfo() = let fileContents = """ @@ -326,11 +322,8 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.AssertQuickInfoContainsAtStartOfMarker (fileContents, "\"x\"(*Marker1*)", "") this.AssertQuickInfoContainsAtStartOfMarker (fileContents, "\"y\"(*Marker2*)", "") - [] - [] - [] + [] //This is to test the correct TypeProvider Type message is shown or not in the TypeProviderXmlDocAttribute - [] member public this.``TypeProvider.XmlDocAttribute.Type.Comment``() = let fileContents = """ @@ -339,10 +332,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.AssertQuickInfoContainsAtStartOfMarker (fileContents, "T(*Marker*)", "This is a synthetic type created by me!", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithAdequateComment.dll")]) - [] - [] - [] - [] + [] //This is to test for long message in the TypeProviderXmlDocAttribute for TypeProvider Type member public this.``TypeProvider.XmlDocAttribute.Type.WithLongComment``() = @@ -353,10 +343,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic type created by me!. Which is used to test the tool tip of the typeprovider type to check if it shows the right message or not.", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLongComment.dll")]) - [] - [] - [] - [] + [] //This is to test when the message is null in the TypeProviderXmlDocAttribute for TypeProvider Type member public this.``TypeProvider.XmlDocAttribute.Type.WithNullComment``() = @@ -367,10 +354,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "type T =\n new: unit -> T\n static member M: unit -> int []\n static member StaticProp: decimal\n member Event1: EventHandler", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithNullComment.dll")]) - [] - [] - [] - [] + [] //This is to test when there is empty message from the TypeProviderXmlDocAttribute for TypeProvider Type member public this.``TypeProvider.XmlDocAttribute.Type.WithEmptyComment``() = @@ -382,10 +366,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithEmptyComment.dll")]) - [] - [] - [] - [] + [] //This is to test the multi-language in the TypeProviderXmlDocAttribute for TypeProvider Type member public this.``TypeProvider.XmlDocAttribute.Type.LocalizedComment``() = @@ -396,11 +377,8 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic type Localized! ኤፍ ሻርፕ", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLocalizedComment.dll")]) - [] - [] - [] + [] //This is to test the correct TypeProvider Constructor message is shown or not in the TypeProviderXmlDocAttribute - [] member public this.``TypeProvider.XmlDocAttribute.Constructor.Comment``() = let fileContents = """ @@ -409,10 +387,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.AssertQuickInfoContainsAtStartOfMarker (fileContents, "T(*Marker*)", "This is a synthetic .ctor created by me for N.T", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithAdequateComment.dll")]) - [] - [] - [] - [] + [] //This is to test for long message in the TypeProviderXmlDocAttribute for TypeProvider Constructor member public this.``TypeProvider.XmlDocAttribute.Constructor.WithLongComment``() = @@ -423,10 +398,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic .ctor created by me for N.T. Which is used to test the tool tip of the typeprovider Constructor to check if it shows the right message or not.", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLongComment.dll")]) - [] - [] - [] - [] + [] //This is to test when the message is null in the TypeProviderXmlDocAttribute for TypeProvider Constructor member public this.``TypeProvider.XmlDocAttribute.Constructor.WithNullComment``() = @@ -437,10 +409,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "N.T() : N.T", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithNullComment.dll")]) - [] - [] - [] - [] + [] //This is to test when there is empty message from the TypeProviderXmlDocAttribute for TypeProvider Constructor member public this.``TypeProvider.XmlDocAttribute.Constructor.WithEmptyComment``() = @@ -451,10 +420,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "N.T() : N.T", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithEmptyComment.dll")]) - [] - [] - [] - [] + [] //This is to test the multi-language in the TypeProviderXmlDocAttribute for TypeProvider Constructor member public this.``TypeProvider.XmlDocAttribute.Constructor.LocalizedComment``() = @@ -466,10 +432,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLocalizedComment.dll")]) - [] - [] - [] - [] + [] //This is to test the correct TypeProvider event message is shown or not in the TypeProviderXmlDocAttribute member public this.``TypeProvider.XmlDocAttribute.Event.Comment``() = @@ -481,10 +444,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic *event* created by me for N.T", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithAdequateComment.dll")]) - [] - [] - [] - [] + [] //This is to test the multi-language in the TypeProviderXmlDocAttribute for TypeProvider Event member public this.``TypeProvider.XmlDocAttribute.Event.LocalizedComment``() = @@ -496,8 +456,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic *event* Localized! ኤፍ ሻርፕ for N.T", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLocalizedComment.dll")]) - [] - [] + [] //This is to test the multi-language in the TypeProviderXmlDocAttribute for TypeProvider Event member public this.``TypeProvider.ParamsAttributeTest``() = @@ -506,10 +465,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.AssertQuickInfoContainsAtEndOfMarker (fileContents, "Spl", "[] separator") - [] - [] - [] - [] + [] //This is to test for long message in the TypeProviderXmlDocAttribute for TypeProvider Event member public this.``TypeProvider.XmlDocAttribute.Event.WithLongComment``() = @@ -521,10 +477,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic *event* created by me for N.T. Which is used to test the tool tip of the typeprovider Event to check if it shows the right message or not.!", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLongComment.dll")]) - [] - [] - [] - [] + [] //This is to test when the message is null in the TypeProviderXmlDocAttribute for TypeProvider Event member public this.``TypeProvider.XmlDocAttribute.Event.WithNullComment``() = @@ -536,10 +489,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "member N.T.Event1: IEvent", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithNullComment.dll")]) - [] - [] - [] - [] + [] //This is to test when there is empty message from the TypeProviderXmlDocAttribute for TypeProvider Event member public this.``TypeProvider.XmlDocAttribute.Event.WithEmptyComment``() = @@ -552,10 +502,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithEmptyComment.dll")]) - [] - [] - [] - [] + [] //This is to test the correct TypeProvider Method message is shown or not in the TypeProviderXmlDocAttribute member public this.``TypeProvider.XmlDocAttribute.Method.Comment``() = @@ -566,10 +513,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic *method* created by me!!", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithAdequateComment.dll")]) - [] - [] - [] - [] + [] //This is to test the multi-language in the TypeProviderXmlDocAttribute for TypeProvider Method member public this.``TypeProvider.XmlDocAttribute.Method.LocalizedComment``() = @@ -580,10 +524,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic *method* Localized! ኤፍ ሻርፕ", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLocalizedComment.dll")]) - [] - [] - [] - [] + [] //This is to test for long message in the TypeProviderXmlDocAttribute for TypeProvider Method member public this.``TypeProvider.XmlDocAttribute.Method.WithLongComment``() = @@ -594,10 +535,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic *method* created by me!!. Which is used to test the tool tip of the typeprovider Method to check if it shows the right message or not.!", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLongComment.dll")]) - [] - [] - [] - [] + [] //This is to test when the message is null in the TypeProviderXmlDocAttribute for TypeProvider Method member public this.``TypeProvider.XmlDocAttribute.Method.WithNullComment``() = @@ -608,10 +546,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "N.T.M() : int array", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithNullComment.dll")]) - [] - [] - [] - [] + [] //This is to test when there is empty message from the TypeProviderXmlDocAttribute for TypeProvider Method member public this.``TypeProvider.XmlDocAttribute.Method.WithEmptyComment``() = @@ -623,10 +558,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithEmptyComment.dll")]) - [] - [] - [] - [] + [] //This is to test the correct TypeProvider Property message is shown or not in the TypeProviderXmlDocAttribute member public this.``TypeProvider.XmlDocAttribute.Property.Comment``() = @@ -637,10 +569,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic *property* created by me for N.T", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithAdequateComment.dll")]) - [] - [] - [] - [] + [] //This is to test the multi-language in the TypeProviderXmlDocAttribute for TypeProvider Property member public this.``TypeProvider.XmlDocAttribute.Property.LocalizedComment``() = @@ -651,10 +580,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic *property* Localized! ኤፍ ሻርፕ for N.T", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLocalizedComment.dll")]) - [] - [] - [] - [] + [] //This is to test for long message in the TypeProviderXmlDocAttribute for TypeProvider Property member public this.``TypeProvider.XmlDocAttribute.Property.WithLongComment``() = @@ -665,10 +591,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic *property* created by me for N.T. Which is used to test the tool tip of the typeprovider Property to check if it shows the right message or not.!", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLongComment.dll")]) - [] - [] - [] - [] + [] //This is to test when the message is null in the TypeProviderXmlDocAttribute for TypeProvider Property member public this.``TypeProvider.XmlDocAttribute.Property.WithNullComment``() = @@ -679,10 +602,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "property N.T.StaticProp: decimal", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithNullComment.dll")]) - [] - [] - [] - [] + [] //This is to test when there is empty message from the TypeProviderXmlDocAttribute for TypeProvider Property member public this.``TypeProvider.XmlDocAttribute.Property.WithEmptyComment``() = @@ -694,10 +614,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithEmptyComment.dll")]) - [] - [] - [] - [] + [] //This test case Verify that when Hover over foo the correct quickinfo is displayed for TypeProvider static parameter //Dummy Type Provider exposes a parametric type (N1.T) that takes 2 static params (string * int) member public this.``TypeProvider.StaticParameters.Correct``() = @@ -711,9 +628,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") expected = "type foo = N1.T", addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] + [] //This test case Verify that when Hover over foo the correct quickinfo is displayed //Dummy Type Provider exposes a parametric type (N1.T) that takes 2 static params (string * int) //As you can see this is "Negative Case" to check that when given invalid static Parameter quickinfo shows "type foo = obj" @@ -728,9 +643,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") expected = "type foo", addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] + [] //This test case Verify that when Hover over foo the XmlComment is shown in quickinfo //Dummy Type Provider exposes a parametric type (N1.T) that takes 2 static params (string * int) member public this.``TypeProvider.StaticParameters.XmlComment``() = @@ -745,10 +658,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") expected = "XMLComment", addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] member public this.``TypeProvider.StaticParameters.QuickInfo.OnTheErasedType``() = let fileContents = """type TTT = Samples.FSharp.RegexTypeProvider.RegexTyped< @"(?^\d{3})-(?\d{3}-\d{7}$)">""" this.AssertQuickInfoContainsAtStartOfMarker( @@ -757,10 +667,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") expected = "type TTT = Samples.FSharp.RegexTypeProvider.RegexTyped<...>\nFull name: File1.TTT", addtlRefAssy = ["System"; PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] member public this.``TypeProvider.StaticParameters.QuickInfo.OnNestedErasedTypeProperty``() = let fileContents = """ type T = Samples.FSharp.RegexTypeProvider.RegexTyped< @"(?^\d{3})-(?\d{3}-\d{7}$)"> @@ -774,7 +681,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") addtlRefAssy = ["System"; PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) // Regression for 2948 - [] + [] member public this.TypeRecordQuickInfo() = let fileContents = """namespace NS @@ -783,7 +690,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.InfoInDeclarationTestQuickInfoImplWithTrim fileContents "Re(*MarkerRecord*)" expectedQuickinfoTypeRecord - [] + [] member public this.``QuickInfo.LetBindingsInTypes``() = let code = """ @@ -793,7 +700,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.AssertQuickInfoContainsAtEndOfMarker(code, "let ff", "val fff: n: int -> int") // Regression for 2494 - [] + [] member public this.TypeConstructorQuickInfo() = let fileContents = """ @@ -827,7 +734,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.InfoInDeclarationTestQuickInfoImplWithTrim fileContents "pq(*MarkerVal*)" expectedquickinfoVal this.InfoInDeclarationTestQuickInfoImplWithTrim fileContents "singleton(*MarkerLastLine*)" expectedquickinfoLastLine - [] + [] member public this.NamedDUFieldQuickInfo() = let fileContents = """ @@ -851,60 +758,60 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.InfoInDeclarationTestQuickInfoImplWithTrim fileContents "Case3(*MarkerCase3*)" expectedquickinfoCase3 this.InfoInDeclarationTestQuickInfoImplWithTrim fileContents "NamedExn(*MarkerException*)" expectedquickinfoException - [] + [] member public this.``EnsureNoAssertFromBadParserRangeOnAttribute``() = let fileContents = """ [] Types foo = int""" this.AssertQuickInfoContainsAtEndOfMarker (fileContents, "ype", "") // just want to ensure there is no assertion fired by the parse tree walker - [] + [] member public this.``ShiftKeyDown``() = ShiftKeyDown(this.VS) this.AssertQuickInfoContainsAtEndOfMarker ("""#light""","#ligh","") - [] + [] member public this.``ActivePatterns.Declaration``() = this.AssertQuickInfoContainsAtEndOfMarker ("""let ( |One|Two| ) x = One(x+1)""","ne|Tw","int -> Choice") - [] + [] member public this.``ActivePatterns.Result``() = this.AssertQuickInfoContainsAtEndOfMarker ("""let ( |One|Two| ) x = One(x+1)""","= On","active pattern result One: int -> Choice") - [] + [] member public this.``ActivePatterns.Value``() = this.AssertQuickInfoContainsAtEndOfMarker ("""let ( |One|Two| ) x = One(x+1) let patval = (|One|Two|) // use""","= (|On","int -> Choice") - [] + [] member public this.``Regression.InDeclaration.Bug3176a``() = this.AssertQuickInfoContainsAtEndOfMarker ("""type T<'a> = { aaaa : 'a; bbbb : int } ""","aa","aaaa") - [] + [] member public this.``Regression.InDeclaration.Bug3176c``() = this.AssertQuickInfoContainsAtEndOfMarker ("""type C = val aaaa: int""","aa","aaaa") - [] + [] member public this.``Regression.InDeclaration.Bug3176d``() = this.AssertQuickInfoContainsAtEndOfMarker ("""type DU<'a> = | DULabel of 'a""","DULab","DULabel") - [] + [] member public this.``Regression.Generic.3773a``() = this.AssertQuickInfoContainsAtEndOfMarker ("""let rec M2<'a>(a:'a) = M2(a)""","let rec M","val M2: a: 'a -> obj") // Before this fix, if the user hovered over 'cccccc' they would see 'Yield' - [] + [] member public this.``Regression.ComputationExpressionMemberAppearingInQuickInfo``() = this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker """ @@ -921,7 +828,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") // they would see a quickinfo for any available function named get or set. // The tests below define a get function with 'let' and then test to make sure that // this isn't the get seen in the tool tip. - [] + [] member public this.``Regression.AccessorMutator.Bug4903a``() = this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker """namespace CountChocula @@ -932,7 +839,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") and set(value:int) : unit = ()""" "with g" "string" - [] + [] member public this.``Regression.AccessorMutator.Bug4903d``() = this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker """namespace CountChocula @@ -943,7 +850,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") and set(value:int) : unit = ()""" "AMetho" "string" - [] + [] member public this.``Regression.AccessorMutator.Bug4903b``() = this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker """namespace CountChocula @@ -954,7 +861,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") and set(value:int) : unit = ()""" "and s" "seq" - [] + [] member public this.``Regression.AccessorMutator.Bug4903c``() = this.AssertQuickInfoContainsAtEndOfMarker ("""namespace CountChocula @@ -966,7 +873,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "let g","string") - [] + [] member public this.``ParamsArrayArgument.OnType``() = this.AssertQuickInfoContainsAtEndOfMarker (""" @@ -975,7 +882,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") let r = A.Foo(42)""" , "type A","[] a:" ) - [] + [] member public this.``ParamsArrayArgument.OnMethod``() = this.AssertQuickInfoContainsAtEndOfMarker (""" @@ -984,7 +891,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") let r = A.Foo(42)""" , "A.Foo","[] a:" ) - [] + [] member public this.``Regression.AccessorMutator.Bug4903e``() = this.AssertQuickInfoContainsAtEndOfMarker ("""namespace CountChocula @@ -995,7 +902,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") and set(value:int) : unit = ()""" , "member source.Pr","Prop" ) - [] + [] member public this.``Regression.AccessorMutator.Bug4903f``() = this.AssertQuickInfoContainsAtEndOfMarker ("""namespace CountChocula @@ -1006,7 +913,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") and set(value:int) : unit = ()""" , "member source.Pr","int" ) - [] + [] member public this.``Regression.AccessorMutator.Bug4903g``() = this.AssertQuickInfoContainsAtEndOfMarker ("""namespace CountChocula @@ -1017,13 +924,13 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") and set(value:int) : unit = ()""" , "member sou","source" ) - [] + [] member public this.``Regression.RecursiveDefinition.Generic.3773b``() = this.AssertQuickInfoContainsAtEndOfMarker ("""let rec M1<'a>(a:'a) = M1(0)""","let rec M","val M1: a: int -> 'a") //regression test for bug Dev11:138110 - "F# language service hover tip for ITypeProvider does now show Invalidate event" - [] + [] member public this.``Regression.ImportedEvent.138110``() = let fileContents = """ open Microsoft.FSharp.Core.CompilerServices @@ -1036,17 +943,17 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate - [] + [] member public this.``Declaration.CyclicalDeclarationDoesNotCrash``() = this.AssertQuickInfoContainsAtEndOfMarker ("""type (*1*)A = int * (*2*)A ""","(*2*)","type A") - [] + [] member public this.``JustAfterIdentifier``() = this.AssertQuickInfoContainsAtEndOfMarker ("""let f x = x + 1 ""","let f","int") - [] + [] member public this.``FrameworkClass``() = let fileContent = """let l = new System.Collections.Generic.List()""" let marker = "Generic.List" @@ -1057,14 +964,14 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent marker "get_Count" this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent marker "set_Count" - [] + [] member public this.``FrameworkClassNoMethodImpl``() = this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker """let l = new System.Collections.Generic.LinkedList()""" "Generic.LinkedList" "System.Collections.ICollection.ISynchronized" // Bug 5092: A framework class contained a private method impl // Disabled due to issue #11752 --- https://github.com/dotnet/fsharp/issues/11752 - //[] + //[] member public this.``Regression.ModulesFromExternalLibrariesBug5785``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1084,7 +991,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate SetConfigurationAndPlatform(projectLib, "Debug|AnyCPU") // we must set config/platform when building with ProjectReferences AddProjectReference(project, projectLib) let br = BuildTarget(projectLib, "Build") // build the dependent library - Assert.IsTrue(br.BuildSucceeded, "build should succeed") + Assert.True(br.BuildSucceeded, "build should succeed") let file = OpenFile(project,"App.fs") TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. @@ -1109,13 +1016,13 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate /// Even though we don't show squiggles, some types will still be known. For example, System.String. - [] + [] member public this.``OrphanFs.BaselineIntellisenseStillWorks``() = this.AssertQuickInfoContainsAtEndOfMarker ("""let astring = "Hello" ""","let astr","string") /// FEATURE: User may hover over a type or identifier and get basic information about it in a tooltip. - [] + [] member public this.``Basic``() = let fileContent = """type (*bob*)Bob() = let x = 1""" @@ -1123,7 +1030,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,marker,"Bob =") this.AssertQuickInfoContainsAtEndOfMarker(fileContent,marker,"Bob =") - [] + [] member public this.``ModuleDefinition.ModuleNoNewLines``() = let fileContent = """module XXX type t = C3 @@ -1137,7 +1044,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"YY","module YYY\n\nfrom XXX") this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"ZZ","module ZZZ\n\nfrom XXX\n\nDoc") - [] + [] member public this.``IdentifierWithTick``() = let code = ["#light" @@ -1154,14 +1061,13 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate let tooltip = GetQuickInfoAtCursor file AssertContains(tooltip,"val x': string") - [] + [] member public this.``NegativeTest.CharLiteralNotConfusedWithIdentifierWithTick``() = let fileContent = """let x = 1" let y = 'x' """ this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"'x","") // no tooltips for char literals - [] - [] + [] member public this.``QueryExpression.QuickInfoSmokeTest1``() = let fileContent = """let q = query { for x in ["1"] do select x }""" this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"selec","custom operation: select", addtlRefAssy=standard40AssemblyRefs) @@ -1169,8 +1075,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"selec","Calls" , addtlRefAssy=standard40AssemblyRefs) this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"selec","Linq.QueryBuilder.Select" , addtlRefAssy=standard40AssemblyRefs ) - [] - [] + [] member public this.``QueryExpression.QuickInfoSmokeTest2``() = let fileContent = """let q = query { for x in ["1"] do join y in ["2"] on (x = y); select (x,y) }""" this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"joi","custom operation: join" , addtlRefAssy=standard40AssemblyRefs ) @@ -1178,8 +1083,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"joi","Calls" , addtlRefAssy=standard40AssemblyRefs ) this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"joi","Linq.QueryBuilder.Join" , addtlRefAssy=standard40AssemblyRefs ) - [] - [] + [] member public this.``QueryExpression.QuickInfoSmokeTest3``() = let fileContent = """let q = query { for x in ["1"] do groupJoin y in ["2"] on (x = y) into g; select (x,g) }""" this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"groupJoin","custom operation: groupJoin" , addtlRefAssy=standard40AssemblyRefs ) @@ -1189,7 +1093,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate /// Hovering over a literal string should not show data tips for variable names that appear in the string - [] + [] member public this.``StringLiteralWithIdentifierLookALikes.Bug2360_A``() = let fileContent = """let y = 1 let f x = "x" @@ -1197,13 +1101,13 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent "f x = \"" "val" /// Hovering over a literal string should not show data tips for variable names that appear in the string - [] + [] member public this.``Regression.StringLiteralWithIdentifierLookALikes.Bug2360_B``() = let fileContent = """let y = 1""" this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"let ","int") /// FEATURE: Intellisense information from types in earlier files in the project is available in subsequent files. - [] + [] member public this.``AcrossMultipleFiles``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1231,7 +1135,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate AssertContains(tooltip,"File1.Bob") /// FEATURE: Linked files work - [] + [] member public this.``AcrossLinkedFiles``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1258,7 +1162,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate printf "Second-%s\n" tooltip AssertContains(tooltip,"Link.Bob") - [] + [] member public this.``TauStarter``() = let code = ["#light" @@ -1278,12 +1182,12 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate MoveCursorToEndOfMarker(file,"(*Scenario021*)") let tooltip = time1 GetQuickInfoAtCursor file "Time of first tooltip" printf "First-%s\n" tooltip - Assert.IsTrue(tooltip.Contains("Bob =")) + Assert.True(tooltip.Contains("Bob =")) MoveCursorToEndOfMarker(file,"(*Scenario022*)") let tooltip = time1 GetQuickInfoAtCursor file "Time of first tooltip" printf "First-%s\n" tooltip - Assert.IsTrue(tooltip.Contains("Alice =")) + Assert.True(tooltip.Contains("Alice =")) member private this.QuickInfoResolutionTest lines queries = let code = [ yield "#light" @@ -1299,7 +1203,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate MoveCursorToEndOfMarker(file,marker) let tooltip = time1 GetQuickInfoAtCursor file "Time for tooltip" printf "QuickInfo at marker '%s' is '%s', expect '%s'\n" marker tooltip expectedText - Assert.IsTrue(tooltip.Contains(expectedText)) + Assert.True(tooltip.Contains(expectedText)) member public this.GetLongPathsTestCases() = ["let test0 = System.Console.In" @@ -1331,12 +1235,12 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ("type Test0e = System.Collections.Generic.","KeyNotFoundException","Generic.KeyNotFoundException"); // note resolves to type ] - [] + [] member public this.``LongPaths``() = let text,cases = this.GetLongPathsTestCases() this.QuickInfoResolutionTest text cases - [] + [] member public this.``Global.LongPaths``() = let text,cases = this.GetLongPathsTestCases() let replace (s:string) = s.Replace("System", "global.System") @@ -1348,7 +1252,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.QuickInfoResolutionTest text cases - [] + [] member public this.``TypeAndModuleReferences``() = this.QuickInfoResolutionTest ["let test1 = List.length" @@ -1364,7 +1268,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ("let test3 = (\"1\").","Length" ,"String.Length"); ("let test3b = (id \"1\").","Length" ,"String.Length") ] - [] + [] member public this.``ModuleNameAndMisc``() = this.QuickInfoResolutionTest ["module (*test3q*)MM3 =" @@ -1377,7 +1281,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ("let test4 = ","lock" ,"lock"); ("let (*test5*) ","ffff" ,"ffff") ] - [] + [] member public this.``MemberIdentifiers``() = this.QuickInfoResolutionTest ["type TestType() =" @@ -1393,7 +1297,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ("member (*test7*) xx.","QQQQ" ,"float"); ("let test8 = (TestType()).", "PPPP" , "PPPP") ] - [] + [] member public this.``IdentifiersForFields``() = this.QuickInfoResolutionTest ["type TestType9 = { XXX : int }" @@ -1403,7 +1307,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate [("type TestType9 = { ", "XXX" , "XXX: int"); ("let test11 = { ", "XXX" , "XXX");] - [] + [] member public this.``IdentifiersForUnionCases``() = this.QuickInfoResolutionTest ["type TestType10 = Case1 | Case2 of int" @@ -1415,7 +1319,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ("let test12 = (", "Case1" , "union case TestType10.Case1"); ("let test12 = (Case1,", "Case2" , "union case TestType10.Case2");] - [] + [] member public this.``IdentifiersInAttributes``() = this.QuickInfoResolutionTest ["[<(*test13*)System.CLSCompliant(true)>]" @@ -1429,7 +1333,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ("[<(*test13*)System.", "CLSCompliant" , "CLSCompliantAttribute"); ("[<(*test14*)", "CLSCompliant" , "CLSCompliantAttribute");] - [] + [] member public this.``ArgumentAndPropertyNames``() = this.QuickInfoResolutionTest ["type R = { mutable AAA : int }" @@ -1450,12 +1354,12 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ("let test16 = new System.Reflection.AssemblyName(", "assemblyName", "argument assemblyName")] /// Quickinfo was throwing an exception when the mouse was over the end of a line. - [] + [] member public this.``AtEndOfLine``() = let fileContent = """#light""" this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent "#light" "Bug:" - [] + [] member public this.``Regression.FieldRepeatedInToolTip.Bug3538``() = this.AssertIdentifierInToolTipExactlyOnce """#light @@ -1466,7 +1370,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate val mutable x : int""" "LayoutKind.Expl" "Explicit" - [] + [] member public this.``Regression.FieldRepeatedInToolTip.Bug3818``() = this.AssertIdentifierInToolTipExactlyOnce """#light @@ -1475,7 +1379,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate do ()""" "Inherite" "Inherited" // Get the tooltip at "Inherite" & Verify that it contains the 'Inherited' field exactly once - [] + [] member public this.``MethodAndPropTooltip``() = let fileContent = """#light open System @@ -1485,7 +1389,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertIdentifierInToolTipExactlyOnce fileContent "Console.Cle" "Clear" this.AssertIdentifierInToolTipExactlyOnce fileContent "Console.Back" "BackgroundColor" - [] + [] member public this.``Regression.StaticVsInstance.Bug3626``() = let fileContent = """ type Foo() = @@ -1501,7 +1405,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"(*string*) Hoo.Ba","Foo.Bar") this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"(*string*) Hoo.Ba","-> string") - [] + [] member public this.``Class.OnlyClassInfo``() = let fileContent = """type TT(x : int, ?y : int) = class end""" @@ -1509,7 +1413,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"type T","type TT") this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent "type T" "---" - //KnownFail: [] + //KnownFail: [] member public this.``Async.AsyncToolTips``() = let fileContent = """let a = async { @@ -1521,7 +1425,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"asy","AsyncBuilder") this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent "asy" "---" - [] + [] member public this.``Regression.Exceptions.Bug3723``() = let fileContent = """exception E3E of int * int exception E4E of (int * int) @@ -1533,7 +1437,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate // E5E is an alias - should contain name of the aliased exception this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"exception E5","E4E") - [] + [] member public this.``Regression.Classes.Bug4066``() = let fileContent = """type Foo() as this = do this |> ignore @@ -1550,7 +1454,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"Bar() = thi","this") this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent "Bar() = thi" "ref" - [] + [] member public this.``Regression.Classes.Bug2362``() = let fileContent = """let append mm nn = fun ac -> mm (nn ac)""" this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"let appen","mm: ('a -> 'b) -> nn: ('c -> 'a) -> ac: 'c -> 'b") @@ -1558,14 +1462,14 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"let append m","'a -> 'b") this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"let append mm n","'c -> 'a") - [] + [] member public this.``Regression.ModuleAlias.Bug3790a``() = let fileContent = """module ``Some`` = Microsoft.FSharp.Collections.List module None = Microsoft.FSharp.Collections.List""" this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent "module ``So" "Option" this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent "module No" "Option" - [] + [] member public this.``Regression.ModuleAlias.Bug3790b``() = let code = [ "#light" @@ -1578,14 +1482,14 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate let tooltip = GetQuickInfoAtCursor file AssertNotContains(tooltip, "Option") - [] + [] member public this.``Regression.ActivePatterns.Bug4100a``() = let fileContent = """let (|Lazy|) x = x match 0 with | Lazy y -> ()""" // Test quickinfo in place where the declaration is used this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent "with | Laz" "'?" // e.g. "Lazy: '?3107 -> '?3107", "Lazy: 'a -> 'a" will be fine - [] + [] member public this.``Regression.ActivePatterns.Bug4100b``() = let fileContent = """let Some (a:int) = a match None with @@ -1601,7 +1505,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate // This shouldn't find the function returning string but a pattern returning int this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent "| NSom" "int -> string" - [] + [] member public this.``Regression.ActivePatterns.Bug4103``() = let fileContent = """let (|Lazy|) x = x match 0 with | Lazy y -> ()""" @@ -1611,7 +1515,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate // This test checks that we don't show any tooltips for operators // (which is currently not supported, but it used to collide with support for active patterns) - [] + [] member public this.``Regression.NoTooltipForOperators.Bug4567``() = let fileContent = """let ( |+| ) a b = a + b let n = 1 |+| 2 @@ -1622,7 +1526,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"true |","") // Check to see that two distinct projects can be present - [] + [] member public this.``AcrossTwoProjects``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1643,16 +1547,16 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate MoveCursorToEndOfMarker(file1,"type (*bob*)Bob") let tooltip = time1 GetQuickInfoAtCursor file1 "Time of file1 tooltip" printf "Tooltip for file1:\n%s\n" tooltip - Assert.IsTrue(tooltip.Contains("Bob1 =")) + Assert.True(tooltip.Contains("Bob1 =")) // Check Bob2 MoveCursorToEndOfMarker(file2,"type (*bob*)Bob") let tooltip = time1 GetQuickInfoAtCursor file2 "Time of file2 tooltip" printf "Tooltip for file2:\n%s\n" tooltip - Assert.IsTrue(tooltip.Contains("Bob2 =")) + Assert.True(tooltip.Contains("Bob2 =")) // In this bug, relative paths with .. in them weren't working. - [] + [] member public this.``BugInRelativePaths``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1680,7 +1584,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate AssertContains(tooltip,"File1.Bob") // QuickInfo over a type that references types in an unreferenced assembly works. - [] + [] member public this.``MissingDependencyReferences.QuickInfo.Bug5409``() = let code = ["#light" @@ -1697,7 +1601,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate /// The fix--at the point in time it was fixed--was to modify the parser to send a limited number /// of additional EOF tokens to allow the recovery code to proceed up the change of productions /// in the grammar. - [] + [] member public this.``Regression.Bug1605``() = let fileContent = """let rec f l = match l with @@ -1706,7 +1610,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate // This string doesn't matter except that it should prove there is some datatip present. this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"| [] -> str","string") - [] + [] member public this.``Regression.Bug4642``() = let fileContent = """ "AA".Chars """ this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"\"AA\".Ch","int -> char") @@ -1724,11 +1628,10 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate let descr = descrFunc() AssertContainsInOrder(descr,rhsContainsOrder) | None -> - Console.WriteLine("Could not find completion name '{0}'", completionName) ShowErrors(project) - Assert.Fail() + failwith $"Could not find completion name '{completionName}'" - [] + [] //``CompletiongListItem.DocCommentsOnMembers`` and with //Regression 5856 member public this.``Regression.MemberDefinition.DocComments.Bug5856_1``() = this.AssertMemberDataTipContainsInOrder @@ -1755,7 +1658,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_2``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1779,7 +1682,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_3``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1803,7 +1706,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_4``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1829,7 +1732,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_5``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1852,7 +1755,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_6``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1875,7 +1778,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_7``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1899,7 +1802,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_8``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1922,7 +1825,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_9``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1945,7 +1848,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_10``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1964,7 +1867,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_13``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1983,7 +1886,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_14``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -2002,7 +1905,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_15``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -2021,7 +1924,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ) - [] + [] member public this.``Regression.ExtensionMethods.DocComments.Bug6028``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -2042,7 +1945,7 @@ query." ] ) - [] + [] member public this.``Regression.OnMscorlibMethodInScript.Bug6489``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -2064,7 +1967,7 @@ query." /// BUG: intellisense on "self" parameter in implicit ctor classes is wrong - [] + [] member public this.``Regression.CompListItemInfo.Bug5694``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -2085,7 +1988,7 @@ query." /// Bug 4592: Check that ctors are displayed from C# classes, i.e. the "new" lines below. - [] + [] member public this.``Regression.Class.Printing.CSharp.Classes.Only.Bug4592``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -2103,7 +2006,7 @@ query." " member NextDouble: unit -> float"] ) - [] + [] member public this.``GenericDotNetMethodShowsComment``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -2119,7 +2022,7 @@ query." ) /// Bug 4624: Check the order in which members are printed, C# classes - [] + [] member public this.``Regression.Class.Printing.CSharp.Classes.Bug4624``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -2143,7 +2046,7 @@ query." ]) /// Bug 4624: Check the order in which members are printed, F# classes - [] + [] member public this.``Regression.Class.Printing.FSharp.Classes.Bug4624``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -2191,7 +2094,7 @@ query." ]) (*------------------------------------------IDE automation starts here -------------------------------------------------*) - [] + [] member public this.``Automation.Regression.AccessibilityOnTypeMembers.Bug4168``() = let fileContent = """module Test type internal Foo2(*Marker*) () = @@ -2203,7 +2106,7 @@ query." private new(x:int,y:int,z:int) = new Foo2()""" this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker*)", "type internal Foo2") - [] + [] member public this.``Automation.Regression.AccessorsAndMutators.Bug4276``() = let fileContent = """type TestType1(*Marker1*)( x : int , y : int ) = let mutable x = x @@ -2242,14 +2145,13 @@ query." this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "(*Marker2*)" "get_Length" this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "(*Marker2*)" "set_Length" - [] - [] + [] member public this.``Automation.AutoOpenMyNamespace``() = let fileContent ="""namespace System.Numerics type t = BigInteger(*Marker1*)""" this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "r(*Marker1*)", "type BigInteger") - [] + [] member public this.``Automation.Regression.BeforeAndAfterIdentifier.Bug4371``() = let fileContent = """module Test let f arg1 (arg2, arg3, arg4) arg5 = 42 @@ -2262,7 +2164,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker2*)", "property System.Console.BufferWidth: int") this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"(*Marker3*)","Full name: Test.printer") - [] + [] member public this.``Automation.Regression.ConstructorWithSameNameAsType.Bug2739``() = let fileContent = """namespace AA module AA = @@ -2272,7 +2174,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker1*)", "AA.AA: AA") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker2*)", "BB.BB: string") - [] + [] member public this.``Automation.Regression.EventImplementation.Bug5471``() = let fileContent = """namespace regressiontest open System @@ -2327,7 +2229,7 @@ query." AssertContains(tooltip, "override CommandReference.CanExecuteChanged: IEvent") AssertContains(tooltip, "regressiontest.CommandReference.CanExecuteChanged") - [] + [] member public this.``Automation.ExtensionMethod``() = let fileContent ="""namespace TestQuickinfo @@ -2446,7 +2348,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker42*)", "FSStruct.ExtensionProperty: string") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker42*)", "fs struct extension property") - [] + [] member public this.``Automation.Regression.GenericFunction.Bug2868``() = let fileContent ="""module Test // Hovering over a generic function (generic argument decorated with [] attribute yields a bad tooltip @@ -2457,8 +2359,7 @@ query." this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "(*Marker*)" "Exception" this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "(*Marker*)" "thrown" - [] - [] + [] member public this.``Automation.IdentifierHaveDiffMeanings``() = let fileContent ="""namespace NS module float(*Marker1_1*) = @@ -2524,14 +2425,14 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker6_2*)", "member ValType.Value : int with set") this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "(*Marker6_2*)" "Microsoft.FSharp.Core.ExtraTopLevelOperators.set" - [] + [] member public this.``Automation.Regression.ModuleIdentifier.Bug2937``() = let fileContent ="""module XXX(*Marker*) type t = C3""" this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker*)", "module XXX") this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "(*Marker*)" "\n" - [] + [] member public this.``Automation.Regression.NamesArgument.Bug3818``() = let fileContent ="""module m [] @@ -2539,8 +2440,7 @@ query." end""" this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker1*)", "property System.AttributeUsageAttribute.AllowMultiple: bool") - [] - [] + [] member public this.``Automation.OnUnitsOfMeasure``() = let fileContent ="""namespace TestQuickinfo @@ -2580,7 +2480,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker22*)", "from Microsoft.FSharp.Collections") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker22*)", "Functional programming operators related to the Set<_> type.") - [] + [] member public this.``Automation.OverRiddenMembers``() = let fileContent ="""namespace QuickinfoGeneric @@ -2602,7 +2502,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker11*)", "override ByteOutputSink.WriteChar: c: char -> unit") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker12*)", "override ByteOutputSink.WriteString: s: string -> unit") - [] + [] member public this.``Automation.Regression.QuotedIdentifier.Bug3790``() = let fileContent ="""module Test module ``Some``(*Marker1*) = Microsoft.FSharp.Collections.List @@ -2612,8 +2512,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "``(*Marker2*)", "module List") this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "``(*Marker2*)" "Option.Some" - [] - [] + [] member public this.``Automation.Setter``() = let fileContent ="""type T() = member this.XX @@ -2653,7 +2552,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker4*)", "T2.Foo: a: 'a * b: 'b -> string") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker5*)", "val foo: int -> int -> int") - [] + [] member public this.``Automation.Regression.TupleException.Bug3723``() = let fileContent ="""namespace TestQuickinfo exception E3(*Marker1*) of int * int @@ -2665,7 +2564,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker2*)", "Full name: TestQuickinfo.E4") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker3*)", "exception E5 = E4") - [] + [] member public this.``Automation.TypeAbbreviations``() = let fileContent ="""namespace NS module TypeAbbreviation = @@ -2716,7 +2615,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker5_1*)", "type AbAttrName = AbstractClassAttribute") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker5_2*)", "type AbAttrName = AbstractClassAttribute") - [] + [] member public this.``Automation.Regression.TypeInferenceScenarios.Bug2362&3538``() = let fileContent ="""module Test.Module1 @@ -2751,7 +2650,7 @@ query." this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"(*Marker7*)","type A =") this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"(*Marker7*)","val mutable x: int") - [] + [] member public this.``Automation.Regression.TypemoduleConstructorLastLine.Bug2494``() = let fileContent ="""namespace NS open System @@ -2777,7 +2676,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*MarkerVal*)", "val pq: PriorityQueue<'a,'b>") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*MarkerLastLine*)", "val singleton: k: 'a -> a: 'b -> PriorityQueue<'a,'b>") - [] + [] member public this.``Automation.WhereQuickInfoShouldNotShowUp``() = let fileContent ="""namespace Test @@ -2825,7 +2724,7 @@ query." this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "(*Marker7*)" "bigint" this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "(*Marker8*)" "myString" - [] + [] member public this.``Automation.Regression.XmlDocComments.Bug3157``() = let fileContent ="""namespace TestQuickinfo module XmlComment = @@ -2839,7 +2738,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker*)", "Full name: TestQuickinfo.XmlComment.func") this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "(*Marker*)" "XmlComment K" - [] + [] member public this.``Automation.Regression.XmlDocCommentsOnExtensionMembers.Bug138112``() = let fileContent ="""module Module1 = type T() = @@ -2862,8 +2761,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker2*)", "XmlComment M2") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker3*)", "XmlComment M3") - [] - [] + [] member public this.XmlDocCommentsForArguments() = let fileContent = """ type bar() = @@ -3059,7 +2957,7 @@ query." AssertContains(tooltip, expectedTip) - [] + [] member public this.``Automation.XDelegateDUStructfromOwnCode``() = let fileContent ="""module Test @@ -3099,7 +2997,7 @@ query." ("(*Marker4*)", "Gets and sets X")] this.VerifyUsingFsTestLib fileContent queries false - [] + [] member public this.``Automation.StructDelegateDUfromOwnCode``() = let fileContent ="""module Test @@ -3141,7 +3039,7 @@ query." ] this.VerifyUsingFsTestLib fileContent queries false - [] + [] member public this.``Automation.TupleRecordClassfromOwnCode``() = let fileContent ="""module Test @@ -3237,9 +3135,7 @@ query." gpatcc.AssertExactly(0,0) - [] - [] - [] + [] // QuickInfo still works on valid operators in a query with errors elsewhere in it member public this.``Query.WithError1.Bug196137``() = let fileContent =""" @@ -3255,10 +3151,8 @@ query." }""" this.AssertQuickInfoInQuery (fileContent, "(*Mark*)", "Product.ProductName: string") - [] - [] + [] // QuickInfo still works on valid operators in a query with errors elsewhere in it - [] member public this.``Query.WithError2``() = let fileContent =""" open DataSource @@ -3271,8 +3165,7 @@ query." }""" this.AssertQuickInfoInQuery (fileContent, "(*Mark*)", "custom operation: minBy ('Value)") - [] - [] + [] // QuickInfo works in a large query (using many operators) member public this.``Query.WithinLargeQuery``() = let fileContent =""" @@ -3303,9 +3196,7 @@ query." this.AssertQuickInfoInQuery (fileContent, "(*Mark3*)", "custom operation: where (bool)") this.AssertQuickInfoInQuery (fileContent, "(*Mark4*)", "custom operation: distinct") - [] - [] - [] + [] // Arguments to query operators have correct QuickInfo // quickinfo should be correct including when the operator is causing an error member public this.``Query.ArgumentToQuery.OperatorError``() = @@ -3319,9 +3210,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "n.GetType()", "val n: int",queryAssemblyRefs) this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "Type()", "System.Object.GetType() : System.Type",queryAssemblyRefs) - [] - [] - [] + [] // Arguments to query operators have correct QuickInfo // quickinfo should be correct In a nested query member public this.``Query.ArgumentToQuery.InNestedQuery``() = @@ -3342,10 +3231,8 @@ query." this.AssertQuickInfoInQuery (fileContent, "(*Mark3*)", "custom operation: groupValBy ('Value) ('Key)") this.AssertQuickInfoInQuery (fileContent, "(*Mark4*)", "custom operation: select ('Result)") - [] - [] + [] // A computation expression with its own custom operators has correct QuickInfo displayed - [] member public this.``Query.ComputationExpression.Method``() = let fileContent =""" open System.Collections.Generic @@ -3387,8 +3274,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Mark1*)", "member WorkflowBuilder.Combine: f: 'b0 * g: 'c1 -> 'c1",queryAssemblyRefs) this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Mark2*)", "member WorkflowBuilder.Zero: unit -> unit",queryAssemblyRefs) - [] - [] + [] // A computation expression with its own custom operators has correct QuickInfo displayed member public this.``Query.ComputationExpression.CustomOp``() = let fileContent =""" @@ -3424,6 +3310,5 @@ query." // Context project system -[] type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickParse.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickParse.fs index 4f2297a74e4..40efc4655a8 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickParse.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickParse.fs @@ -3,13 +3,9 @@ namespace Tests.LanguageService open System -open NUnit.Framework +open Xunit open FSharp.Compiler.EditorServices -[] -[] -[] -[] type QuickParse() = let CheckIsland(tolerateJustAfter:bool, s : string, p : int, expected) = @@ -17,9 +13,9 @@ type QuickParse() = match QuickParse.GetCompleteIdentifierIsland tolerateJustAfter s p with | Some (s, col, _) -> Some (s, col) | None -> None - Assert.AreEqual(expected, actual) + Assert.Equal(expected, actual) - [] + [] member public qp.CheckGetPartialLongName() = let CheckAt(line, index, expected) = let actual = QuickParse.GetPartialLongNameEx(line, index) @@ -53,118 +49,118 @@ type QuickParse() = Check("let y=SomeModule . ", (["SomeModule"], "", Some 18)) - [] + [] member public qp.CheckIsland0() = CheckIsland(true, "", -1, None) - [] + [] member public qp.CheckIsland1() = CheckIsland(false, "", -1, None) - [] + [] member public qp.CheckIsland2() = CheckIsland(true, "", 0, None) - [] + [] member public qp.CheckIsland3() = CheckIsland(false, "", 0, None) - [] + [] member public qp.CheckIsland4() = CheckIsland(true, null, 0, None) - [] + [] member public qp.CheckIsland5() = CheckIsland(false, null, 0, None) - [] + [] member public qp.CheckIsland6() = CheckIsland(false, "identifier", 0, Some("identifier",10)) - [] + [] member public qp.CheckIsland7() = CheckIsland(false, "identifier", 8, Some("identifier",10)) - [] + [] member public qp.CheckIsland8() = CheckIsland(true, "identifier", 0, Some("identifier",10)) - [] + [] member public qp.CheckIsland9() = CheckIsland(true, "identifier", 8, Some("identifier",10)) // A place where tolerateJustAfter matters - [] + [] member public qp.CheckIsland10() = CheckIsland(false, "identifier", 10, None) - [] + [] member public qp.CheckIsland11() = CheckIsland(true, "identifier", 10, Some("identifier",10)) // Index which overflows the line - [] + [] member public qp.CheckIsland12() = CheckIsland(true, "identifier", 11, None) - [] + [] member public qp.CheckIsland13() = CheckIsland(false, "identifier", 11, None) // Match active pattern identifiers - [] + [] member public qp.CheckIsland14() = CheckIsland(false, "|Identifier|", 0, Some("|Identifier|",12)) - [] + [] member public qp.CheckIsland15() = CheckIsland(true, "|Identifier|", 0, Some("|Identifier|",12)) - [] + [] member public qp.CheckIsland16() = CheckIsland(false, "|Identifier|", 12, None) - [] + [] member public qp.CheckIsland17() = CheckIsland(true, "|Identifier|", 12, Some("|Identifier|",12)) - [] + [] member public qp.CheckIsland18() = CheckIsland(false, "|Identifier|", 13, None) - [] + [] member public qp.CheckIsland19() = CheckIsland(true, "|Identifier|", 13, None) // ``Quoted`` identifiers - [] + [] member public qp.CheckIsland20() = CheckIsland(false, "``Space Man``", 0, Some("``Space Man``",13)) - [] + [] member public qp.CheckIsland21() = CheckIsland(true, "``Space Man``", 0, Some("``Space Man``",13)) - [] + [] member public qp.CheckIsland22() = CheckIsland(false, "``Space Man``", 10, Some("``Space Man``",13)) - [] + [] member public qp.CheckIsland23() = CheckIsland(true, "``Space Man``", 10, Some("``Space Man``",13)) - [] + [] member public qp.CheckIsland24() = CheckIsland(false, "``Space Man``", 11, Some("``Space Man``",13)) - // [] + // [] // member public qp.CheckIsland25() = CheckIsland(true, "``Space Man``", 11, Some("Man",11)) // This is probably not what the user wanted. Not enforcing this test. - [] + [] member public qp.CheckIsland26() = CheckIsland(false, "``Space Man``", 12, Some("``Space Man``",13)) - [] + [] member public qp.CheckIsland27() = CheckIsland(true, "``Space Man``", 12, Some("``Space Man``",13)) - [] + [] member public qp.CheckIsland28() = CheckIsland(false, "``Space Man``", 13, None) - [] + [] member public qp.CheckIsland29() = CheckIsland(true, "``Space Man``", 13, Some("``Space Man``",13)) - [] + [] member public qp.CheckIsland30() = CheckIsland(false, "``Space Man``", 14, None) - [] + [] member public qp.CheckIsland31() = CheckIsland(true, "``Space Man``", 14, None) - [] + [] member public qp.CheckIsland32() = CheckIsland(true, "``msft-prices.csv``", 14, Some("``msft-prices.csv``",19)) // handle extracting islands from arrays - [] + [] member public qp.CheckIsland33() = CheckIsland(true, "[|abc;def|]", 2, Some("abc",5)) - [] + [] member public qp.CheckIsland34() = CheckIsland(true, "[|abc;def|]", 4, Some("abc",5)) - [] + [] member public qp.CheckIsland35() = CheckIsland(true, "[|abc;def|]", 5, Some("abc",5)) - [] + [] member public qp.CheckIsland36() = CheckIsland(true, "[|abc;def|]", 6, Some("def",9)) - [] + [] member public qp.CheckIsland37() = CheckIsland(true, "[|abc;def|]", 8, Some("def",9)) - [] + [] member public qp.CheckIsland38() = CheckIsland(true, "[|abc;def|]", 9, Some("def",9)) - [] + [] member public qp.CheckIsland39() = CheckIsland(false, "identifier(*boo*)", 0, Some("identifier",10)) - [] + [] member public qp.CheckIsland40() = CheckIsland(true, "identifier(*boo*)", 0, Some("identifier",10)) - [] + [] member public qp.CheckIsland41() = CheckIsland(false, "identifier(*boo*)", 10, None) - [] + [] member public qp.CheckIsland42() = CheckIsland(true, "identifier(*boo*)", 10, Some("identifier",10)) - [] + [] member public qp.CheckIsland43() = CheckIsland(false, "identifier(*boo*)", 11, None) - [] + [] member public qp.CheckIsland44() = CheckIsland(true, "identifier(*boo*)", 11, None) - [] + [] member public qp.CheckIsland45() = CheckIsland(false, "``Space Man (*boo*)``", 13, Some("``Space Man (*boo*)``",21)) - [] + [] member public qp.CheckIsland46() = CheckIsland(true, "``Space Man (*boo*)``", 13, Some("``Space Man (*boo*)``",21)) - [] + [] member public qp.CheckIsland47() = CheckIsland(false, "(*boo*)identifier", 11, Some("identifier",17)) - [] + [] member public qp.CheckIsland48() = CheckIsland(true, "(*boo*)identifier", 11, Some("identifier",17)) - [] + [] member public qp.CheckIsland49() = CheckIsland(false, "identifier(*(* *)boo*)", 0, Some("identifier",10)) - [] + [] member public qp.CheckIsland50() = CheckIsland(true, "identifier(*(* *)boo*)", 0, Some("identifier",10)) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs index 8a563a879dc..852758363c5 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs @@ -5,7 +5,7 @@ namespace Tests.LanguageService.Script open System open System.IO open System.Reflection -open NUnit.Framework +open Xunit open Salsa.Salsa open Salsa.VsOpsUtils open UnitTests.TestLib.Salsa @@ -13,8 +13,6 @@ open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem -[] -[] type UsingMSBuild() as this = inherit LanguageServiceBaseTests() @@ -59,7 +57,7 @@ type UsingMSBuild() as this = [ for i = 0 to errorList.Length - 1 do yield errorList.[i].Message] - Assert.IsTrue(errorList + Assert.True(errorList |> GetErrorMessages |> Seq.exists (fun errorMessage -> errorMessage.Contains(expectedStr))) @@ -92,7 +90,7 @@ type UsingMSBuild() as this = match squiggleOption with | None -> Assert.Fail("Expected a squiggle but none was seen.") | Some(severity,message) -> - Assert.IsTrue((severity=expectedSeverity), sprintf "Expected %s but saw %s: %s" nameOfExpected nameOfNotExpected message) + Assert.True((severity=expectedSeverity), sprintf "Expected %s but saw %s: %s" nameOfExpected nameOfNotExpected message) assertf(message,containing) AssertSquiggle Microsoft.VisualStudio.FSharp.LanguageService.Severity.Error "Error" "Warning" AssertContains, AssertSquiggle Microsoft.VisualStudio.FSharp.LanguageService.Severity.Warning "Warning" "Error" AssertContains, @@ -133,27 +131,26 @@ type UsingMSBuild() as this = AssertNotContains(tooltip, notexpected) /// There was a problem with Salsa that caused squiggles not to be shown for .fsx files. - [] + [] member public this.``Fsx.Squiggles.ShowInFsxFiles``() = let fileContent = """open Thing1.Thing2""" this.VerifyFSXErrorListContainedExpectedString(fileContent,"Thing1") /// Regression test for FSharp1.0:4861 - #r to nonexistent file causes the first line to be squiggled /// There was a problem with Salsa that caused squiggles not to be shown for .fsx files. - [] + [] member public this.``Fsx.Hash.RProperSquiggleForNonExistentFile``() = let fileContent = """#r "NonExistent" """ this.VerifyFSXErrorListContainedExpectedString(fileContent,"was not found or is invalid") /// Nonexistent hash. There was a problem with Salsa that caused squiggles not to be shown for .fsx files. - [] + [] member public this.``Fsx.Hash.RDoesNotExist.Bug3325``() = let fileContent = """#r "ThisDLLDoesNotExist" """ this.VerifyFSXErrorListContainedExpectedString(fileContent,"'ThisDLLDoesNotExist' was not found or is invalid") // There was a spurious error message on the first line. - [] - [] + [] member public this.``Fsx.ExactlyOneError.Bug4861``() = let code = ["#light" // First line is important in this repro @@ -162,7 +159,7 @@ type UsingMSBuild() as this = let (project, _) = createSingleFileFsxFromLines code AssertExactlyCountErrorSeenContaining(project, "Nonexistent", 1) // ...and not an error on the first line. - [] + [] member public this.``Fsx.InvalidHashLoad.ShouldBeASquiggle.Bug3012``() = let fileContent = """ #light @@ -171,8 +168,7 @@ type UsingMSBuild() as this = this.VerifyFSXErrorListContainedExpectedString(fileContent,"Bar.fs") // Transitive to existing property. - [] - [] + [] member public this.``Fsx.ScriptClosure.TransitiveLoad1``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -196,8 +192,7 @@ type UsingMSBuild() as this = AssertNoErrorsOrWarnings(project) // Transitive to nonexisting property. - [] - [] + [] member public this.``Fsx.ScriptClosure.TransitiveLoad2``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -219,8 +214,7 @@ type UsingMSBuild() as this = AssertExactlyOneErrorSeenContaining(project, "NonExistingProperty") /// FEATURE: Typing a #r into a file will cause it to be recognized by intellisense. - [] - [] + [] member public this.``Fsx.HashR.AddedIn``() = let code = ["#light" @@ -240,7 +234,7 @@ type UsingMSBuild() as this = gpatcc.AssertExactly(notAA[file],notAA[file], true (* expectCreate, because dependent DLL set changed *)) // FEATURE: Adding a #load to a file will cause types from that file to be visible in intellisense - [] + [] member public this.``Fsx.HashLoad.Added``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -271,7 +265,7 @@ type UsingMSBuild() as this = AssertNoErrorsOrWarnings(project) // FEATURE: Removing a #load to a file will cause types from that file to no longer be visible in intellisense - [] + [] member public this.``Fsx.HashLoad.Removed``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -301,7 +295,7 @@ type UsingMSBuild() as this = TakeCoffeeBreak(this.VS) VerifyErrorListContainedExpectedStr("MyNamespace",project) - [] + [] member public this.``Fsx.HashLoad.Conditionals``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -330,14 +324,13 @@ type UsingMSBuild() as this = MoveCursorToEndOfMarker(fsx, "InDifferentFS.") let completion = AutoCompleteAtCursor fsx let completion = completion |> Array.map (fun (CompletionItem(name, _, _, _, _)) -> name) |> set - Assert.AreEqual(Set.count completion, 2, "Expected 2 elements in the completion list") - Assert.IsTrue(completion.Contains "x", "Completion list should contain x because INTERACTIVE is defined") - Assert.IsTrue(completion.Contains "B", "Completion list should contain B because DEBUG is not defined") + Assert.Equal(Set.count completion, 2) + Assert.True(completion.Contains "x", "Completion list should contain x because INTERACTIVE is defined") + Assert.True(completion.Contains "B", "Completion list should contain B because DEBUG is not defined") /// FEATURE: Removing a #r into a file will cause it to no longer be seen by intellisense. - [] - [] + [] member public this.``Fsx.HashR.Removed``() = let code = ["#light" @@ -362,8 +355,7 @@ type UsingMSBuild() as this = // Corecursive load to existing property. - [] - [] + [] member public this.``Fsx.NoError.ScriptClosure.TransitiveLoad3``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -387,8 +379,7 @@ type UsingMSBuild() as this = AssertNoErrorsOrWarnings(project) // #load of .fsi is respected (for non-hidden property) - [] - [] + [] member public this.``Fsx.NoError.ScriptClosure.TransitiveLoad9``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -416,8 +407,7 @@ type UsingMSBuild() as this = AssertNoErrorsOrWarnings(project) // #load of .fsi is respected at second #load level (for non-hidden property) - [] - [] + [] member public this.``Fsx.NoError.ScriptClosure.TransitiveLoad10``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -448,8 +438,7 @@ type UsingMSBuild() as this = AssertNoErrorsOrWarnings(project) // #load of .fsi is respected when dispersed between two #load levels (for non-hidden property) - [] - [] + [] member public this.``Fsx.NoError.ScriptClosure.TransitiveLoad11``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -480,8 +469,7 @@ type UsingMSBuild() as this = AssertNoErrorsOrWarnings(project) // #load of .fsi is respected when dispersed between two #load levels (the other way) (for non-hidden property) - [] - [] + [] member public this.``Fsx.NoError.ScriptClosure.TransitiveLoad12``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -512,8 +500,7 @@ type UsingMSBuild() as this = AssertNoErrorsOrWarnings(project) // #nowarn seen in closed .fsx is global to the closure - [] - [] + [] member public this.``Fsx.NoError.ScriptClosure.TransitiveLoad16``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -534,7 +521,7 @@ type UsingMSBuild() as this = AssertNoErrorsOrWarnings(project) /// FEATURE: #r in .fsx to a .dll name works. - [] + [] member public this.``Fsx.NoError.HashR.DllWithNoPath``() = let fileContent = """ #light @@ -543,7 +530,7 @@ type UsingMSBuild() as this = this.VerifyFSXNoErrorList(fileContent) - [] + [] // 'System' is in the default set. Make sure we can still resolve it. member public this.``Fsx.NoError.HashR.BugDefaultReferenceFileIsAlsoResolved``() = let fileContent = """ @@ -552,8 +539,7 @@ type UsingMSBuild() as this = """ this.VerifyFSXNoErrorList(fileContent) - [] - [] + [] member public this.``Fsx.NoError.HashR.DoubleReference``() = let fileContent = """ #light @@ -562,8 +548,7 @@ type UsingMSBuild() as this = """ this.VerifyFSXNoErrorList(fileContent) - [] - [] + [] // 'CustomMarshalers' is loaded from the GAC _and_ it is available on XP and above. member public this.``Fsx.NoError.HashR.ResolveFromGAC``() = let fileContent = """ @@ -572,17 +557,14 @@ type UsingMSBuild() as this = """ this.VerifyFSXNoErrorList(fileContent) - [] - [] + [] member public this.``Fsx.NoError.HashR.ResolveFromFullyQualifiedPath``() = let fullyqualifiepathtoddll = System.IO.Path.Combine( System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(), "System.configuration.dll" ) let code = ["#light";"#r @\"" + fullyqualifiepathtoddll + "\""] let (project, _) = createSingleFileFsxFromLines code AssertNoErrorsOrWarnings(project) - [] - [] - [] + [] member public this.``Fsx.NoError.HashR.RelativePath1``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -618,8 +600,7 @@ type UsingMSBuild() as this = let ans = GetSquiggleAtCursor(script1) AssertNoSquiggle(ans) - [] - [] + [] member public this.``Fsx.NoError.HashR.RelativePath2``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -656,7 +637,7 @@ type UsingMSBuild() as this = AssertNoSquiggle(ans) /// FEATURE: #load in an .fsx file will include that file in the 'build' of the .fsx. - [] + [] member public this.``Fsx.NoError.HashLoad.Simple``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -678,8 +659,7 @@ type UsingMSBuild() as this = AssertNoErrorsOrWarnings(project) // In this bug the #loaded file contains a level-4 warning (copy to avoid mutation). This warning was reported at the #load in file2.fsx but shouldn't have been.s - [] - [] + [] member public this.``Fsx.NoWarn.OnLoadedFile.Bug4837``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -699,8 +679,7 @@ type UsingMSBuild() as this = /// FEATURE: .fsx files have automatic imports of certain system assemblies. //There is a test bug here. The actual scenario works. Need to revisit. - [] - [] + [] member public this.``Fsx.NoError.AutomaticImportsForFsxFiles``() = let fileContent = """ #light @@ -717,8 +696,7 @@ type UsingMSBuild() as this = this.VerifyFSXNoErrorList(fileContent) // Corecursive load to nonexisting property. - [] - [] + [] member public this.``Fsx.ExactlyOneError.ScriptClosure.TransitiveLoad4``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -741,8 +719,7 @@ type UsingMSBuild() as this = AssertExactlyOneErrorSeenContaining(project, "NonExistingProperty") // #load of .fsi is respected - [] - [] + [] member public this.``Fsx.ExactlyOneError.ScriptClosure.TransitiveLoad5``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -770,8 +747,7 @@ type UsingMSBuild() as this = AssertExactlyOneErrorSeenContaining(project, "HiddenProperty") // #load of .fsi is respected at second #load level - [] - [] + [] member public this.``Fsx.ExactlyOneError.ScriptClosure.TransitiveLoad6``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -802,8 +778,7 @@ type UsingMSBuild() as this = AssertExactlyOneErrorSeenContaining(project, "HiddenProperty") // #load of .fsi is respected when dispersed between two #load levels - [] - [] + [] member public this.``Fsx.ExactlyOneError.ScriptClosure.TransitiveLoad7``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -834,8 +809,7 @@ type UsingMSBuild() as this = AssertExactlyOneErrorSeenContaining(project, "HiddenProperty") // #load of .fsi is respected when dispersed between two #load levels (the other way) - [] - [] + [] member public this.``Fsx.ExactlyOneError.ScriptClosure.TransitiveLoad8``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -866,8 +840,7 @@ type UsingMSBuild() as this = AssertExactlyOneErrorSeenContaining(project, "HiddenProperty") // Bug seen during development: A #load in an .fs would be followed. - [] - [] + [] member public this.``Fsx.ExactlyOneError.ScriptClosure.TransitiveLoad15``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -890,7 +863,7 @@ type UsingMSBuild() as this = TakeCoffeeBreak(this.VS) AssertExactlyOneErrorSeenContaining(project, "Namespace") - [] + [] member public this.``Fsx.Bug4311HoverOverReferenceInFirstLine``() = let fileContent = """#r "PresentationFramework.dll" @@ -899,7 +872,7 @@ type UsingMSBuild() as this = this.AssertQuickInfoContainsAtEndOfMarkerInFsxFile fileContent marker "PresentationFramework.dll" this.AssertQuickInfoNotContainsAtEndOfMarkerInFsxFile fileContent marker "multiple results" - [] + [] member public this.``Fsx.QuickInfo.Bug4979``() = let code = ["System.ConsoleModifiers.Shift |> ignore " @@ -925,7 +898,7 @@ type UsingMSBuild() as this = // they may be metadata-only assemblies. // // "Reference Assemblies" was only introduced in 3.5sp1, so not all 2.0 F# boxes will have it, so only run on 4.0 - [] + [] member public this.``Fsx.Bug5073``() = let fileContent = """#r "System" """ let marker = "#r \"System" @@ -933,35 +906,32 @@ type UsingMSBuild() as this = this.AssertQuickInfoContainsAtEndOfMarkerInFsxFile fileContent marker ".NET Framework" /// FEATURE: Hovering over a resolved #r file will show a data tip with the fully qualified path to that file. - [] + [] member public this.``Fsx.HashR_QuickInfo.ShowFilenameOfResolvedAssembly``() = this.AssertQuickInfoContainsAtEndOfMarkerInFsxFile """#r "System.Transactions" """ // Pick anything that isn't in the standard set of assemblies. "#r \"System.Tra" "System.Transactions.dll" - [] + [] member public this.``Fsx.HashR_QuickInfo.BugDefaultReferenceFileIsAlsoResolved``() = this.AssertQuickInfoContainsAtEndOfMarkerInFsxFile """#r "System" """ // 'System' is in the default set. Make sure we can still resolve it. "#r \"Syst" "System.dll" - [] - [] + [] member public this.``Fsx.HashR_QuickInfo.DoubleReference``() = let fileContent = """#r "System" // Mark1 #r "System" // Mark2 """ // The same reference repeated twice. this.AssertQuickInfoContainsAtStartOfMarkerInFsxFile fileContent "tem\" // Mark1" "System.dll" this.AssertQuickInfoContainsAtStartOfMarkerInFsxFile fileContent "tem\" // Mark2" "System.dll" - [] - [] + [] member public this.``Fsx.HashR_QuickInfo.ResolveFromGAC``() = this.AssertQuickInfoContainsAtEndOfMarkerInFsxFile """#r "CustomMarshalers" """ // 'mscorcfg' is loaded from the GAC _and_ it is available on XP and above. "#r \"Custo" ".NET Framework" - [] - [] + [] member public this.``Fsx.HashR_QuickInfo.ResolveFromFullyQualifiedPath``() = let fullyqualifiepathtoddll = System.IO.Path.Combine( System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(), "System.configuration.dll" ) // Can be any fully qualified path to an assembly let expectedtooltip = System.Reflection.Assembly.ReflectionOnlyLoadFrom(fullyqualifiepathtoddll).FullName @@ -970,7 +940,7 @@ type UsingMSBuild() as this = this.AssertQuickInfoContainsAtEndOfMarkerInFsxFile fileContent marker expectedtooltip //this.AssertQuickInfoNotContainsAtEndOfMarkerInFsxFile fileContent marker ".dll" - [] + [] member public this.``Fsx.InvalidHashReference.ShouldBeASquiggle.Bug3012``() = let code = ["#light" @@ -979,11 +949,10 @@ type UsingMSBuild() as this = MoveCursorToEndOfMarker(file,"#r \"Ba") let squiggle = GetSquiggleAtCursor(file) TakeCoffeeBreak(this.VS) - Assert.IsTrue(snd squiggle.Value |> fun str -> str.Contains("Bar.dll")) + Assert.True(snd squiggle.Value |> fun str -> str.Contains("Bar.dll")) // Bug seen during development: The unresolved reference error would x-ray through to the root. - [] - [] + [] member public this.``Fsx.ScriptClosure.TransitiveLoad14``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1016,23 +985,23 @@ type UsingMSBuild() as this = | Some(sev,msg) -> AssertEqual(Microsoft.VisualStudio.FSharp.LanguageService.Severity.Error, sev) AssertContains(msg, expectedStr) - | _ -> Assert.Fail() + | _ -> failwith "" /// FEATURE: #r, #I, #load are all errors when running under the language service - [] + [] member public this.``Fsx.HashDirectivesAreErrors.InNonScriptFiles.Case1``() = this.TestFsxHashDirectivesAreErrors("#r \"Joe", "may only be used in F# script files") - [] + [] member public this.``Fsx.HashDirectivesAreErrors.InNonScriptFiles.Case2``() = this.TestFsxHashDirectivesAreErrors("#I \"", "may only be used in F# script files") - [] + [] member public this.``Fsx.HashDirectivesAreErrors.InNonScriptFiles.Case3``() = this.TestFsxHashDirectivesAreErrors("#load \"Doo", "may only be used in F# script files") /// FEATURE: #reference against a non-assembly .EXE gives a reasonable error message - //[] + //[] member public this.``Fsx.HashReferenceAgainstNonAssemblyExe``() = let windows = System.Environment.GetEnvironmentVariable("windir") let code = @@ -1048,8 +1017,7 @@ type UsingMSBuild() as this = (* ---------------------------------------------------------------------------------- *) // FEATURE: A #loaded file is squiggled with an error if there are errors in that file. - [] - [] + [] member public this.``Fsx.HashLoadedFileWithErrors.Bug3149``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1074,8 +1042,7 @@ type UsingMSBuild() as this = // FEATURE: A #loaded file is squiggled with a warning if there are warning that file. - [] - [] + [] member public this.``Fsx.HashLoadedFileWithWarnings.Bug3149``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1098,8 +1065,7 @@ type UsingMSBuild() as this = AssertSquiggleIsWarningContaining(ans, "WarningHere") // Bug: #load should report the first error message from a file - [] - [] + [] member public this.``Fsx.HashLoadedFileWithErrors.Bug3652``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1125,7 +1091,7 @@ type UsingMSBuild() as this = AssertSquiggleIsErrorNotContaining(ans, "foo") // In this bug the .fsx project directory was wrong so it couldn't reference a relative file. - [] + [] member public this.``Fsx.ScriptCanReferenceBinDirectoryOutput.Bug3151``() = use _guard = this.UsingNewVS() let stopWatch = new System.Diagnostics.Stopwatch() @@ -1155,8 +1121,7 @@ type UsingMSBuild() as this = /// In this bug, multiple references to mscorlib .dll were causing problem in load closure - [] - [] + [] member public this.``Fsx.BugAllowExplicitReferenceToMsCorlib``() = let code = ["#r \"mscorlib\"" @@ -1169,8 +1134,7 @@ type UsingMSBuild() as this = AssertCompListContains(completions,"CommandLineArgs") /// FEATURE: There is a global fsi module that should be in scope for script files. - [] - [] + [] member public this.``Fsx.Bug2530FsiObject``() = let code = ["#light" @@ -1183,8 +1147,7 @@ type UsingMSBuild() as this = AssertCompListContains(completions,"CommandLineArgs") // Ensure that the script closure algorithm gets the right order of hash directives - [] - [] + [] member public this.``Fsx.ScriptClosure.SurfaceOrderOfHashes``() = let code = ["#r \"System.Runtime.Remoting\"" @@ -1199,12 +1162,12 @@ type UsingMSBuild() as this = AssertArrayContainsPartialMatchOf(fas.OtherOptions, "System.Runtime.Remoting.dll") AssertArrayContainsPartialMatchOf(fas.OtherOptions, "System.Transactions.dll") AssertArrayContainsPartialMatchOf(fas.OtherOptions, "FSharp.Compiler.Interactive.Settings.dll") - Assert.AreEqual(Path.Combine(projectFolder,"File1.fsx"), fas.SourceFiles.[0]) - Assert.AreEqual(1, fas.SourceFiles.Length) + Assert.Equal(Path.Combine(projectFolder,"File1.fsx"), fas.SourceFiles.[0]) + Assert.Equal(1, fas.SourceFiles.Length) /// FEATURE: #reference against a strong name should work. - [] + [] member public this.``Fsx.HashReferenceAgainstStrongName``() = let code = ["#light" @@ -1217,7 +1180,7 @@ type UsingMSBuild() as this = /// Try out some bogus file names in #r, #I and #load. - [] + [] member public this.``Fsx.InvalidMetaCommandFilenames``() = let code = [ @@ -1236,7 +1199,7 @@ type UsingMSBuild() as this = TakeCoffeeBreak(this.VS) // This used to assert /// FEATURE: .fsx files have INTERACTIVE #defined - [] + [] member public this.``Fsx.INTERACTIVEIsDefinedInFsxFiles``() = let code = [ @@ -1249,9 +1212,7 @@ type UsingMSBuild() as this = AssertEqual(TokenType.Identifier ,GetTokenTypeAtCursor(file)) // Ensure that basic compile of an .fsx works - [] - [] - [] + [] member public this.``Fsx.CompileFsx_1``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1260,14 +1221,12 @@ type UsingMSBuild() as this = let file1 = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, ["printfn \"Hello world\""]) let build = time1 Build project "Time to build project" - Assert.IsTrue(build.BuildSucceeded, "Expected build to succeed") + Assert.True(build.BuildSucceeded, "Expected build to succeed") ShowErrors(project) // Compile a script which #loads a source file. The build can't succeed without the loaded file. - [] - [] - [] + [] member public this.``Fsx.CompileFsx_2``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1285,12 +1244,10 @@ type UsingMSBuild() as this = let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line () - Assert.IsTrue(build.BuildSucceeded, "Expected build to succeed") + Assert.True(build.BuildSucceeded, "Expected build to succeed") // Compile a script which #loads a source file. The build can't succeed without - [] - [] - [] + [] member public this.``Fsx.CompileFsx_3``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1308,12 +1265,10 @@ type UsingMSBuild() as this = let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line () - Assert.IsTrue(build.BuildSucceeded, "Expected build to succeed") + Assert.True(build.BuildSucceeded, "Expected build to succeed") // Must be explicitly referenced by compile. - [] - [] - [] + [] member public this.``Fsx.CompileFsx_Bug5416_1``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1325,13 +1280,10 @@ type UsingMSBuild() as this = let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line () - Assert.IsTrue(not(build.BuildSucceeded), "Expected build to fail") + Assert.True(not(build.BuildSucceeded), "Expected build to fail") // Must be explicitly referenced by compile. - [] - [] - [] - [] + [] member public this.``Fsx.CompileFsx_Bug5416_2``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1357,13 +1309,11 @@ type UsingMSBuild() as this = for line in lines do printfn "%s" line () if not(SupportsOutputWindowPane(this.VS)) then - Assert.IsTrue(build.BuildSucceeded, "Expected build to succeed") + Assert.True(build.BuildSucceeded, "Expected build to succeed") // Ensure that #load order is preserved when #loading multiple files. - [] - [] - [] + [] member public this.``Fsx.CompileFsx_5``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1388,13 +1338,11 @@ type UsingMSBuild() as this = let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line () - Assert.IsTrue(build.BuildSucceeded, "Expected build to succeed") + Assert.True(build.BuildSucceeded, "Expected build to succeed") // If an fs file is explicitly passed in to the compiler and also #loaded then // the command-line order is respected rather than the #load order - [] - [] - [] + [] member public this.``Fsx.CompileFsx_6``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1419,14 +1367,12 @@ type UsingMSBuild() as this = let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line () - Assert.IsTrue(build.BuildSucceeded, "Expected build to succeed") + Assert.True(build.BuildSucceeded, "Expected build to succeed") // If a #loaded file does not exist, there should be an error - [] - [] - [] + [] member public this.``Fsx.CompileFsx_7``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1441,13 +1387,11 @@ type UsingMSBuild() as this = for line in lines do printfn "%s" line AssertListContainsInOrder(lines, ["error FS0079: Could not load file"; "NonexistentFile.fs"; "because it does not exist or is inaccessible"]) - Assert.IsTrue(not(build.BuildSucceeded), "Expected build to fail") + Assert.True(not(build.BuildSucceeded), "Expected build to fail") // #r references should be respected. - [] - [] - [] + [] member public this.``Fsx.CompileFsx_8``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1462,13 +1406,11 @@ type UsingMSBuild() as this = let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line - Assert.IsTrue(build.BuildSucceeded, "Expected build to succeed") + Assert.True(build.BuildSucceeded, "Expected build to succeed") // Missing script file should be a reasonable failure, not a callstack. - [] - [] - [] + [] member public this.``Fsx.CompileFsx_Bug5414``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1486,11 +1428,11 @@ type UsingMSBuild() as this = printfn "%s" line AssertNotContains(line,"error MSB") // Microsoft.FSharp.Targets(135,9): error MSB6006: "fsc.exe" exited with code -532462766. - Assert.IsTrue(not(build.BuildSucceeded), "Expected build to fail") + Assert.True(not(build.BuildSucceeded), "Expected build to fail") /// There was a problem in which synthetic tokens like #load were causing asserts - [] + [] member public this.``Fsx.SyntheticTokens``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -1503,7 +1445,7 @@ type UsingMSBuild() as this = ) /// There was a problem where an unclosed reference picked up the text of the reference on the next line. - [] + [] member public this.``Fsx.ShouldBeAbleToReference30Assemblies.Bug2050``() = let code = ["#light" @@ -1516,7 +1458,7 @@ type UsingMSBuild() as this = AssertCompListContains(completions,"Linq") /// There was a problem where an unclosed reference picked up the text of the reference on the next line. - [] + [] member public this.``Fsx.UnclosedHashReference.Case1``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -1524,7 +1466,7 @@ type UsingMSBuild() as this = "#reference \"" // Unclosed "#reference \"Hello There\""] ) - [] + [] member public this.``Fsx.UnclosedHashReference.Case2``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -1534,7 +1476,7 @@ type UsingMSBuild() as this = ) /// There was a problem where an unclosed reference picked up the text of the reference on the next line. - [] + [] member public this.``Fsx.UnclosedHashLoad``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -1543,9 +1485,7 @@ type UsingMSBuild() as this = "#load \"Hello There\""] ) - [] - [] - [] + [] member public this.``TypeProvider.UnitsOfMeasure.SmokeTest1``() = let code = ["open Microsoft.FSharp.Data.UnitSystems.SI.UnitNames" @@ -1565,22 +1505,22 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let providerAssemblyName = PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll") let providerAssembly = System.Reflection.Assembly.LoadFrom providerAssemblyName - Assert.IsNotNull(providerAssembly, "provider assembly should not be null") + Assert.NotNull(providerAssembly) let providerCounters = providerAssembly.GetType("DummyProviderForLanguageServiceTesting.GlobalCounters") - Assert.IsNotNull(providerCounters, "provider counters module should not be null") + Assert.NotNull(providerCounters) let totalCreationsMeth = providerCounters.GetMethod("GetTotalCreations") - Assert.IsNotNull(totalCreationsMeth, "totalCreationsMeth should not be null") + Assert.NotNull(totalCreationsMeth) let totalDisposalsMeth = providerCounters.GetMethod("GetTotalDisposals") - Assert.IsNotNull(totalDisposalsMeth, "totalDisposalsMeth should not be null") + Assert.NotNull(totalDisposalsMeth) let checkConfigsMeth = providerCounters.GetMethod("CheckAllConfigsDisposed") - Assert.IsNotNull(checkConfigsMeth, "checkConfigsMeth should not be null") + Assert.NotNull(checkConfigsMeth) let providerCounters2 = providerAssembly.GetType("ProviderImplementation.ProvidedTypes.GlobalCountersForInvalidation") - Assert.IsNotNull(providerCounters2, "provider counters #2 module should not be null") + Assert.NotNull(providerCounters2) let totalInvalidationHandlersAddedMeth = providerCounters2.GetMethod("GetInvalidationHandlersAdded") - Assert.IsNotNull(totalInvalidationHandlersAddedMeth, "totalInvalidationHandlersAddedMeth should not be null") + Assert.NotNull(totalInvalidationHandlersAddedMeth) let totalInvalidationHandlersRemovedMeth = providerCounters2.GetMethod("GetInvalidationHandlersRemoved") - Assert.IsNotNull(totalInvalidationHandlersRemovedMeth, "totalInvalidationHandlersRemovedMeth should not be null") + Assert.NotNull(totalInvalidationHandlersRemovedMeth) let totalCreations() = totalCreationsMeth.Invoke(null, [| |]) :?> int let totalDisposals() = totalDisposalsMeth.Invoke(null, [| |]) :?> int @@ -1598,8 +1538,8 @@ type UsingMSBuild() as this = let countInvalidationHandlersAdded() = totalInvalidationHandlersAdded() - startInvalidationHandlersAdded let countInvalidationHandlersRemoved() = totalInvalidationHandlersRemoved() - startInvalidationHandlersRemoved - Assert.IsTrue(startCreations >= startDisposals, "Check0") - Assert.IsTrue(startInvalidationHandlersAdded >= startInvalidationHandlersRemoved, "Check0") + Assert.True(startCreations >= startDisposals, "Check0") + Assert.True(startInvalidationHandlersAdded >= startInvalidationHandlersRemoved, "Check0") for i in 1 .. 50 do let solution = this.CreateSolution() let project = CreateProject(solution,"testproject" + string (i % 20)) @@ -1624,17 +1564,17 @@ type UsingMSBuild() as this = let d = countDisposals() // Creations should always be greater or equal to disposals - Assert.IsTrue(c >= d, "Check2, countCreations() >= countDisposals(), iteration " + string i + ", countCreations() = " + string c + ", countDisposals() = " + string d) + Assert.True(c >= d, "Check2, countCreations() >= countDisposals(), iteration " + string i + ", countCreations() = " + string c + ", countDisposals() = " + string d) // Creations can run ahead of iterations if the background checker resurrects the builder for a project // even after we've moved on from it. - Assert.IsTrue((c >= i), "Check3, countCreations() >= i, iteration " + string i + ", countCreations() = " + string c) + Assert.True((c >= i), "Check3, countCreations() >= i, iteration " + string i + ", countCreations() = " + string c) if not clearing then // By default we hold 3 build incrementalBuilderCache entries and 5 typeCheckInfo entries, so if we're not clearing // there should be some roots to project builds still present if i >= 3 then - Assert.IsTrue(c >= d + 3, "Check4a, c >= countDisposals() + 3, iteration " + string i + ", i = " + string i + ", countDisposals() = " + string d) + Assert.True(c >= d + 3, "Check4a, c >= countDisposals() + 3, iteration " + string i + ", i = " + string i + ", countDisposals() = " + string d) printfn "Check4a2, i = %d, countInvalidationHandlersRemoved() = %d" i (countInvalidationHandlersRemoved()) // If we forcefully clear out caches and force a collection, then we can say much stronger things... @@ -1644,31 +1584,30 @@ type UsingMSBuild() as this = let d = countDisposals() // Creations should be equal to disposals after a `ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients` - Assert.IsTrue((c = d), "Check4b, countCreations() = countDisposals(), iteration " + string i) - Assert.IsTrue((countInvalidationHandlersAdded() = countInvalidationHandlersRemoved()), "Check4b2, all invalidation handlers removed, iteration " + string i) + Assert.True((c = d), "Check4b, countCreations() = countDisposals(), iteration " + string i) + Assert.True((countInvalidationHandlersAdded() = countInvalidationHandlersRemoved()), "Check4b2, all invalidation handlers removed, iteration " + string i) let c = countCreations() let d = countDisposals() - Assert.IsTrue(c >= 50, "Check5, at end, countCreations() >= 50") + Assert.True(c >= 50, "Check5, at end, countCreations() >= 50") ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients(this.VS) let c = countCreations() let d = countDisposals() // Creations should be equal to disposals after a `ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients` - Assert.IsTrue((c = d), "Check6b, at end, countCreations() = countDisposals() after explicit clearing") - Assert.IsTrue((countInvalidationHandlersAdded() = countInvalidationHandlersRemoved()), "Check6b2, at end, all invalidation handlers removed after explicit clearing") + Assert.True((c = d), "Check6b, at end, countCreations() = countDisposals() after explicit clearing") + Assert.True((countInvalidationHandlersAdded() = countInvalidationHandlersRemoved()), "Check6b2, at end, all invalidation handlers removed after explicit clearing") checkConfigsDisposed() - [] + [] member public this.``TypeProvider.Disposal.SmokeTest1``() = this.TypeProviderDisposalSmokeTest(true) - [] + [] member public this.``TypeProvider.Disposal.SmokeTest2``() = this.TypeProviderDisposalSmokeTest(false) // Context project system -[] type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.TimeStamp.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.TimeStamp.fs index 76c6d663df2..530260a0d5f 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.TimeStamp.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.TimeStamp.fs @@ -4,15 +4,13 @@ namespace Tests.LanguageService.TimeStamp open System open System.IO -open NUnit.Framework +open Xunit open Salsa.Salsa open Salsa.VsOpsUtils open UnitTests.TestLib.Salsa open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService -[] -[] type UsingMSBuild() = inherit LanguageServiceBaseTests() @@ -46,7 +44,7 @@ type UsingMSBuild() = // In this bug, if you clean the dependent project, the dependee started getting errors again about the unresolved assembly. // The desired behavior is like C#, which is if the assembly disappears from disk, we use cached results of last time it was there. // Disabled due to issue #11752 --- https://github.com/dotnet/fsharp/issues/11752 - //[] + //[] member public this.``Regression.NoError.Timestamps.Bug3368b``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -88,8 +86,7 @@ type UsingMSBuild() = AssertNoErrorsOrWarnings(project2) // this is key, project2 remembers what used to be on disk, does not fail due to missing assembly // In this bug, the referenced project output didn't exist yet. Building dependee should cause update in dependent - [] - [] + [] member public this.``Regression.NoContainedString.Timestamps.Bug3368a``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -121,7 +118,7 @@ type UsingMSBuild() = AssertNoErrorSeenContaining(project2, "project1") // FEATURE: OnIdle() will reprocess open dirty files, even if those file do not currently have editor focus - // [] TODO This test does not work because the unit tests do not cover product code that implements this feature + // [] TODO This test does not work because the unit tests do not cover product code that implements this feature member public this.``Timestamps.Bug3368c``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -147,7 +144,7 @@ type UsingMSBuild() = TakeCoffeeBreak(this.VS) let errs = GetErrors(project2) - Assert.IsTrue(List.length errs > 0, "There should be errors (unresolved reference)") + Assert.True(List.length errs > 0, "There should be errors (unresolved reference)") // switch focus to a different file (to turn off 'focus' idle processing for file2) let file1 = OpenFile(project1,"File1.fs") @@ -156,7 +153,7 @@ type UsingMSBuild() = printfn "building dependent project..." Build project1 |> ignore let errs = GetErrors(project2) - Assert.IsTrue(List.length errs > 0, "There should be errors (unresolved reference)") + Assert.True(List.length errs > 0, "There should be errors (unresolved reference)") TakeCoffeeBreak(this.VS) // the code that should clear out the errors is in LanguageService.cs:LanguageService.OnIdle(), // but unit tests do not call this FSharp.LanguageService.Base code; TakeCoffeeBreak(this.VS) just simulates @@ -165,8 +162,7 @@ type UsingMSBuild() = AssertNoErrorsOrWarnings(project2) // FEATURE: When a referenced assembly's timestamp changes the reference is reread. - [] - [] + [] member public this.``Timestamps.ReferenceAssemblyChangeAbsolute``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -194,7 +190,7 @@ type UsingMSBuild() = SwitchToFile this.VS file2 MoveCursorToEndOfMarker(file2,"File1.File1.") let completions = AutoCompleteAtCursor(file2) - Assert.AreEqual(0, completions.Length) + Assert.Equal(0, completions.Length) // Now modify project1's file and rebuild. ReplaceFileInMemory file1 @@ -208,12 +204,11 @@ type UsingMSBuild() = MoveCursorToEndOfMarker(file2,"File1.File1.") TakeCoffeeBreak(this.VS) // Give enough time to catch up let completions = AutoCompleteAtCursor(file2) - Assert.AreNotEqual(0, completions.Length) + Assert.NotEqual(0, completions.Length) printfn "Completions=%A\n" completions // In this bug, relative paths to referenced assemblies weren't seen. - [] - [] + [] member public this.``Timestamps.ReferenceAssemblyChangeRelative``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -249,7 +244,7 @@ type UsingMSBuild() = SwitchToFile this.VS file2 MoveCursorToEndOfMarker(file2,"File1.File1.") let completions = AutoCompleteAtCursor(file2) - Assert.AreEqual(0, completions.Length) + Assert.Equal(0, completions.Length) // Now modify project1's file and rebuild. ReplaceFileInMemory file1 @@ -263,12 +258,11 @@ type UsingMSBuild() = MoveCursorToEndOfMarker(file2,"File1.File1.") TakeCoffeeBreak(this.VS) // Give enough time to catch up let completions = AutoCompleteAtCursor(file2) - Assert.AreNotEqual(0, completions.Length) + Assert.NotEqual(0, completions.Length) printfn "Completions=%A\n" completions // FEATURE: When a referenced project's assembly timestamp changes the reference is reread. - [] - [] + [] member public this.``Timestamps.ProjectReferenceAssemblyChange``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -302,7 +296,7 @@ type UsingMSBuild() = SwitchToFile this.VS file2 MoveCursorToEndOfMarker(file2,"File1.File1.") let completions = AutoCompleteAtCursor(file2) - Assert.AreEqual(0, completions.Length) + Assert.Equal(0, completions.Length) // Now modify project1's file and rebuild. ReplaceFileInMemory file1 @@ -316,7 +310,7 @@ type UsingMSBuild() = MoveCursorToEndOfMarker(file2,"File1.File1.") TakeCoffeeBreak(this.VS) // Give enough time to catch up let completions = AutoCompleteAtCursor(file2) - Assert.AreNotEqual(0, completions.Length) + Assert.NotEqual(0, completions.Length) printfn "Completions=%A\n" completions @@ -325,10 +319,9 @@ namespace Tests.LanguageService.TimeStamp open Tests.LanguageService open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem -open NUnit.Framework +open Xunit open Salsa.Salsa // Context project system -[] type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) \ No newline at end of file diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Configs.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Configs.fs index faf186f8cef..a0cedaf030f 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Configs.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Configs.fs @@ -8,7 +8,7 @@ open System.Collections.Generic open System.IO open System.Text.RegularExpressions open System.Xml.Linq -open NUnit.Framework +open Xunit // VS namespaces open Microsoft.VisualStudio @@ -23,13 +23,6 @@ open UnitTests.TestLib.Utils.FilesystemHelpers open UnitTests.TestLib.ProjectSystem -[] -type public AssemblyResolverTestFixture () = - - [] - member public _.Init () = AssemblyResolver.addResolver () - -[][] type Config() = inherit TheTests() @@ -38,7 +31,7 @@ type Config() = static let SaveProject(project : UnitTestingFSharpProjectNode) = project.Save(null, 1, 0u) |> ignore - [] + [] member this.TargetPlatform () = this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(["foo.fs"], [], this.MSBuildProjectMultiPlatformBoilerplate "Library", @@ -46,32 +39,32 @@ type Config() = ccn((project :> IVsHierarchy), "Debug|x86") project.ComputeSourcesAndFlags() let flags = project.CompilationOptions |> List.ofArray - Assert.IsTrue(List.exists (fun s -> s = "--platform:x86") flags) + Assert.True(List.exists (fun s -> s = "--platform:x86") flags) () )) - [] + [] member this.``Configs.EnsureAtLeastOneConfiguration`` () = this.HelperEnsureAtLeastOne @"" [|"Debug"|] // the goal of the test - when no configs, "Debug" should magically appear [|"x86"|] - [] + [] member this.``Configs.EnsureAtLeastOnePlatform`` () = this.HelperEnsureAtLeastOne @"" [|"Release"|] [|"Any CPU"|] // the goal of the test - when no platforms, "AnyCPU" should magically appear - [] + [] member this.``Configs.EnsureAtLeastOneConfigurationAndPlatform`` () = this.HelperEnsureAtLeastOne "" [|"Debug"|] // first goal of the test - when no configs, "Debug" should magically appear [|"Any CPU"|] // second goal of the test - when no platforms, "AnyCPU" should magically appear - [] + [] member this.``Configs.EnsureAtLeastOneConfiguration.Imported`` () = // Take advantage of the fact that we always create projects one directory below TempPath let tmpTargets = Path.Combine(Path.GetTempPath(), "foo.targets") @@ -88,7 +81,7 @@ type Config() = finally File.Delete tmpTargets - [] + [] member this.``Configs.EnsureAtLeastOnePlatform.Imported`` () = // Take advantage of the fact that we always create projects one directory below TempPath // The unit test failed due to the previous test use the same target name "foo.targets". @@ -106,7 +99,7 @@ type Config() = finally File.Delete tmpTargets - [] + [] member this.``Configs.Renaming`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], this.MSBuildProjectMultiConfigBoilerplate ["Debug",""; "Release",""], @@ -122,7 +115,7 @@ type Config() = TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) )) - [] + [] member this.``Configs.Deleting`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], this.MSBuildProjectMultiConfigBoilerplate ["Debug",""; "Release",""], @@ -137,7 +130,7 @@ type Config() = let expectedXDoc = XDocument.Load(new StringReader(TheTests.SimpleFsprojText(["foo.fs"],[],expected))) TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) )) - [] + [] member this.``Configs.Adding`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], this.MSBuildProjectMultiConfigBoilerplate ["Debug",""; "Release",""], @@ -152,7 +145,7 @@ type Config() = let expectedXDoc = XDocument.Load(new StringReader(TheTests.SimpleFsprojText(["foo.fs"],[],expected))) TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) )) - [] + [] member this.``Configs.AddingBaseless`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], this.MSBuildProjectMultiConfigBoilerplate ["Debug",""; "Release",""], @@ -168,7 +161,7 @@ type Config() = TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) )) - [] + [] member this.``Configs.Platforms.Deleting`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], this.MSBuildProjectMultiPlatform ["Any CPU",""; "x86",""], @@ -185,7 +178,7 @@ type Config() = )) - [] + [] member this.``Configs.Platforms.Adding`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], this.MSBuildProjectMultiPlatform ["Any CPU",""; "x86",""], @@ -202,7 +195,7 @@ type Config() = )) - [] + [] member this.``Configs.Platforms.AddingBaseless`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], this.MSBuildProjectMultiPlatform ["Any CPU",""; "x86",""], diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Miscellaneous.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Miscellaneous.fs index 7aa25427e2d..800411f1bd7 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Miscellaneous.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Miscellaneous.fs @@ -18,13 +18,12 @@ open Microsoft.VisualStudio.FSharp.ProjectSystem open Microsoft.VisualStudio.FSharp.Editor // Internal unittest namespaces -open NUnit.Framework +open Xunit open Salsa open UnitTests.TestLib.Utils.Asserts open UnitTests.TestLib.Utils.FilesystemHelpers open UnitTests.TestLib.ProjectSystem -[][] type Miscellaneous() = inherit TheTests() @@ -34,7 +33,7 @@ type Miscellaneous() = static let SaveProject(project : UnitTestingFSharpProjectNode) = project.Save(null, 1, 0u) |> ignore - //[] // keep disabled unless trying to prove that UnhandledExceptionHandler is working + //[] // keep disabled unless trying to prove that UnhandledExceptionHandler is working member public this.EnsureThatUnhandledExceptionsCauseAnAssert() = this.MakeProjectAndDo([], ["System"], "", (fun proj -> let t = new System.Threading.Thread(new System.Threading.ThreadStart(fun () -> failwith "foo")) @@ -42,16 +41,16 @@ type Miscellaneous() = System.Threading.Thread.Sleep(1000) )) - [] + [] member public this.``Miscellaneous.CreatePropertiesObject`` () = DoWithTempFile "Test.fsproj" (fun projFile -> File.AppendAllText(projFile, TheTests.SimpleFsprojText([], [], "")) use project = TheTests.CreateProject(projFile) let prop = project.CreatePropertiesObject() - Assert.AreEqual(typeof, prop.GetType()) + Assert.Equal(typeof, prop.GetType()) ) - [] + [] member public this.``Miscellaneous.TestProperties`` () = DoWithTempFile "Test.fsproj" (fun projFile -> File.AppendAllText(projFile, TheTests.SimpleFsprojText([], [], "")) @@ -59,63 +58,63 @@ type Miscellaneous() = let prop = new FSharpProjectNodeProperties(project) prop.AssemblyName <- "a" - Assert.AreEqual("a", prop.AssemblyName) + Assert.Equal("a", prop.AssemblyName) // Output type and output file name prop.OutputType <- OutputType.Exe - Assert.AreEqual(OutputType.Exe, prop.OutputType) - Assert.AreEqual("a.exe", prop.OutputFileName) + Assert.Equal(OutputType.Exe, prop.OutputType) + Assert.Equal("a.exe", prop.OutputFileName) prop.OutputType <- OutputType.Library - Assert.AreEqual(OutputType.Library, prop.OutputType) - Assert.AreEqual("a.dll", prop.OutputFileName) + Assert.Equal(OutputType.Library, prop.OutputType) + Assert.Equal("a.dll", prop.OutputFileName) prop.OutputType <- OutputType.WinExe - Assert.AreEqual(OutputType.WinExe, prop.OutputType) - Assert.AreEqual("a.exe", prop.OutputFileName) + Assert.Equal(OutputType.WinExe, prop.OutputType) + Assert.Equal("a.exe", prop.OutputFileName) ) - [] + [] member public this.``Miscellaneous.CreateServices`` () = DoWithTempFile "Test.fsproj" (fun projFile -> File.AppendAllText(projFile, TheTests.SimpleFsprojText([], [], "")) use project = TheTests.CreateProject(projFile) let proj = project.CreateServices(typeof) - Assert.AreEqual(typeof, proj.GetType()) + Assert.Equal(typeof, proj.GetType()) let eproj = project.CreateServices(typeof) - Assert.AreEqual(typeof, eproj.GetType()) + Assert.Equal(typeof, eproj.GetType()) let badservice = project.CreateServices(typeof) - Assert.IsNull(badservice) + Assert.Null(badservice) ) - [] + [] member public this.``Miscellaneous.FSharpFileNode.RelativeFilePath`` () = this.MakeProjectAndDo(["orig1.fs"], [], "", (fun project -> let absFilePath = Path.Combine(project.ProjectFolder, "orig1.fs") let files = new List() project.FindNodesOfType(files) - Assert.AreEqual(1, files.Count) + Assert.Equal(1, files.Count) let file = files.[0] let path = file.RelativeFilePath - Assert.AreEqual("orig1.fs", path) + Assert.Equal("orig1.fs", path) )) - [] + [] member public this.``Miscellaneous.FSharpFileNode.CreateServices`` () = this.MakeProjectAndDo(["orig1.fs"], [], "", (fun project -> let absFilePath = Path.Combine(project.ProjectFolder, "orig1.fs") let files = new List() project.FindNodesOfType(files) - Assert.AreEqual(1, files.Count) + Assert.Equal(1, files.Count) let file = files.[0] let badservice = file.CreateServices(typeof) - Assert.IsNull(badservice) + Assert.Null(badservice) let eproj = file.CreateServices(typeof) - Assert.AreEqual(typeof, eproj.GetType()) + Assert.Equal(typeof, eproj.GetType()) )) - //[] + //[] member public this.AttemptDragAndDrop() = printfn "starting..." let fsproj = "D:\Depot\staging\Test.fsproj" @@ -159,15 +158,14 @@ type Miscellaneous() = node <- node.NextSibling if node = null then finished <- true - Assert.AreNotEqual(node, null) + Assert.NotEqual(node, null) let itemId = node.ID project.DragEnter(iOleDataObject, keyboardState, itemId, &dwEffect) |> ignore () - [] - [] + [] member public this.``Automation.OutputGroup.OUTPUTLOC``() = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], this.MSBuildProjectMultiPlatform(["x86",""],"x86"), @@ -184,8 +182,7 @@ type Miscellaneous() = ) ) - [] - [] + [] member public this.``Automation.OutputGroups``() = DoWithTempFile "Test.fsproj" (fun file -> let text = TheTests.FsprojTextWithProjectReferences([],[],[],@" @@ -247,7 +244,7 @@ type Miscellaneous() = AssertEqual expected ogInfos ) - [] + [] member public this.``LoadProject.x86`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], ["System"], this.MSBuildProjectMultiPlatform(["x86",""],"x86"), @@ -262,8 +259,7 @@ type Miscellaneous() = AssertEqual 1 l.Count )) - [] - [] + [] member public this.``BuildAndClean``() = this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(["foo.fs"], [], this.MSBuildProjectBoilerplate "Library", @@ -291,7 +287,7 @@ type Miscellaneous() = success <- fSuccess <> 0 printfn "Build %s, code %i, phase: %s." (if success then "succeeded" else "failed") fSuccess (if isCleaning then "Cleaning" else "Build") - event.Set() |> Assert.IsTrue + event.Set() |> Assert.True VSConstants.S_OK member this.Tick pfContinue = pfContinue <- 1; VSConstants.S_OK } @@ -301,10 +297,10 @@ type Miscellaneous() = let output = VsMocks.vsOutputWindowPane(ref []) let doBuild target = success <- false - event.Reset() |> Assert.IsTrue + event.Reset() |> Assert.True buildMgrAccessor.BeginDesignTimeBuild() |> ValidateOK // this is not a design-time build, but our mock does all the right initialization of the build manager for us, similar to what the system would do in VS for real buildableCfg.Build(0u, output, target) - event.WaitOne() |> Assert.IsTrue + event.WaitOne() |> Assert.True buildMgrAccessor.EndDesignTimeBuild() |> ValidateOK // this is not a design-time build, but our mock does all the right initialization of the build manager for us, similar to what the system would do in VS for real AssertEqual true success @@ -324,7 +320,7 @@ type Miscellaneous() = )) - //KnownFail: [] + //KnownFail: [] member public this.``ErrorReporting.EmptyModuleReportedAtTheLastLine``() = let (outputWindowPaneErrors : string list ref) = ref [] // output window pane errors let vso = VsMocks.vsOutputWindowPane(outputWindowPaneErrors) @@ -357,17 +353,11 @@ type Miscellaneous() = () )) -#if NUNIT_V2 - [][)>] - member public this.``DebuggingDLLFails``() = this.``DebuggingDLLFailsFunc``() -#else - [] + [] member public this.``DebuggingDLLFails``() = - Assert.That((fun () -> this.``DebuggingDLLFailsFunc``()), NUnit.Framework.Throws.TypeOf(typeof)) -#endif + Assert.Throws((fun () -> this.``DebuggingDLLFailsFunc``())) - [] - [] + [] member public this.``DebuggingEXESucceeds``() = this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(["foo.fs"], [], this.MSBuildProjectBoilerplate "Exe", @@ -376,7 +366,7 @@ type Miscellaneous() = let fooPath = Path.Combine(project.ProjectFolder, "foo.fs") File.AppendAllText(fooPath, "#light") let buildResult = project.Build("Build") - Assert.IsTrue buildResult.IsSuccessful + Assert.True buildResult.IsSuccessful AssertEqual true (File.Exists (Path.Combine(project.ProjectFolder, "bin\\Debug\\Blah.exe"))) let mutable configurationInterface : IVsCfg = null @@ -387,11 +377,11 @@ type Miscellaneous() = config.DebugLaunch(0ul) |> ignore with | :? ClassLibraryCannotBeStartedDirectlyException -> Assert.Fail("Exe should be debuggable") - | _ -> Assert.Fail() // DmiLom: Currently DebugLaunch() swallows most exceptions, in future if we improve DebugLaunch() we will expect it to throw a particular exception here + | _ -> failwith "" // DmiLom: Currently DebugLaunch() swallows most exceptions, in future if we improve DebugLaunch() we will expect it to throw a particular exception here () )) - [] + [] member public this.``IsDocumentInProject`` () = DoWithTempFile "Test.fsproj" (fun file -> let fakeCsLibProjectFile = @"..\CsLib\CsLib.csproj" @@ -414,7 +404,7 @@ type Miscellaneous() = checkInProject false "System.dll" ) - //Known Fail: [] + //Known Fail: [] member public this.``PreBuildEvent`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], ["System"], "", (fun project projFileName -> @@ -434,10 +424,10 @@ type Miscellaneous() = printfn "Build output:" !outputWindowPaneErrors |> Seq.iter (printfn "%s") let expectedRegex = new Regex("\\s*ProjectExt\\[.fsproj\\]") - Assert.IsTrue(!outputWindowPaneErrors |> List.exists (fun s -> expectedRegex.IsMatch(s)), "did not see expected value in build output") + Assert.True(!outputWindowPaneErrors |> List.exists (fun s -> expectedRegex.IsMatch(s)), "did not see expected value in build output") )) - [] + [] member public this.``BuildMacroValues`` () = let logger (message:string) = System.IO.File.AppendAllText(@"c:\temp\logfile.txt", (message + Environment.NewLine)) @@ -455,23 +445,23 @@ type Miscellaneous() = // Verify Solution values let solutionDir = project.GetBuildMacroValue("SolutionDir") - Assert.IsNotNull (solutionDir, "SolutionDir is NULL") - Assert.IsFalse ( (solutionDir = "*Undefined*"), "SolutionDir not defined") + Assert.NotNull(solutionDir) + Assert.False ( (solutionDir = "*Undefined*"), "SolutionDir not defined") let solutionFileName = project.GetBuildMacroValue("SolutionFileName") - Assert.IsNotNull (solutionFileName, "SolutionFileName is null") - Assert.IsFalse ( (solutionFileName = "*Undefined*"), "SolutionFileName not defined") + Assert.NotNull(solutionFileName) + Assert.False ( (solutionFileName = "*Undefined*"), "SolutionFileName not defined") let solutionName = project.GetBuildMacroValue("SolutionName") - Assert.IsNotNull (solutionName, "SolutionName is null") - Assert.IsFalse ( (solutionName = "*Undefined*"), "SolutionName not defined") + Assert.NotNull(solutionName) + Assert.False ( (solutionName = "*Undefined*"), "SolutionName not defined") let solutionExt = project.GetBuildMacroValue("SolutionExt") - Assert.IsNotNull (solutionExt, "SolutionExt is null") - Assert.IsFalse ( (solutionExt = "*Undefined*"), "SolutionExt not defined") + Assert.NotNull(solutionExt) + Assert.False ( (solutionExt = "*Undefined*"), "SolutionExt not defined") ) - [] + [] member public this.CreateFSharpManifestResourceName () = DoWithTempFile "Test.fsproj" (fun file -> let text = TheTests.FsprojTextWithProjectReferences(["foo.fs";"Bar.resx"; "Bar.de.resx"; "Xyz\Baz.ru.resx"; "Abc.resources"],[],[],"") @@ -491,14 +481,14 @@ type Miscellaneous() = let buildMgr = project.Site.GetService(typeof) :?> IVsSolutionBuildManager let cfgs = Array.create 1 (null : IVsProjectCfg) let hr = buildMgr.FindActiveProjectCfg(System.IntPtr.Zero, System.IntPtr.Zero, project, cfgs) - Assert.AreEqual(VSConstants.S_OK, hr) - Assert.IsNotNull(cfgs.[0]) + Assert.Equal(VSConstants.S_OK, hr) + Assert.NotNull(cfgs.[0]) let mutable cfgName = "" let hr = cfgs.[0].get_CanonicalName(&cfgName) - Assert.AreEqual(VSConstants.S_OK, hr) + Assert.Equal(VSConstants.S_OK, hr) cfgName - [] + [] member this.``MSBuildExtensibility.BrokenCompileDependsOn.WithRecovery`` () = this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier( ["foo.fs";"bar.fs"], @@ -529,7 +519,7 @@ type Miscellaneous() = project.Reload() // Ensure we are not in 'Foo' config, and thus expect failure let curCfgCanonicalName = this.GetCurrentConfigCanonicalName(project) - Assert.IsFalse(curCfgCanonicalName.StartsWith("Foo"), sprintf "default config should not be 'Foo'! in fact it had canonical name '%s'" curCfgCanonicalName) + Assert.False(curCfgCanonicalName.StartsWith("Foo"), sprintf "default config should not be 'Foo'! in fact it had canonical name '%s'" curCfgCanonicalName) // Now the project system is in a state where ComputeSourcesAndFlags will fail. // Our goal is to at least be able to open individual source files and treat them like 'files outside a project' with regards to intellisense, etc. // Also, if the user does 'Build', he will get an error which will help diagnose the problem. @@ -537,10 +527,10 @@ type Miscellaneous() = let ips = ipps.GetProjectSite() let expected = [| |] // Ideal behavior is [|"foo.fs";"bar.fs"|], and we could choose to improve this in the future. For now we are just happy to now throw/crash. let actual = ips.CompilationSourceFiles - Assert.AreEqual(expected, actual, "project site did not report expected set of source files") + Assert.Equal(expected, actual) ) - [] + [] member public this.TestBuildActions () = DoWithTempFile "Test.fsproj" (fun file -> let text = TheTests.FsprojTextWithProjectReferences(["foo.fs";"Bar.resx"; "Bar.de.resx"; "Xyz\Baz.ru.resx"; "Abc.resources"],[],[],"") @@ -571,7 +561,7 @@ type Miscellaneous() = () ) - [] + [] member public this.TestBuildActionConversions () = let replace (pattern:string) (replacement:string) (input:string) = Regex.Replace(input, pattern, replacement) @@ -582,10 +572,10 @@ type Miscellaneous() = props :?> BuildableNodeProperties let checkNotStandardBuildAction buildAction = - Assert.IsFalse(VSLangProj.prjBuildAction.prjBuildActionNone = buildAction, "Unexpected None match") - Assert.IsFalse(VSLangProj.prjBuildAction.prjBuildActionCompile = buildAction, "Unexpected Compile match") - Assert.IsFalse(VSLangProj.prjBuildAction.prjBuildActionContent = buildAction, "Unexpected Content match") - Assert.IsFalse(VSLangProj.prjBuildAction.prjBuildActionEmbeddedResource = buildAction, "Unexpected EmbeddedResource match") + Assert.False(VSLangProj.prjBuildAction.prjBuildActionNone = buildAction, "Unexpected None match") + Assert.False(VSLangProj.prjBuildAction.prjBuildActionCompile = buildAction, "Unexpected Compile match") + Assert.False(VSLangProj.prjBuildAction.prjBuildActionContent = buildAction, "Unexpected Content match") + Assert.False(VSLangProj.prjBuildAction.prjBuildActionEmbeddedResource = buildAction, "Unexpected EmbeddedResource match") DoWithTempFile "Test.fsproj" (fun file -> let text = @@ -598,32 +588,32 @@ type Miscellaneous() = // test proper behavior from project file let node = getBuildableNodeProps project "Compile.fs" - Assert.IsTrue(node.BuildAction = VSLangProj.prjBuildAction.prjBuildActionCompile, "Compile build action failed") - Assert.IsTrue(node.ItemType = "Compile", "Compile item type failed") + Assert.True(node.BuildAction = VSLangProj.prjBuildAction.prjBuildActionCompile, "Compile build action failed") + Assert.True(node.ItemType = "Compile", "Compile item type failed") let node = getBuildableNodeProps project "None.fs" - Assert.IsTrue(node.BuildAction = VSLangProj.prjBuildAction.prjBuildActionNone, "None build action failed") - Assert.IsTrue(node.ItemType = "None", "None item type failed") + Assert.True(node.BuildAction = VSLangProj.prjBuildAction.prjBuildActionNone, "None build action failed") + Assert.True(node.ItemType = "None", "None item type failed") let node = getBuildableNodeProps project "Resource.fs" checkNotStandardBuildAction node.BuildAction - Assert.IsTrue(node.ItemType = "Resource", "Resource item type failed") + Assert.True(node.ItemType = "Resource", "Resource item type failed") let node = getBuildableNodeProps project "Dude.fs" checkNotStandardBuildAction node.BuildAction - Assert.IsTrue(node.ItemType = "Dude", "Dude item type failed") + Assert.True(node.ItemType = "Dude", "Dude item type failed") // test handling of bogus values node.BuildAction <- enum 100 - Assert.IsTrue(node.BuildAction = VSLangProj.prjBuildAction.prjBuildActionNone, "Bogus build action not mapped to None") + Assert.True(node.BuildAction = VSLangProj.prjBuildAction.prjBuildActionNone, "Bogus build action not mapped to None") node.ItemType <- "Wibble" - Assert.IsTrue(node.ItemType = "None", "Bogus item type not mapped to None") + Assert.True(node.ItemType = "None", "Bogus item type not mapped to None") () ) - [] + [] member this.``WildcardsInProjectFile.ThrowingCase`` () = DoWithTempFile "Test.fsproj"(fun file -> let text = TheTests.FsprojTextWithProjectReferences(["*.fs"],[],[],"") @@ -639,10 +629,10 @@ type Miscellaneous() = exceptionThrown <- true AssertEqual "*.fs" e.ItemSpecification AssertEqual "Compile" e.ItemType - Assert.IsTrue(exceptionThrown) + Assert.True(exceptionThrown) ) - [] + [] member this.``WildcardsInProjectFile.OkCase`` () = DoWithTempFile "Test.fsproj"(fun file -> let text = TheTests.FsprojTextWithProjectReferences(["*.fs"],[],[],"") @@ -659,13 +649,12 @@ type Miscellaneous() = | [ _; fn ] -> // first file is AssemblyAttributes.fs AssertEqual fileName fn | _ -> - sprintf "wring set of compile items %A" items |> Assert.Fail + failwithf "wring set of compile items %A" items () finally project.Close() |> ignore ) -[] type Utilities() = (* Simulation of the code found in Xaml editor that we were crashing. The relevent code is pasted below. @@ -733,24 +722,24 @@ type Utilities() = let CheckPublicKeyToString(bytes,expect) = let actual = KeyToken.ToHexString(bytes) - Assert.AreEqual(expect, actual) + Assert.Equal(expect, actual) SimulateXamlEditorReceivingThroughDTE(actual) - [] + [] member public this.``PublicKeyToken.0000000000000000``() = CheckPublicKeyToString([|0uy;0uy;0uy;0uy;0uy;0uy;0uy;0uy|], "0000000000000000") - [] + [] member public this.``PublicKeyToken.0000000000000001``() = CheckPublicKeyToString([|0uy;0uy;0uy;0uy;0uy;0uy;0uy;1uy|], "0000000000000001") - [] + [] member public this.``PublicKeyToken.0a00000000000001``() = CheckPublicKeyToString([|0xauy;0uy;0uy;0uy;0uy;0uy;0uy;1uy|], "0a00000000000001") - [] + [] member public this.``Parse MSBuild property of type Int64`` () = - Assert.AreEqual(123L, ProjectNode.ParsePropertyValueToInt64("123")) - Assert.AreEqual(255L, ProjectNode.ParsePropertyValueToInt64("0xFF")) - Assert.AreEqual(null, ProjectNode.ParsePropertyValueToInt64("")) - Assert.AreEqual(null, ProjectNode.ParsePropertyValueToInt64(null)) + Assert.Equal(123L, ProjectNode.ParsePropertyValueToInt64("123").Value) + Assert.Equal(255L, ProjectNode.ParsePropertyValueToInt64("0xFF").Value) + Assert.Null(ProjectNode.ParsePropertyValueToInt64("")) + Assert.Null(ProjectNode.ParsePropertyValueToInt64(null)) Throws(fun () -> ignore (ProjectNode.ParsePropertyValueToInt64("abc"))) Throws(fun () -> ignore (ProjectNode.ParsePropertyValueToInt64("12333333333333333333333333"))) diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.MultiTargeting.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.MultiTargeting.fs index f1b699a428c..1e393f7ceed 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.MultiTargeting.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.MultiTargeting.fs @@ -8,7 +8,7 @@ open System.IO open System.Reflection open System.Text.RegularExpressions open System.Xml.Linq -open NUnit.Framework +open Xunit open Salsa open UnitTests.TestLib.Utils.Asserts open UnitTests.TestLib.Utils.FilesystemHelpers @@ -16,7 +16,6 @@ open UnitTests.TestLib.ProjectSystem open Microsoft.VisualStudio.FSharp.ProjectSystem -[][] type MultiTargeting() = inherit TheTests() @@ -35,7 +34,7 @@ type MultiTargeting() = File.AppendAllText(projFile, TheTests.FsprojTextWithProjectReferencesAndOtherFlags([], [refLibPath], [], null, "", "v4.0")) refLibPath - [] + [] member public this.``Multitargeting.CheckIconForMismatchedAssemblyReference`` () = DoWithTempFile "Test.fsproj" (fun projFile -> let sp, ccn = VsMocks.MakeMockServiceProviderAndConfigChangeNotifier40() @@ -43,14 +42,14 @@ type MultiTargeting() = use project = TheTests.CreateProject(projFile, "true", ccn, sp) let l = new List() project.FindNodesOfType(l) - Assert.AreEqual(1, l.Count) - Assert.AreEqual(refLibPath, l.[0].Url) - Assert.AreEqual(refLibPath, l.[0].Caption) + Assert.Equal(1, l.Count) + Assert.Equal(refLibPath, l.[0].Url) + Assert.Equal(refLibPath, l.[0].Caption) let ref = l.[0] - Assert.AreEqual(true, ref.CanShowDefaultIcon()) + Assert.Equal(true, ref.CanShowDefaultIcon()) ) - [] + [] member public this.``Multitargeting.CheckIconForMatchedAssemblyReference20`` () = DoWithTempFile "Test.fsproj" (fun projFile -> let sp, ccn = VsMocks.MakeMockServiceProviderAndConfigChangeNotifier20() @@ -58,14 +57,14 @@ type MultiTargeting() = use project = TheTests.CreateProject(projFile, "true", ccn, sp) let l = new List() project.FindNodesOfType(l) - Assert.AreEqual(1, l.Count) - Assert.AreEqual(refLibPath, l.[0].Url) - Assert.AreEqual(refLibPath, l.[0].Caption) + Assert.Equal(1, l.Count) + Assert.Equal(refLibPath, l.[0].Url) + Assert.Equal(refLibPath, l.[0].Caption) let ref = l.[0] - Assert.AreEqual(true, ref.CanShowDefaultIcon()) + Assert.Equal(true, ref.CanShowDefaultIcon()) ) - [] + [] member public this.``Multitargeting.DetermineRuntimeAndSKU`` () = DoWithTempFile "Test.fsproj" (fun projFile -> let sp, ccn = VsMocks.MakeMockServiceProviderAndConfigChangeNotifier40() @@ -74,62 +73,62 @@ type MultiTargeting() = let validate (fn : System.Runtime.Versioning.FrameworkName) eR eS = let (runtime, sku) = project.DetermineRuntimeAndSKU(fn.ToString()) - Assert.AreEqual(eR, runtime) - Assert.AreEqual(eS, sku) + Assert.Equal(eR, runtime) + Assert.Equal(eS, sku) validate (new System.Runtime.Versioning.FrameworkName(".NETFramework", new System.Version(4, 0))) "v4.0" ".NETFramework,Version=v4.0" validate (new System.Runtime.Versioning.FrameworkName(".NETFramework", new System.Version(2, 0))) "v2.0.50727" null ) - [] + [] member public this.``Multitargeting.AppConfigNoStartupNode`` () = let root = XElement.Parse("") let dirty = LangConfigFile.PatchUpXml(root, "version", "sku") - Assert.IsTrue(dirty) - Assert.IsTrue(root.ToString().Contains("")) + Assert.True(dirty) + Assert.True(root.ToString().Contains("")) - [] + [] member public this.``Multitargeting.AppConfigVersionExistsAddNewSku`` () = let root = XElement.Parse("") let dirty = LangConfigFile.PatchUpXml(root, "version", "sku") - Assert.IsTrue(dirty) - Assert.IsTrue(root.ToString().Contains("")) + Assert.True(dirty) + Assert.True(root.ToString().Contains("")) - [] + [] member public this.``Multitargeting.AppConfigVersionExistsReplaceSku`` () = let root = XElement.Parse("") let dirty = LangConfigFile.PatchUpXml(root, "version", "sku") - Assert.IsTrue(dirty) - Assert.IsTrue(root.ToString().Contains("")) + Assert.True(dirty) + Assert.True(root.ToString().Contains("")) - [] + [] member public this.``Multitargeting.AppConfigVersionExistsRemoveSku`` () = let root = XElement.Parse("") let dirty = LangConfigFile.PatchUpXml(root, "version", null) - Assert.IsTrue(dirty) - Assert.IsTrue(root.ToString().Contains("")) + Assert.True(dirty) + Assert.True(root.ToString().Contains("")) - [] + [] member public this.``Multitargeting.AppConfigVersionReplaceOldRuntime`` () = let root = XElement.Parse("") let dirty = LangConfigFile.PatchUpXml(root, "version", "sku") - Assert.IsTrue(dirty) - Assert.IsTrue(root.ToString().Contains("")) - Assert.IsFalse(root.ToString().Contains("")) + Assert.True(dirty) + Assert.True(root.ToString().Contains("")) + Assert.False(root.ToString().Contains("")) - [] + [] member public this.``Multitargeting.AppConfigVersionReplaceOldRuntimes`` () = let root = XElement.Parse("") let dirty = LangConfigFile.PatchUpXml(root, "version", "sku") - Assert.IsTrue(dirty) - Assert.IsTrue(root.ToString().Contains("")) - Assert.IsFalse(root.ToString().Contains("")) - Assert.IsFalse(root.ToString().Contains("")) + Assert.True(dirty) + Assert.True(root.ToString().Contains("")) + Assert.False(root.ToString().Contains("")) + Assert.False(root.ToString().Contains("")) - [] + [] member public this.``Multitargeting.TestFrameworkNameToVersionString`` () = let validatePair name str = let res = HierarchyNode.GetFrameworkVersionString(name) - Assert.AreEqual(str, res) + Assert.Equal(str, res) validatePair (new System.Runtime.Versioning.FrameworkName(".NETFramework", new System.Version(4,0))) "v4.0" validatePair (new System.Runtime.Versioning.FrameworkName(".NETFramework", new System.Version(4,0,5))) "v4.0.5" @@ -143,7 +142,7 @@ type MultiTargeting() = validatePair (new System.Runtime.Versioning.FrameworkName(".NETFramework", new System.Version(2,0,0,1))) "v2.0" (* - [] + [] member public this.``Multitargeting.AddAppConfigIfRetargetTo40Full`` () = DoWithTempFile "Test.fsproj" (fun projFile -> let sp, ccn = VsMocks.MakeMockServiceProviderAndConfigChangeNotifier20() @@ -157,10 +156,10 @@ type MultiTargeting() = project.FixupAppConfigOnTargetFXChange(fn.ToString(), "4.3.0.0", false) |> ignore let appFile = Path.Combine((Path.GetDirectoryName projFile), "app.config") let appText = System.IO.File.ReadAllText(appFile) - Assert.IsTrue(appText.Contains("")) - //Assert.IsTrue(appText.Contains("")) - //Assert.IsTrue(appText.Contains("")) - //Assert.IsTrue(appText.Contains("")) + Assert.True(appText.Contains("")) + //Assert.True(appText.Contains("")) + //Assert.True(appText.Contains("")) + //Assert.True(appText.Contains("")) () ) *) diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Project.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Project.fs index ac6b083a0cb..993a3590e6c 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Project.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Project.fs @@ -8,11 +8,12 @@ open System.Collections.Generic open System.IO open System.Text.RegularExpressions open System.Xml.Linq -open NUnit.Framework +open Xunit // VS namespaces open Microsoft.VisualStudio open Microsoft.VisualStudio.Shell.Interop +open Microsoft.VisualStudio.FSharp open Microsoft.VisualStudio.FSharp.ProjectSystem // Internal unittest namespaces @@ -22,10 +23,11 @@ open UnitTests.TestLib.Utils.FilesystemHelpers open UnitTests.TestLib.ProjectSystem -[][] type Project() = inherit TheTests() + do + AssemblyResolver.addResolver () //TODO: look for a way to remove the helper functions static let ANYTREE = Tree("",Nil,Nil) @@ -34,7 +36,7 @@ type Project() = static let SaveProject(project : UnitTestingFSharpProjectNode) = project.Save(null, 1, 0u) |> ignore - [] + [] member public _.NewFolderOnProjectMenu() = printfn "starting..." let package = new FSharpProjectPackage() @@ -51,7 +53,7 @@ type Project() = Assert.Fail("Unexpected: New Folder was not enabled") () - [] + [] member public this.``FsprojFileToSolutionExplorer.FileOrderInFsprojIsRespected.Case1``() = let compileItems = ["one.fs"; "two.fs"; "three.fs"] let expect = Tree("References", ANYTREE, @@ -63,7 +65,7 @@ type Project() = // "one" "three" "two" this.``FsprojFileToSolutionExplorer.PositiveTest``(compileItems, "", expect) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileOrderInFsprojIsRespected.Case2``() = let compileItems = [@"A\B\D\foo.fs"; @"A\B\C\bar.fs"] let expect = Tree("References", ANYTREE, @@ -79,7 +81,7 @@ type Project() = // no alphabetization of files or folders this.``FsprojFileToSolutionExplorer.PositiveTest``(compileItems, "", expect) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileOrderInFsprojIsRespected.Case3``() = let compileItems = [@"B\foo.fs"; @"A\bar.fs"] let other = @" @@ -99,7 +101,7 @@ type Project() = // Including folder should not put folder at front of other folders this.``FsprojFileToSolutionExplorer.PositiveTest``(compileItems, other, expect) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileOrderInFsprojIsRespected.Case4``() = let compileItems = [@"foo.fs"; @"A\bar.fs"] let other = @" @@ -119,7 +121,7 @@ type Project() = this.``FsprojFileToSolutionExplorer.PositiveTest``(compileItems, other, expect) - [] + [] member public this.``FsprojFileToSolutionExplorer.LinksIntoFoldersAreRespected``() = let compileItems = [] let other = @" @@ -144,7 +146,7 @@ type Project() = this.``FsprojFileToSolutionExplorer.PositiveTest``(compileItems, other, expect) - [] + [] member public this.``Links.AddLinkToRootWorks``() = let compileItems = [@"Folder\foo.fs"; @"bar.fs"; ] this.MakeProjectAndDoWithProjectFile(compileItems, [], "", (fun project fileName -> @@ -168,7 +170,7 @@ type Project() = TheTests.HelpfulAssertMatches '<' regexStr fsprojFileText )) - [] + [] member public this.``Links.AddLinkToSubfolderWorks``() = let compileItems = [@"bar.fs"; @"Folder\foo.fs"; ] this.MakeProjectAndDoWithProjectFile(compileItems, [], "", (fun project fileName -> @@ -190,7 +192,7 @@ type Project() = TheTests.HelpfulAssertMatches '<' regexStr fsprojFileText )) - [] + [] member public this.``Links.AddLinkToRootWorksForNonFsFile``() = let compileItems = [@"Folder\foo.fs"; @"bar.fs"; ] this.MakeProjectAndDoWithProjectFile(compileItems, [], "", (fun project fileName -> @@ -214,7 +216,7 @@ type Project() = TheTests.HelpfulAssertMatches '<' regexStr fsprojFileText )) - [] + [] member public this.``Removal.ExcludeFileShouldDirtyProjectFileAndBeSeenOnDiskAfterSave``() = let items = MSBuildItems([CompileItem "foo.fs"; CompileItem "bar.fs"]) this.MakeProjectAndDoWithProjectFile([], [], items.ToString(), (fun project fileName -> @@ -235,7 +237,7 @@ type Project() = AssertEqualMsg false (fsprojFileText.Contains(toVerify)) "it was not removed from the .fsproj on disk" )) - [] + [] member public this.``Removal.RemoveReferenceShouldDirtyProjectFileAndBeSeenOnDiskAfterSave``() = let items = MSBuildItems([CompileItem "foo.fs"; CompileItem "bar.fs"]) this.MakeProjectAndDoWithProjectFile([], ["System"], items.ToString(), (fun project fileName -> @@ -256,7 +258,7 @@ type Project() = AssertEqualMsg false (fsprojFileText.Contains(toVerify)) "it was not removed from the .fsproj on disk" )) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.MoveUpShouldDirtyProject``() = let items = MSBuildItems([CompileItem "foo.fs"; CompileItem "bar.fs"]) this.MakeProjectAndDoWithProjectFile([], [], items.ToString(), (fun project fileName -> @@ -273,7 +275,7 @@ type Project() = TheTests.AssertSameTree(expect, project.FirstChild) )) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.MoveDownShouldDirtyProject``() = let items = MSBuildItems([CompileItem "foo.fs"; CompileItem "bar.fs"]) this.MakeProjectAndDoWithProjectFile([], [], items.ToString(), (fun project fileName -> @@ -299,7 +301,7 @@ type Project() = member private this.SampleFolderWithItemsEntity = ([CompileItem @"MyFolder\x1.fs"; CompileItem @"MyFolder\Sub\x2.fs"; CompileItem @"MyFolder\x3.fs"], fun t -> Tree("MyFolder",Tree("x1.fs", Nil, Tree("Sub", Tree("x2.fs", Nil, Nil), Tree("x3.fs", Nil, Nil))), t)) - [] + [] member public this.``SpecificVersion.OptionsSavedToFsprojFile``() = let items = MSBuildItems( [CompileItem "foo.fs"] ) this.MakeProjectAndDoWithProjectFile([], ["System"], items.ToString(), (fun project fileName -> @@ -314,12 +316,12 @@ type Project() = let expected = XDocument.Load(new StringReader(@"True")).Root TheTests.AssertSimilarXml(expected, e) let inc = e.Attributes() |> WithAttrName "Include" |> Seq.head - Assert.IsTrue(inc.Value.StartsWith("System, Version", StringComparison.Ordinal), "assembly reference lacks version")) + Assert.True(inc.Value.StartsWith("System, Version", StringComparison.Ordinal), "assembly reference lacks version")) false, (fun (e:XElement) -> let expected = XDocument.Load(new StringReader(@"False")).Root TheTests.AssertSimilarXml(expected, e) let inc = e.Attributes() |> WithAttrName "Include" |> Seq.head - Assert.IsTrue(inc.Value.StartsWith("System, Version", StringComparison.Ordinal), "assembly reference lacks version")) + Assert.True(inc.Value.StartsWith("System, Version", StringComparison.Ordinal), "assembly reference lacks version")) |] let props = system.NodeProperties :?> AssemblyReferenceProperties for v, f in a do @@ -333,7 +335,7 @@ type Project() = f refNode )) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileRenaming.RenamingAFileDoesNotChangeOrderInSolutionExplorerOrMSBuild``() = for entity, treeMaker in [this.SampleFileEntity; this.SampleEmptyFolderEntity] do let items = MSBuildItems( [CompileItem "foo.fs"] @ entity ) @@ -390,15 +392,15 @@ type Project() = TheTests.HelpfulAssertMatches '<' regexStr fsprojFileText )) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedUpAboveFile``() = this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedUpAbove``(this.SampleFileEntity) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedUpAboveEmptyFolder``() = this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedUpAbove``(this.SampleEmptyFolderEntity) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedUpAboveFolderWithItems``() = this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedUpAbove``(this.SampleFolderWithItemsEntity) @@ -431,15 +433,15 @@ type Project() = TheTests.HelpfulAssertMatches '<' regexStr fsprojFileText )) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedDownBelowFile``() = this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedDownBelow``(this.SampleFileEntity) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedDownBelowEmptyFolder``() = this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedDownBelow``(this.SampleEmptyFolderEntity) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedDownBelowFolderWithItems``() = this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedDownBelow``(this.SampleFolderWithItemsEntity) @@ -484,15 +486,15 @@ type Project() = TheTests.HelpfulAssertMatches '<' regexStr fsprojFileText )) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedUpAboveFile``() = this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedUpAbove``(this.SampleFileEntity) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedUpAboveEmptyFolder``() = this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedUpAbove``(this.SampleEmptyFolderEntity) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedUpAboveFolderWithItems``() = this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedUpAbove``(this.SampleFolderWithItemsEntity) @@ -537,19 +539,19 @@ type Project() = TheTests.HelpfulAssertMatches '<' regexStr fsprojFileText )) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedDownBelowFile``() = this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedDownBelow``(this.SampleFileEntity) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedDownBelowEmptyFolder``() = this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedDownBelow``(this.SampleEmptyFolderEntity) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedDownBelowFolderWithItems``() = this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedDownBelow``(this.SampleFolderWithItemsEntity) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.NegativeTests.EntityCannotBeMovedAboveReferences``() = for entity in this.SampleEntities do printfn "=========> testing moving %s" (entity.ToString()) @@ -562,7 +564,7 @@ type Project() = let foo = TheTests.FindNodeWithCaption(project, entity.Caption()) TheTests.EnsureMoveUpDisabled(foo) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.NegativeTests.EntityCannotBeMovedUpWhenTopOfFolder``() = for entity in this.SampleEntities |> List.map (fun e -> e.IntoFolder(@"Folder\")) do printfn "=========> testing moving %s" (entity.ToString()) @@ -575,7 +577,7 @@ type Project() = let bar = TheTests.FindNodeWithCaption(project, entity.Caption()) TheTests.EnsureMoveUpDisabled(bar) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.NegativeTests.EntityCannotBeMovedDownWhenBottomOfFolder``() = for entity in this.SampleEntities |> List.map (fun e -> e.IntoFolder(@"Folder\")) do printfn "=========> testing moving %s" (entity.ToString()) @@ -588,7 +590,7 @@ type Project() = let bar = TheTests.FindNodeWithCaption(project, entity.Caption()) TheTests.EnsureMoveDownDisabled(bar) - [] + [] member public this.``RenameFile.FailureToRenameInRDT.Bug616680.EnsureRevertToKnownConsistentState``() = this.MakeProjectAndDo(["orig1.fs"], [], "", (fun project -> let absFilePath = Path.Combine(project.ProjectFolder, "orig1.fs") @@ -615,7 +617,7 @@ type Project() = File.Delete(absFilePath) )) - [] + [] member public this.``RenameFile.FailureToRenameInRDT.Bug616680.EnsureThatFileOrderDidNotChange``() = this.MakeProjectAndDo(["a.fs";"b.fs";"orig1.fs";"c.fs";"d.fs"], [], "", (fun project -> let absFilePath = Path.Combine(project.ProjectFolder, "orig1.fs") @@ -646,7 +648,7 @@ type Project() = File.Delete(absFilePath) )) - [] + [] member public this.``RenameFile.VerifyItemIdsRemainsTheSame``() = let name1 = "orig.fs" let name2 = "orig2.fs" @@ -668,7 +670,7 @@ type Project() = File.Delete(absFilePath) )) - [] + [] member public this.``RenameFile.MainlineSuccessCase``() = this.MakeProjectAndDo(["orig1.fs"], [], "", (fun project -> let absFilePath = Path.Combine(project.ProjectFolder, "orig1.fs") @@ -694,7 +696,7 @@ type Project() = File.Delete(absFilePath) )) - [] //ref bug https://github.com/dotnet/fsharp/issues/259 + [] //ref bug https://github.com/dotnet/fsharp/issues/259 member public this.``RenameFile.InFolder``() = this.MakeProjectAndDo(["file1.fs"; @"Folder1\file2.fs"; @"Folder1\nested1.fs"], [], "", (fun project -> let absFilePath = Path.Combine(project.ProjectFolder, "Folder1", "nested1.fs") @@ -757,7 +759,7 @@ type Project() = (* Disabled for now - see https://github.com/dotnet/fsharp/pull/3071 - this is testing old project system features - [] + [] member public this.``RenameFile.BuildActionIsResetBasedOnFilenameExtension``() = let GetTextFromBuildAction (action:VSLangProj.prjBuildAction) = match action with @@ -832,8 +834,7 @@ type Project() = *) - [] - [] + [] member public this.``FsprojOutputWindow.ErrorOriginColumnsAreBase1``() = let (outputWindowPaneErrors : string list ref) = ref [] // output window pane errors let vso = VsMocks.vsOutputWindowPane(outputWindowPaneErrors) @@ -856,8 +857,7 @@ type Project() = AssertEqual (List.length errors) 1 ) - [] - [] + [] member public this.``FsprojOutputWindow.HighUnicodeCharactersAreProperlyDisplayed``() = let (outputWindowPaneErrors : string list ref) = ref [] // output window pane errors let vso = VsMocks.vsOutputWindowPane(outputWindowPaneErrors) diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.ProjectItems.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.ProjectItems.fs index 3e1e26c8f22..26c25a7edf6 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.ProjectItems.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.ProjectItems.fs @@ -4,20 +4,19 @@ namespace Tests.ProjectSystem open System open System.IO -open NUnit.Framework +open Xunit open UnitTests.TestLib.Utils.Asserts open UnitTests.TestLib.ProjectSystem open Microsoft.VisualStudio.FSharp.ProjectSystem -[][] type ProjectItems() = inherit TheTests() //TODO: look for a way to remove the helper functions static let ANYTREE = Tree("",Nil,Nil) - [] + [] member public this.``RemoveAssemblyReference.NoIVsTrackProjectDocuments2Events``() = this.MakeProjectAndDo(["file.fs"], ["System.Numerics"],"", (fun project -> let listener = project.Site.GetService(typeof) :?> Salsa.VsMocks.IVsTrackProjectDocuments2Listener @@ -28,7 +27,7 @@ type ProjectItems() = |> Array.exists (fun f -> f.IndexOf("System.Numerics") <> -1) let mutable wasCalled = false - Assert.IsTrue(containsSystemNumerics (), "Project should contains reference to System.Numerics") + Assert.True(containsSystemNumerics (), "Project should contains reference to System.Numerics") let refContainer = project.GetReferenceContainer() let reference = @@ -39,11 +38,11 @@ type ProjectItems() = reference.Remove(false) ) - Assert.IsFalse(wasCalled, "No events from IVsTrackProjectDocuments2 are expected") - Assert.IsFalse(containsSystemNumerics(), "Project should not contains reference to System.Numerics") + Assert.False(wasCalled, "No events from IVsTrackProjectDocuments2 are expected") + Assert.False(containsSystemNumerics(), "Project should not contains reference to System.Numerics") )) - [] + [] member public this.``AddNewItem.ItemAppearsAtBottomOfFsprojFile``() = this.MakeProjectAndDo(["orig.fs"], [], "", (fun project -> let absFilePath = Path.Combine(project.ProjectFolder, "a.fs") @@ -58,7 +57,7 @@ type ProjectItems() = File.Delete(absFilePath) )) - [] + [] member public this.``AddNewItem.ToAFolder.ItemAppearsAtBottomOfFolder``() = this.MakeProjectAndDo(["orig.fs"; "Folder\\f1.fs"; "Folder\\f2.fs"; "final.fs"], [], "", (fun project -> let dir = Path.Combine(project.ProjectFolder, "Folder") @@ -75,7 +74,7 @@ type ProjectItems() = File.Delete(absFilePath) )) - [] + [] member public this.``AddNewItemBelow.ItemAppearsInRightSpot``() = this.MakeProjectAndDo(["orig1.fs"; "orig2.fs"], [], "", (fun project -> let absFilePath = Path.Combine(project.ProjectFolder, "new.fs") @@ -98,7 +97,7 @@ type ProjectItems() = File.Delete(absFilePath) )) - [] + [] member public this.``AddNewItemAbove.ItemAppearsInRightSpot.Case1``() = this.MakeProjectAndDo(["orig1.fs"; "orig2.fs"], [], "", (fun project -> let absFilePath = Path.Combine(project.ProjectFolder, "new.fs") @@ -121,7 +120,7 @@ type ProjectItems() = File.Delete(absFilePath) )) - [] + [] member public this.``AddNewItemAbove.ItemAppearsInRightSpot.Case2``() = this.MakeProjectAndDo(["orig1.fs"; "orig2.fs"], [], "", (fun project -> let absFilePath = Path.Combine(project.ProjectFolder, "new.fs") diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs index f64efebaefe..5d9e702cfe9 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs @@ -7,7 +7,7 @@ open System.Collections.Generic open System.IO open System.Reflection -open NUnit.Framework +open Xunit open UnitTests.TestLib.Utils.Asserts open UnitTests.TestLib.Utils.FilesystemHelpers open UnitTests.TestLib.ProjectSystem @@ -16,7 +16,6 @@ open Microsoft.VisualStudio.FSharp.ProjectSystem open Microsoft.VisualStudio.Shell.Interop open System.Xml.Linq -[][] type References() = inherit TheTests() @@ -41,25 +40,25 @@ type References() = let fooPath = Path.Combine(project.ProjectFolder, "foo.fs") File.AppendAllText(fooPath, "namespace Foo\nmodule Bar =\n let x = 42") let buildResult = project.Build("Build") - Assert.IsTrue buildResult.IsSuccessful + Assert.True buildResult.IsSuccessful let exe = Path.Combine(project.ProjectFolder, "bin\\Debug\\Test.exe") k exe)) - [] + [] member this.``BasicAssemblyReferences1``() = this.MakeProjectAndDo([], ["System"], "", (fun proj -> let systemRef = proj.FirstChild.FirstChild :?> AssemblyReferenceNode - Assert.IsTrue(systemRef.CanShowDefaultIcon()) + Assert.True(systemRef.CanShowDefaultIcon()) )) - [] + [] member this.``BasicAssemblyReferences2``() = this.MakeProjectAndDo([], ["System.Net"], "", (fun proj -> let systemRef = proj.FirstChild.FirstChild :?> AssemblyReferenceNode - Assert.IsTrue(systemRef.CanShowDefaultIcon()) + Assert.True(systemRef.CanShowDefaultIcon()) )) - [] + [] member this.``AddReference.StarredAssemblyName`` () = DoWithTempFile "Test.fsproj" (fun projFile -> File.AppendAllText(projFile, TheTests.SimpleFsprojText([], [], "")) @@ -67,11 +66,11 @@ type References() = let assemblyName = new AssemblyName(typeof.Assembly.FullName) let selectorData = new VSCOMPONENTSELECTORDATA(``type`` = VSCOMPONENTTYPE.VSCOMPONENTTYPE_ComPlus, bstrFile = "*" + assemblyName.FullName) let refContainer = GetReferenceContainerNode(project) - refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.IsNotNull + refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.NotNull let l = new List() project.FindNodesOfType(l) - Assert.AreEqual(1, l.Count) - Assert.AreEqual("System.Windows.Forms", l.[0].Caption) + Assert.Equal(1, l.Count) + Assert.Equal("System.Windows.Forms", l.[0].Caption) SaveProject(project) let fsprojFileText = File.ReadAllText(project.FileName) printfn "%s" fsprojFileText @@ -79,34 +78,32 @@ type References() = TheTests.HelpfulAssertMatches '<' expectedFsprojRegex fsprojFileText ) - [] - [] + [] member this.``References.Bug787899.AddDuplicateUnresolved``() = // Let's create a run-of-the-mill project just to have a spare assembly around this.CreateDummyTestProjectBuildItAndDo(fun exe -> - Assert.IsTrue(File.Exists exe, "failed to build exe") + Assert.True(File.Exists exe, "failed to build exe") this.MakeProjectAndDoWithProjectFile(["doesNotMatter.fs"], ["mscorlib"; "System"; "System.Core"; "System.Net"], ".\\Test.dll", "v4.0", (fun project file -> let assemRef = TheTests.FindNodeWithCaption(project, "Test") :?> AssemblyReferenceNode - Assert.IsFalse(assemRef.CanShowDefaultIcon(), "reference should be banged out, does not resolve") + Assert.False(assemRef.CanShowDefaultIcon(), "reference should be banged out, does not resolve") // add reference to Test.exe let selectorData = new VSCOMPONENTSELECTORDATA(``type`` = VSCOMPONENTTYPE.VSCOMPONENTTYPE_File, bstrFile = exe) let refContainer = GetReferenceContainerNode(project) - refContainer.AddReferenceFromSelectorData(selectorData) |> (fun x -> Assert.IsNotNull(x, "expected AddReference to succeed")) + refContainer.AddReferenceFromSelectorData(selectorData) |> (fun x -> Assert.NotNull(x)) // it should have succeeded (no throw) )) ) - [] - [] + [] member this.``References.Bug787899.AddDuplicateResolved``() = // Let's create a run-of-the-mill project just to have a spare assembly around this.CreateDummyTestProjectBuildItAndDo(fun exe -> - Assert.IsTrue(File.Exists exe, "failed to build exe") + Assert.True(File.Exists exe, "failed to build exe") this.MakeProjectAndDoWithProjectFile(["doesNotMatter.fs"], ["mscorlib"; "System"; "System.Core"; "System.Net"], sprintf "%s" exe, "v4.0", (fun project file -> let assemRef = TheTests.FindNodeWithCaption(project, "Test") :?> AssemblyReferenceNode - Assert.IsTrue(assemRef.CanShowDefaultIcon(), "reference should not be banged out, does resolve") + Assert.True(assemRef.CanShowDefaultIcon(), "reference should not be banged out, does resolve") // add reference to Test.exe let selectorData = new VSCOMPONENTSELECTORDATA(``type`` = VSCOMPONENTTYPE.VSCOMPONENTTYPE_File, bstrFile = exe) let refContainer = GetReferenceContainerNode(project) @@ -114,11 +111,11 @@ type References() = refContainer.AddReferenceFromSelectorData(selectorData) |> ignore Assert.Fail("expected AddReference to Fail") with :? InvalidOperationException as e -> - Assert.AreEqual("A reference to 'Test' (with assembly name 'Test') could not be added. A reference to the component 'Test' with the same assembly name already exists in the project.", e.Message) + Assert.Equal("A reference to 'Test' (with assembly name 'Test') could not be added. A reference to the component 'Test' with the same assembly name already exists in the project.", e.Message) )) ) - [] + [] member this.``ReferenceResolution.Bug4423.LoadedFsProj.Works``() = this.MakeProjectAndDo(["doesNotMatter.fs"], ["mscorlib"; "System"; "System.Core"; "System.Net"], "", "v4.0", (fun project -> let expectedRefInfo = [ "mscorlib", true @@ -136,7 +133,7 @@ type References() = )) - [] + [] member this.``ReferenceResolution.Bug4423.LoadedFsProj.WithExactDuplicates``() = this.MakeProjectAndDo(["doesNotMatter.fs"], ["System"; "System"], "", "v4.0", (fun project -> let expectedRefInfo = [ "System", true // In C#, one will be banged out, whereas @@ -151,7 +148,7 @@ type References() = AssertEqual expectedRefInfo actualRefInfo )) - [] + [] member this.``ReferenceResolution.Bug4423.LoadedFsProj.WithBadDuplicates``() = this.MakeProjectAndDo(["doesNotMatter.fs"], ["System"; "System.dll"], "", "v4.0", (fun project -> let expectedRefInfo = [ "System", false // one will be banged out @@ -166,7 +163,7 @@ type References() = AssertEqual expectedRefInfo actualRefInfo )) - [] + [] member this.``ReferenceResolution.Bug4423.LoadedFsProj.WorksWithFilenames``() = let netDir = currentFrameworkDirectory let ssmw = Path.Combine(netDir, "System.ServiceModel.Web.dll") @@ -182,7 +179,7 @@ type References() = AssertEqual expectedRefInfo actualRefInfo )) - [] + [] member this.``ReferenceResolution.Bug4423.LoadedFsProj.WeirdCases``() = this.MakeProjectAndDo(["doesNotMatter.fs"], ["mscorlib, Version=4.0.0.0"; "System, Version=4.0.0.0"; "System.Core, Version=4.0.0.0"; "System.Net, Version=4.0.0.0"], "", "v4.0", (fun project -> let expectedRefInfo = [ "mscorlib", true @@ -212,14 +209,14 @@ type References() = | _ -> failwith "unexpected" let selectorData = new VSCOMPONENTSELECTORDATA(``type`` = cType, bstrFile = fullPath) let refContainer = GetReferenceContainerNode(project) - refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.IsNotNull + refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.NotNull SaveProject(project) let fsprojFileText = File.ReadAllText(project.FileName) printfn "%s" fsprojFileText TheTests.HelpfulAssertMatches '<' expectedFsprojRegex fsprojFileText )) - [] + [] member this.``ReferenceResolution.Bug4423.FxAssembly.NetTab.AddDuplicate1``() = let netDir = currentFrameworkDirectory try @@ -232,7 +229,7 @@ type References() = with e -> TheTests.HelpfulAssertMatches ' ' "A reference to '.*' \\(with assembly name '.*'\\) could not be added. A reference to the component '.*' with the same assembly name already exists in the project." e.Message -// see 5491 [] +// see 5491 [] member this.``ReferenceResolution.Bug4423.FxAssembly.NetTab.AddDuplicate2``() = let netDir = currentFrameworkDirectory try @@ -245,12 +242,11 @@ type References() = with e -> TheTests.HelpfulAssertMatches ' ' "A reference to '.*' could not be added. A reference to the component '.*' already exists in the project." e.Message - [] - [] + [] member this.``ReferenceResolution.Bug4423.NonFxAssembly.BrowseTab.RelativeHintPath.InsideProjectDir``() = // Let's create a run-of-the-mill project just to have a spare assembly around this.CreateDummyTestProjectBuildItAndDo(fun exe -> - Assert.IsTrue(File.Exists exe, "failed to build exe") + Assert.True(File.Exists exe, "failed to build exe") // Now let's create an assembly reference to it and ensure we get expected relative HintPath let expectedFsprojRegex = @"" + @"\s*Test.exe" // in this directory @@ -258,10 +254,10 @@ type References() = this.MakeProjectAndDo(["bar.fs"], [], "", "v4.5", (fun project -> let exeCopy = Path.Combine(project.ProjectFolder, "Test.exe") File.Copy(exe, exeCopy, true) - Assert.IsTrue(File.Exists exeCopy, "failed to build exe") + Assert.True(File.Exists exeCopy, "failed to build exe") let selectorData = new VSCOMPONENTSELECTORDATA(``type`` = VSCOMPONENTTYPE.VSCOMPONENTTYPE_File, bstrFile = exeCopy) let refContainer = GetReferenceContainerNode(project) - refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.IsNotNull + refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.NotNull SaveProject(project) let fsprojFileText = File.ReadAllText(project.FileName) printfn "%s" fsprojFileText @@ -269,26 +265,25 @@ type References() = // Finally, ensure that the reference works as expected project.Reload() let assemRef = TheTests.FindNodeWithCaption(project, "Test") :?> AssemblyReferenceNode - Assert.IsTrue(assemRef.CanShowDefaultIcon(), "the reference could not be resolved") + Assert.True(assemRef.CanShowDefaultIcon(), "the reference could not be resolved") // Use the referenced DLL as a double-check let barPath = Path.Combine(project.ProjectFolder, "bar.fs") File.AppendAllText(barPath, "printfn \"%d\" Foo.Bar.x") // code that requires the referenced assembly to successfully compile let buildResult = project.Build("Build") - Assert.IsTrue buildResult.IsSuccessful + Assert.True buildResult.IsSuccessful )) ) - [] - [] + [] member this.``ReferenceResolution.Bug4423.NonFxAssembly.BrowseTab.RelativeHintPath.OutsideProjectDir``() = this.MakeProjectAndDo(["foo.fs"], [], "", (fun project -> // Let's create a run-of-the-mill let fooPath = Path.Combine(project.ProjectFolder, "foo.fs") File.AppendAllText(fooPath, "namespace Foo\nmodule Bar =\n let x = 42") let buildResult = project.Build("Build") - Assert.IsTrue buildResult.IsSuccessful + Assert.True buildResult.IsSuccessful let exe = Path.Combine(project.ProjectFolder, "bin\\Debug\\Test.exe") - Assert.IsTrue(File.Exists exe, "failed to build exe") + Assert.True(File.Exists exe, "failed to build exe") // Now let's create an assembly reference to it and ensure we get expected relative HintPath let expectedFsprojRegex = @"" + @"\s*\.\.\\.*?" // the point is, some path start with "..\", since both projects are rooted somewhere in the temp directory (where unit tests create them) @@ -296,7 +291,7 @@ type References() = this.MakeProjectAndDo(["bar.fs"], [], "", "v4.5", (fun project -> let selectorData = new VSCOMPONENTSELECTORDATA(``type`` = VSCOMPONENTTYPE.VSCOMPONENTTYPE_File, bstrFile = exe) let refContainer = GetReferenceContainerNode(project) - refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.IsNotNull + refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.NotNull SaveProject(project) let fsprojFileText = File.ReadAllText(project.FileName) printfn "%s" fsprojFileText @@ -304,16 +299,16 @@ type References() = // Finally, ensure that the reference works as expected project.Reload() let assemRef = TheTests.FindNodeWithCaption(project, "Test") :?> AssemblyReferenceNode - Assert.IsTrue(assemRef.CanShowDefaultIcon(), "the reference could not be resolved") + Assert.True(assemRef.CanShowDefaultIcon(), "the reference could not be resolved") // Use the referenced DLL as a double-check let barPath = Path.Combine(project.ProjectFolder, "bar.fs") File.AppendAllText(barPath, "printfn \"%d\" Foo.Bar.x") // code that requires the referenced assembly to successfully compile let buildResult = project.Build("Build") - Assert.IsTrue buildResult.IsSuccessful + Assert.True buildResult.IsSuccessful )) )) - [] + [] member this.``ReferenceResolution.Bug4423.NotAValidDll.BrowseTab``() = let dirName = Path.GetTempPath() let dll = Path.Combine(dirName, "Foo.dll") @@ -323,7 +318,7 @@ type References() = let selectorData = new VSCOMPONENTSELECTORDATA(``type`` = VSCOMPONENTTYPE.VSCOMPONENTTYPE_File, bstrFile = dll) let refContainer = GetReferenceContainerNode(project) try - refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.IsNotNull + refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.NotNull Assert.Fail("this should not have succeeded") with e -> AssertContains e.Message "could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component." @@ -331,14 +326,14 @@ type References() = finally File.Delete(dll) - [] + [] member this.``PathReferences.Existing`` () = DoWithTempFile "Test.fsproj"(fun projFile -> let dirName = Path.GetDirectoryName(projFile) let libDirName = Directory.CreateDirectory(Path.Combine(dirName, "lib")).FullName let codeBase = (new Uri(Assembly.GetExecutingAssembly().EscapedCodeBase)).LocalPath |> Path.GetDirectoryName - let refLibPath = Path.Combine(libDirName, "nunit.framework.dll") - File.Copy(Path.Combine(codeBase, "nunit.framework.dll"), refLibPath) + let refLibPath = Path.Combine(libDirName, "xunit.core.dll") + File.Copy(Path.Combine(codeBase, "xunit.core.dll"), refLibPath) File.AppendAllText(projFile, TheTests.SimpleFsprojText([], [refLibPath], "")) use project = TheTests.CreateProject(projFile) let l = new List() @@ -346,14 +341,14 @@ type References() = AssertEqual 1 l.Count AssertEqual refLibPath l.[0].Url AssertEqual refLibPath l.[0].Caption // when Include is a filename, entirety is caption - Assert.IsNotNull(l.[0].ResolvedAssembly) + Assert.NotNull(l.[0].ResolvedAssembly) let refContainer = let l = new List() project.FindNodesOfType(l) l.[0] let mscorlibPath = (new Uri("".GetType().Assembly.EscapedCodeBase)).LocalPath let selectorData = new VSCOMPONENTSELECTORDATA(``type`` = VSCOMPONENTTYPE.VSCOMPONENTTYPE_ComPlus, bstrFile = mscorlibPath) - refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.IsNotNull + refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.NotNull let l = new List() project.FindNodesOfType(l) AssertEqual 2 l.Count @@ -362,7 +357,7 @@ type References() = AssertEqual "mscorlib" l.[1].Caption ) - [] + [] member this.``PathReferences.Existing.Captions`` () = DoWithTempFile "Test.fsproj"(fun projFile -> File.AppendAllText(projFile, TheTests.FsprojTextWithProjectReferences( @@ -375,12 +370,12 @@ type References() = project.FindNodesOfType(l) AssertEqual 2 l.Count AssertEqual "System.dll" l.[0].Caption - Assert.IsNotNull(l.[0].ResolvedAssembly) + Assert.NotNull(l.[0].ResolvedAssembly) AssertEqual "System.Net.dll" l.[1].Caption - Assert.IsNotNull(l.[1].ResolvedAssembly) + Assert.NotNull(l.[1].ResolvedAssembly) ) - [] + [] member this.``PathReferences.NonExistent`` () = DoWithTempFile "Test.fsproj"(fun projFile -> let refLibPath = @"c:\foo\baz\blahblah.dll" @@ -390,11 +385,11 @@ type References() = project.FindNodesOfType(l) AssertEqual 1 l.Count AssertEqual refLibPath l.[0].Caption - Assert.IsNull(l.[0].ResolvedAssembly) + Assert.Null(l.[0].ResolvedAssembly) ) - [] + [] member this.``FsprojPreferencePage.ProjSupportsPrefReadWrite``() = let testProp = "AssemblyName" let compileItem = [@"foo.fs"] @@ -431,7 +426,7 @@ type References() = // Disabled due to: https://github.com/dotnet/fsharp/issues/1460 // On DEV 15 Preview 4 the VS IDE Test fails with : // System.InvalidOperationException : Operation is not valid due to the current state of the object. - // [] // Disabled due to: https://github.com/dotnet/fsharp/issues/1460 + // [] // Disabled due to: https://github.com/dotnet/fsharp/issues/1460 member this.``AddReference.COM`` () = DoWithTempFile "Test.fsproj" (fun projFile -> File.AppendAllText(projFile, TheTests.SimpleFsprojText([], [], "")) @@ -450,23 +445,23 @@ type References() = let comReference = refContainer.AddReferenceFromSelectorData(selectorData) // check reference node properties - Assert.IsNotNull comReference - Assert.IsTrue(comReference :? ComReferenceNode) + Assert.NotNull comReference + Assert.True(comReference :? ComReferenceNode) let comRef = comReference :?> ComReferenceNode - Assert.AreEqual(1, comRef.MajorVersionNumber) - Assert.AreEqual(0, comRef.MinorVersionNumber) - Assert.AreEqual(guid, comRef.TypeGuid) - Assert.AreEqual("Microsoft Shell Controls And Automation", comRef.Caption) + Assert.Equal(1, comRef.MajorVersionNumber) + Assert.Equal(0, comRef.MinorVersionNumber) + Assert.Equal(guid, comRef.TypeGuid) + Assert.Equal("Microsoft Shell Controls And Automation", comRef.Caption) let sysDirectory = Environment.GetFolderPath(Environment.SpecialFolder.SystemX86) - Assert.IsTrue(String.Compare(Path.Combine(sysDirectory, "shell32.dll"), comRef.InstalledFilePath, StringComparison.OrdinalIgnoreCase) = 0) + Assert.True(String.Compare(Path.Combine(sysDirectory, "shell32.dll"), comRef.InstalledFilePath, StringComparison.OrdinalIgnoreCase) = 0) // check node exists under references let l = new List() project.FindNodesOfType(l) - Assert.AreEqual(1, l.Count) + Assert.Equal(1, l.Count) let referenceNode = l.[0] - Assert.AreSame(comRef, referenceNode) + Assert.Same(comRef, referenceNode) // check saved msbuild item SaveProject(project) @@ -475,13 +470,13 @@ type References() = let xn s = fsproj.Root.GetDefaultNamespace().GetName(s) let comReferencesXml = fsproj.Descendants(xn "COMReference") |> Seq.toList - Assert.AreEqual(1, comReferencesXml |> List.length) + Assert.Equal(1, comReferencesXml |> List.length) let comRefXml = comReferencesXml |> List.head - Assert.AreEqual("Microsoft Shell Controls And Automation", comRefXml.Attribute(XName.Get("Include")).Value) - Assert.AreEqual(guid, Guid(comRefXml.Element(xn "Guid").Value)) - Assert.AreEqual("1", comRefXml.Element(xn "VersionMajor").Value) - Assert.AreEqual("0", comRefXml.Element(xn "VersionMinor").Value) - Assert.AreEqual("0", comRefXml.Element(xn "Lcid").Value) + Assert.Equal("Microsoft Shell Controls And Automation", comRefXml.Attribute(XName.Get("Include")).Value) + Assert.Equal(guid, Guid(comRefXml.Element(xn "Guid").Value)) + Assert.Equal("1", comRefXml.Element(xn "VersionMajor").Value) + Assert.Equal("0", comRefXml.Element(xn "VersionMinor").Value) + Assert.Equal("0", comRefXml.Element(xn "Lcid").Value) ) diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.RoundTrip.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.RoundTrip.fs index 1aad389737d..56aaf84d713 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.RoundTrip.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.RoundTrip.fs @@ -5,14 +5,13 @@ namespace Tests.ProjectSystem open System open System.IO open System.Text.RegularExpressions -open NUnit.Framework +open Xunit open UnitTests.TestLib.Utils.Asserts open UnitTests.TestLib.Utils.FilesystemHelpers open UnitTests.TestLib.ProjectSystem open Microsoft.VisualStudio.FSharp.ProjectSystem -[][] type RoundTrip() = inherit TheTests() @@ -43,7 +42,7 @@ type RoundTrip() = Assert.Fail("did not remove empty ItemGroups") )) - [] + [] member public this.``FsprojRoundTrip.Basic.NonemptyFoldersRemoved.Case1``() = this.``FsprojRoundtrip.PositiveTest``( MSBuildItems [CompileItem @"bar.fs" @@ -52,7 +51,7 @@ type RoundTrip() = MSBuildItems [CompileItem @"bar.fs" CompileItem @"Folder\foo.fs"]) - [] + [] member public this.``FsprojRoundTrip.Basic.NonemptyFoldersRemoved.Case2``() = this.``FsprojRoundtrip.PositiveTest``( MSBuildItems [CompileItem @"bar.fs" @@ -65,7 +64,7 @@ type RoundTrip() = CompileItem @"A\B\C\foo.fs" CompileItem @"A\qux.fs"]) - [] + [] member public this.``FsprojRoundTrip.ComplexButLegalCase``() = let items = MSBuildItems [CompileItem @"A\B\foo.fs" CompileItem @"A\bar.fs" @@ -76,7 +75,7 @@ type RoundTrip() = ] this.``FsprojRoundtrip.PositiveTest``(items, items) - [] + [] member public this.``FsprojRoundTrip.EmptyFoldersArePreservedWhenRestIsIdempotent``() = let items = MSBuildItems [CompileItem @"bar.fs" FolderItem @"A\Empty1\" @@ -85,7 +84,7 @@ type RoundTrip() = CompileItem @"A\qux.fs"] this.``FsprojRoundtrip.PositiveTest``(items, items) - [] + [] member public this.``FsprojRoundTrip.EmptyFoldersArePreservedWhenRestIsLegalButNotIdempotent``() = let origItems = [CompileItem @"bar.fs" FolderItem @"A\Empty1\" @@ -100,13 +99,13 @@ type RoundTrip() = CompileItem @"A\qux.fs"] this.``FsprojRoundtrip.PositiveTest``(MSBuildItems origItems, MSBuildItems expectedItems) - [] + [] member public this.``FsprojRoundTrip.Regression.FoldersWithSameName``() = let items = MSBuildItems [CompileItem @"First\Second\bar.fs" CompileItem @"Second\qux.fs"] this.``FsprojRoundtrip.PositiveTest``(items, items) - [] + [] member public this.``FsprojRoundTrip.Regression.FoldersWithSameName2``() = let items = MSBuildItems [CompileItem @"First\First\bar.fs"] this.``FsprojRoundtrip.PositiveTest``(items, items) @@ -128,21 +127,21 @@ type RoundTrip() = () ) - [] + [] member public this.``FsprojRoundTrip.Basic.Invalid.Case1``() = let items = MSBuildItems [CompileItem @"A\B\C\foo.fs" CompileItem @"B\bar.fs" CompileItem @"A\B\D\qux.fs"] // would cause A to be rendered twice this.``Fsproj.NegativeTest`` items - [] + [] member public this.``FsprojRoundTrip.Basic.Invalid.Case2``() = let items = MSBuildItems [CompileItem @"A\foo.fs" CompileItem @"bar.fs" CompileItem @"A\qux.fs"] // would cause A to be rendered twice this.``Fsproj.NegativeTest`` items - // REVIEW NYI: [] + // REVIEW NYI: [] member public this.``FsprojRoundTrip.Basic.Invalid.Case3``() = let items = MSBuildItems [CompileItem @"A\foo.fs" FolderItem @"A\" // must be before anything below it diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.UpToDate.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.UpToDate.fs index d21681de617..b63ec3eed8e 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.UpToDate.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.UpToDate.fs @@ -18,21 +18,16 @@ open Microsoft.VisualStudio.FSharp open Microsoft.VisualStudio.FSharp.ProjectSystem // Internal unittest namespaces -open NUnit.Framework +open Xunit open Salsa open UnitTests.TestLib.Utils.Asserts open UnitTests.TestLib.Utils.FilesystemHelpers open UnitTests.TestLib.ProjectSystem -[][] type UpToDate() = inherit TheTests() - [] - member public _.Init () = AssemblyResolver.addResolver () - - [] - [] + [] member public this.ItemInputs () = this.MakeProjectAndDo(["file1.fs"], [], @" @@ -64,36 +59,35 @@ type UpToDate() = File.AppendAllText(nonePath, "none") File.AppendAllText(embedPath, "some embedded resource") - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) project.Build(configNameDebug, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) // None items should not affect up-to-date (unless captured by well-known items, e.g. App.config) File.SetLastWriteTime(nonePath, DateTime.UtcNow.AddMinutes(5.)) - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) for path in [sourcePath; contentPath; resourcePath; embedPath; configPath] do printfn "Testing path %s" path // touch file File.SetLastWriteTime(path, DateTime.UtcNow.AddMinutes(5.)) - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) File.SetLastWriteTime(path, startTime) - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) // delete file let originalContent = File.ReadAllText(path) File.Delete(path) - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) File.AppendAllText(path, originalContent) File.SetLastWriteTime(path, startTime) - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) )) - [] - [] + [] member public this.PropertyInputs () = this.MakeProjectAndDo(["file1.fs"], [], @" @@ -117,32 +111,31 @@ type UpToDate() = File.AppendAllText(keyPath, "a key") project.SetConfiguration(config.ConfigCanonicalName); - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) project.Build(configNameDebug, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) for path in [verPath; keyPath] do printfn "Testing path %s" path // touch file File.SetLastWriteTime(path, DateTime.UtcNow.AddMinutes(5.)) - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) File.SetLastWriteTime(path, startTime) - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) // delete file let originalContent = File.ReadAllText(path) File.Delete(path) - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) File.AppendAllText(path, originalContent) File.SetLastWriteTime(path, startTime) - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) )) - [] - [] + [] member public this.ProjectFile () = this.MakeProjectAndDoWithProjectFile(["file1.fs"], [], "", (fun project projFileName -> let configNameDebug = ConfigCanonicalName("Debug", "x86") @@ -153,20 +146,19 @@ type UpToDate() = let startTime = DateTime.UtcNow File.AppendAllText(absFilePath, "printfn \"hello\"") - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) project.Build(configNameDebug, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) // touch proj file File.SetLastWriteTime(projFileName, DateTime.UtcNow.AddMinutes(5.)) - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) File.SetLastWriteTime(projFileName, startTime) - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) )) - [] - [] + [] member public this.References () = let configNameDebug = ConfigCanonicalName("Debug", "x86") let output = VsMocks.vsOutputWindowPane(ref []) @@ -185,9 +177,9 @@ type UpToDate() = let config1 = project1.ConfigProvider.GetProjectConfiguration(configNameDebug) - Assert.IsFalse(config1.IsUpToDate(logger, true)) + Assert.False(config1.IsUpToDate(logger, true)) project1.Build(configNameDebug, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(config1.IsUpToDate(logger, true)) + Assert.True(config1.IsUpToDate(logger, true)) let output1 = Path.Combine(project1.ProjectFolder, "bin\\debug", project1.OutputFileName) @@ -204,24 +196,23 @@ type UpToDate() = let config2 = project2.ConfigProvider.GetProjectConfiguration(configNameDebug) let startTime = DateTime.UtcNow - Assert.IsFalse(config2.IsUpToDate(logger, true)) + Assert.False(config2.IsUpToDate(logger, true)) project2.Build(configNameDebug, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(config2.IsUpToDate(logger, true)) + Assert.True(config2.IsUpToDate(logger, true)) // reference is updated File.SetLastWriteTime(output1, DateTime.UtcNow.AddMinutes(5.)) - Assert.IsFalse(config2.IsUpToDate(logger, true)) + Assert.False(config2.IsUpToDate(logger, true)) File.SetLastWriteTime(output1, startTime) - Assert.IsTrue(config2.IsUpToDate(logger, true)) + Assert.True(config2.IsUpToDate(logger, true)) // reference is missing File.Delete(output1) - Assert.IsFalse(config2.IsUpToDate(logger, true)) + Assert.False(config2.IsUpToDate(logger, true)) ) ) - [] - [] + [] member public this.OutputFiles () = this.MakeProjectAndDo(["file1.fs"], [], @" @@ -249,9 +240,9 @@ type UpToDate() = File.AppendAllText(sourcePath, "printfn \"hello\"") File.AppendAllText(appConfigPath, """""") - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) project.Build(configNameDebug, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) let startTime = DateTime.UtcNow @@ -260,23 +251,22 @@ type UpToDate() = // touch file File.SetLastWriteTime(path, DateTime.UtcNow.AddMinutes(-5.)) - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) File.SetLastWriteTime(path, startTime) - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) // delete file let originalContent = File.ReadAllBytes(path) File.Delete(path) - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) File.WriteAllBytes(path, originalContent) File.SetLastWriteTime(path, startTime) - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) )) - [] - [] + [] member public this.ConfigChanges () = this.MakeProjectAndDo(["file1.fs"], [], "", (fun project -> let configNameDebugx86 = ConfigCanonicalName("Debug", "x86") @@ -295,37 +285,37 @@ type UpToDate() = let sourcePath = Path.Combine(project.ProjectFolder, "file1.fs") File.AppendAllText(sourcePath, "printfn \"hello\"") - Assert.IsFalse(debugConfigx86.IsUpToDate(logger, true)) - Assert.IsFalse(releaseConfigx86.IsUpToDate(logger, true)) - Assert.IsFalse(debugConfigAnyCPU.IsUpToDate(logger, true)) - Assert.IsFalse(releaseConfigAnyCPU.IsUpToDate(logger, true)) + Assert.False(debugConfigx86.IsUpToDate(logger, true)) + Assert.False(releaseConfigx86.IsUpToDate(logger, true)) + Assert.False(debugConfigAnyCPU.IsUpToDate(logger, true)) + Assert.False(releaseConfigAnyCPU.IsUpToDate(logger, true)) project.Build(configNameDebugx86, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(debugConfigx86.IsUpToDate(logger, true)) - Assert.IsFalse(releaseConfigx86.IsUpToDate(logger, true)) - Assert.IsFalse(debugConfigAnyCPU.IsUpToDate(logger, true)) - Assert.IsFalse(releaseConfigAnyCPU.IsUpToDate(logger, true)) + Assert.True(debugConfigx86.IsUpToDate(logger, true)) + Assert.False(releaseConfigx86.IsUpToDate(logger, true)) + Assert.False(debugConfigAnyCPU.IsUpToDate(logger, true)) + Assert.False(releaseConfigAnyCPU.IsUpToDate(logger, true)) project.Build(configNameReleasex86, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(debugConfigx86.IsUpToDate(logger, true)) - Assert.IsTrue(releaseConfigx86.IsUpToDate(logger, true)) - Assert.IsFalse(debugConfigAnyCPU.IsUpToDate(logger, true)) - Assert.IsFalse(releaseConfigAnyCPU.IsUpToDate(logger, true)) + Assert.True(debugConfigx86.IsUpToDate(logger, true)) + Assert.True(releaseConfigx86.IsUpToDate(logger, true)) + Assert.False(debugConfigAnyCPU.IsUpToDate(logger, true)) + Assert.False(releaseConfigAnyCPU.IsUpToDate(logger, true)) project.Build(configNameDebugAnyCPU, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(debugConfigx86.IsUpToDate(logger, true)) - Assert.IsTrue(releaseConfigx86.IsUpToDate(logger, true)) - Assert.IsTrue(debugConfigAnyCPU.IsUpToDate(logger, true)) - Assert.IsFalse(releaseConfigAnyCPU.IsUpToDate(logger, true)) + Assert.True(debugConfigx86.IsUpToDate(logger, true)) + Assert.True(releaseConfigx86.IsUpToDate(logger, true)) + Assert.True(debugConfigAnyCPU.IsUpToDate(logger, true)) + Assert.False(releaseConfigAnyCPU.IsUpToDate(logger, true)) project.Build(configNameReleaseAnyCPU, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(debugConfigx86.IsUpToDate(logger, true)) - Assert.IsTrue(releaseConfigx86.IsUpToDate(logger, true)) - Assert.IsTrue(debugConfigAnyCPU.IsUpToDate(logger, true)) - Assert.IsTrue(releaseConfigAnyCPU.IsUpToDate(logger, true)) + Assert.True(debugConfigx86.IsUpToDate(logger, true)) + Assert.True(releaseConfigx86.IsUpToDate(logger, true)) + Assert.True(debugConfigAnyCPU.IsUpToDate(logger, true)) + Assert.True(releaseConfigAnyCPU.IsUpToDate(logger, true)) )) - [] + [] member public this.UTDCheckEnabled () = this.MakeProjectAndDo(["file1.fs"], [], @" @@ -335,10 +325,10 @@ type UpToDate() = let configNameDebug = ConfigCanonicalName("Debug", "x86") let config = project.ConfigProvider.GetProjectConfiguration(configNameDebug) - Assert.IsFalse(config.IsFastUpToDateCheckEnabled()) + Assert.False(config.IsFastUpToDateCheckEnabled()) )) - [] + [] member public this.UTDOptionsFlags () = this.MakeProjectAndDo(["file1.fs"], [], "", (fun project -> let configNameDebugx86 = ConfigCanonicalName("Debug", "x86") @@ -352,8 +342,8 @@ type UpToDate() = let supported = Array.zeroCreate 1 let ready = Array.zeroCreate 1 buildableConfig.QueryStartUpToDateCheck(flag, supported, ready) |> ignore - Assert.IsTrue(supported.[0] = expected) - Assert.IsTrue(ready.[0] = expected) + Assert.True(supported.[0] = expected) + Assert.True(ready.[0] = expected) [ VSConstants.VSUTDCF_DTEEONLY, 1 VSConstants.VSUTDCF_PACKAGE, 0 @@ -362,7 +352,7 @@ type UpToDate() = |> List.iter (fun (flag, expected) -> testFlag flag expected) )) - [] + [] member public this.UTDOptionsFlagsUTDDisabled () = this.MakeProjectAndDo(["file1.fs"], [], @" @@ -380,8 +370,8 @@ type UpToDate() = let supported = Array.zeroCreate 1 let ready = Array.zeroCreate 1 buildableConfig.QueryStartUpToDateCheck(flag, supported, ready) |> ignore - Assert.AreEqual(supported.[0], expected) - Assert.AreEqual(ready.[0], expected) + Assert.Equal(supported.[0], expected) + Assert.Equal(ready.[0], expected) [ VSConstants.VSUTDCF_DTEEONLY, 1 VSConstants.VSUTDCF_PACKAGE, 0 @@ -390,10 +380,9 @@ type UpToDate() = |> List.iter (fun (flag, expected) -> testFlag flag expected) )) -[] type ``UpToDate PreserveNewest`` () = - [] + [] member public this.IsUpToDatePreserveNewest () = let test (input, inputTimestamp) (output, outputTimestamp) = @@ -416,28 +405,28 @@ type ``UpToDate PreserveNewest`` () = let ``no input -> not up-to-date and log`` = let u, logs = test ("readme.md", None) ("leggimi.md", None) - Assert.IsFalse(u) + Assert.False(u) logs |> List.exists (fun s -> s.Contains("readme.md") && s.Contains("can't find expected input")) - |> Assert.IsTrue + |> Assert.True let ``no output -> not up-to-date and log`` = let u, logs = test ("from.txt", Some now) ("to.txt", None) - Assert.IsFalse(u) + Assert.False(u) logs |> List.exists (fun s -> s.Contains("to.txt") && s.Contains("can't find expected output")) - |> Assert.IsTrue + |> Assert.True let ``a newer version of output file is ok`` = let u, logs = test ("before.doc", Some before) ("after.doc", Some now) - Assert.IsTrue(u) + Assert.True(u) logs |> AssertEqual [] let ``stale output file -> not up-to-date and log`` = let u, logs = test ("logo.png", Some now) ("animatedlogo.gif", Some before) - Assert.IsFalse(u) + Assert.False(u) logs |> List.exists (fun s -> s.Contains("animatedlogo.gif") && s.Contains("stale")) - |> Assert.IsTrue + |> Assert.True () diff --git a/vsintegration/tests/UnitTests/TestLib.LanguageService.fs b/vsintegration/tests/UnitTests/TestLib.LanguageService.fs index b4e055b036b..ecc8cc1479f 100644 --- a/vsintegration/tests/UnitTests/TestLib.LanguageService.fs +++ b/vsintegration/tests/UnitTests/TestLib.LanguageService.fs @@ -4,7 +4,7 @@ namespace UnitTests.TestLib.LanguageService open System open System.Reflection -open NUnit.Framework +open Xunit open System.Diagnostics open System.IO open Salsa.Salsa @@ -246,8 +246,6 @@ type internal GlobalParseAndTypeCheckCounter private(initialParseCount:int, init /// various functions that abstract actions over vs. type LanguageServiceBaseTests() = - let _resolver = AssemblyResolver.addResolver () - let mutable defaultSolution : OpenSolution = Unchecked.defaultof<_> let cache = System.Collections.Generic.Dictionary() @@ -261,7 +259,48 @@ type LanguageServiceBaseTests() = // Timings ----------------------------------------------------------------------------- let stopWatch = new Stopwatch() let ResetStopWatch() = stopWatch.Reset(); stopWatch.Start() - + + + let Init() = + let AssertNotAssemblyNameContains(a:System.Reflection.Assembly, text1:string, text2:string) = + let fullname = sprintf "%A" a + if fullname.Contains(text1) && fullname.Contains(text2) then + // Can't throw an exception here because its in an event handler. + System.Diagnostics.Debug.Assert(false, sprintf "Unexpected: loaded assembly '%s' to not contain '%s' and '%s'" fullname text1 text2) + + // Under .NET 4.0 we don't allow 3.5.0.0 assemblies + let AssertNotBackVersionAssembly(args:AssemblyLoadEventArgs) = + + // We're worried about loading these when running against .NET 4.0: + // Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + // Microsoft.Build.Utilities.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + AssertNotAssemblyNameContains(args.LoadedAssembly,"Microsoft.Build", "Version=3.5.0.0") + () + AppDomain.CurrentDomain.AssemblyLoad.Add AssertNotBackVersionAssembly + + UIStuff.SetupSynchronizationContext() + + defaultVS <- ops.CreateVisualStudio() + currentVS <- defaultVS + + defaultSolution <- GlobalFunctions.CreateSolution(defaultVS) + cache.Clear() + + do + Init() + + if box currentVS <> box defaultVS then + failwith "LanguageServiceBaseTests.Setup was called when 'active' instance of VS is not 'default' one - this may denote that tests contains errors" + + // reset state of default VS instance that can be shared among the tests + ShiftKeyUp(currentVS) + ops.CleanInvisibleProject(currentVS) + + ResetStopWatch() + testStopwatch.Reset() + testStopwatch.Start() + () + member internal _.VsOpts with set op = ops <- op @@ -367,50 +406,13 @@ type LanguageServiceBaseTests() = GlobalFunctions.AddAssemblyReference(proj, ref) - /// Called per test run -#if NUNIT_V2 - [] - member this.TestFixtureSetUp() = -#else - [] - member this.Init() = -#endif - let AssertNotAssemblyNameContains(a:System.Reflection.Assembly, text1:string, text2:string) = - let fullname = sprintf "%A" a - if fullname.Contains(text1) && fullname.Contains(text2) then - // Can't throw an exception here because its in an event handler. - System.Diagnostics.Debug.Assert(false, sprintf "Unexpected: loaded assembly '%s' to not contain '%s' and '%s'" fullname text1 text2) - - // Under .NET 4.0 we don't allow 3.5.0.0 assemblies - let AssertNotBackVersionAssembly(args:AssemblyLoadEventArgs) = - - // We're worried about loading these when running against .NET 4.0: - // Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - // Microsoft.Build.Utilities.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - AssertNotAssemblyNameContains(args.LoadedAssembly,"Microsoft.Build", "Version=3.5.0.0") - () - AppDomain.CurrentDomain.AssemblyLoad.Add AssertNotBackVersionAssembly - - UIStuff.SetupSynchronizationContext() - - defaultVS <- ops.CreateVisualStudio() - currentVS <- defaultVS + interface IDisposable with + member _.Dispose() = + if box currentVS <> box defaultVS then + failwith "LanguageServiceBaseTests.Shutdown was called when 'active' instance of VS is not 'default' one - this may denote that tests contains errors" - defaultSolution <- GlobalFunctions.CreateSolution(defaultVS) - cache.Clear() - -#if NUNIT_V2 - [] - member this.Shutdown() = -#else - [] - member this.Cleanup() = -#endif - if box currentVS <> box defaultVS then - failwith "LanguageServiceBaseTests.Shutdown was called when 'active' instance of VS is not 'default' one - this may denote that tests contains errors" - - GlobalFunctions.Cleanup(defaultVS) - cache.Clear() + GlobalFunctions.Cleanup(defaultVS) + cache.Clear() member this.UsingNewVS() = if box currentVS <> box defaultVS then @@ -423,24 +425,7 @@ type LanguageServiceBaseTests() = GlobalFunctions.Cleanup(currentVS) currentVS <- defaultVS } - - /// Called per test - [] - member this.Setup() = - if box currentVS <> box defaultVS then - failwith "LanguageServiceBaseTests.Setup was called when 'active' instance of VS is not 'default' one - this may denote that tests contains errors" - - // reset state of default VS instance that can be shared among the tests - ShiftKeyUp(currentVS) - ops.CleanInvisibleProject(currentVS) - - ResetStopWatch() - testStopwatch.Reset() - testStopwatch.Start() - () - /// Called per test - [] member this.TearDown() = diff --git a/vsintegration/tests/UnitTests/TestLib.ProjectSystem.fs b/vsintegration/tests/UnitTests/TestLib.ProjectSystem.fs index d1e554f4e8c..5f9095ff4d9 100644 --- a/vsintegration/tests/UnitTests/TestLib.ProjectSystem.fs +++ b/vsintegration/tests/UnitTests/TestLib.ProjectSystem.fs @@ -25,7 +25,7 @@ open Microsoft.Build.Execution open Microsoft.Build.Framework #nowarn "52" // The value has been copied to ensure the original is not mutated -open NUnit.Framework +open Xunit open UnitTests.TestLib.Utils open UnitTests.TestLib.Utils.Asserts open UnitTests.TestLib.Utils.FilesystemHelpers @@ -76,20 +76,6 @@ type TheTests() = project.FindNodesOfType(l) l.[0] - ///////////////////////////////// - /// Called per test - [] - member this.Setup() = - () - - - [] - member this.TearDown() = - // help find leaks per-test - System.GC.Collect() - System.GC.WaitForPendingFinalizers() - () - ///////////////////////////////// /// helpers static member AssertMatches (r : Regex) (s:string) = diff --git a/vsintegration/tests/UnitTests/TestLib.Salsa.fs b/vsintegration/tests/UnitTests/TestLib.Salsa.fs index c9dcbbb115a..ac3636723eb 100644 --- a/vsintegration/tests/UnitTests/TestLib.Salsa.fs +++ b/vsintegration/tests/UnitTests/TestLib.Salsa.fs @@ -4,7 +4,7 @@ module UnitTests.TestLib.Salsa open System open System.IO -open NUnit.Framework +open Xunit open Salsa.Salsa open Salsa.VsOpsUtils open System.Text.RegularExpressions @@ -36,7 +36,7 @@ let AssertContainsInOrder(s:string,cs:string list) = containsInOrderFrom 0 cs let AssertContains(value: string, substring: string) = - Assert.That(value, Contains.Substring substring) + Assert.Contains(substring, value) let AssertArrayContainsPartialMatchOf(a:string array,c) = let found = ref false diff --git a/vsintegration/tests/UnitTests/TestLib.Utils.fs b/vsintegration/tests/UnitTests/TestLib.Utils.fs index 3a74b0c0e94..8072604ca2b 100644 --- a/vsintegration/tests/UnitTests/TestLib.Utils.fs +++ b/vsintegration/tests/UnitTests/TestLib.Utils.fs @@ -47,7 +47,7 @@ module Asserts = | None -> () let AssertBuildSuccessful (result: Microsoft.VisualStudio.FSharp.ProjectSystem.BuildResult) = - Assert.IsTrue(result.IsSuccessful, "Expected build to succeed") + Assert.True(result.IsSuccessful, "Expected build to succeed") module UIStuff = let SetupSynchronizationContext() = diff --git a/vsintegration/tests/UnitTests/Tests.Build.fs b/vsintegration/tests/UnitTests/Tests.Build.fs index 78e4559d358..6f87164333f 100644 --- a/vsintegration/tests/UnitTests/Tests.Build.fs +++ b/vsintegration/tests/UnitTests/Tests.Build.fs @@ -2,7 +2,7 @@ namespace Tests -open NUnit.Framework +open Xunit open System open System.IO open System.Diagnostics @@ -19,8 +19,7 @@ module HandyExtensions = if not (s.MatchesPattern p) then let up = System.Text.RegularExpressions.Regex.Unescape p let message = sprintf "Expected\n%A\nto match pattern\n%A" s up - printfn "%s" message - Assert.Fail() + failwith message open HandyExtensions type MyLogger(f : string -> unit) = @@ -49,7 +48,6 @@ type FauxHostObject() = interface ITaskHost // no members -[] type Build() = (* Asserts ----------------------------------------------------------------------------- *) let AssertEqual expected actual = @@ -60,16 +58,7 @@ type Build() = let MakeTaskItem (itemSpec : string) = new TaskItem(itemSpec) :> ITaskItem - /// Called per test - [] - member this.Setup() = - () - - [] - member this.TearDown() = - () - - [] + [] member public this.TestCodePage() = let tool = new FSharp.Build.Fsc() printfn "By the way, the registry or app.config tool path is %s" tool.ToolPath @@ -85,7 +74,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestDebugSymbols() = let tool = new FSharp.Build.Fsc() tool.DebugSymbols <- true @@ -100,7 +89,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestDebugType() = let tool = new FSharp.Build.Fsc() tool.DebugType <- "pdbONly" @@ -115,7 +104,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestDefineConstants() = let tool = new FSharp.Build.Fsc() tool.DefineConstants <- [| MakeTaskItem "FOO=3" @@ -132,7 +121,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestDisabledWarnings1() = let tool = new FSharp.Build.Fsc() tool.DisabledWarnings <- "52;109" @@ -147,7 +136,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestDisabledWarnings2() = let tool = new FSharp.Build.Fsc() tool.DisabledWarnings <- ";" // e.g. someone may have $(NoWarn);$(SomeOtherVar) and both vars are empty @@ -161,7 +150,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestWarningsNotAsErrors() = let tool = new FSharp.Build.Fsc() tool.WarningsNotAsErrors <- "52;109" @@ -176,7 +165,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestVersionFile() = let tool = new FSharp.Build.Fsc() tool.VersionFile <- "src/version" @@ -191,7 +180,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestDocumentationFile() = let tool = new FSharp.Build.Fsc() tool.DocumentationFile <- "foo.xml" @@ -206,7 +195,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestGenerateInterfaceFile() = let tool = new FSharp.Build.Fsc() tool.GenerateInterfaceFile <- "foo.fsi" @@ -221,7 +210,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestKeyFile() = let tool = new FSharp.Build.Fsc() tool.KeyFile <- "key.txt" @@ -236,7 +225,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestNoFramework() = let tool = new FSharp.Build.Fsc() tool.NoFramework <- true @@ -251,7 +240,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestOptimize() = let tool = new FSharp.Build.Fsc() tool.Optimize <- false @@ -265,7 +254,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestTailcalls() = let tool = new FSharp.Build.Fsc() tool.Tailcalls <- true @@ -280,7 +269,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestOtherFlags() = let tool = new FSharp.Build.Fsc() tool.OtherFlags <- "--yadda yadda" @@ -296,7 +285,7 @@ type Build() = "yadda") cmd - [] + [] member public this.TestOutputAssembly() = let tool = new FSharp.Build.Fsc() tool.OutputAssembly <- "oUt.dll" @@ -311,7 +300,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestPdbFile() = let tool = new FSharp.Build.Fsc() tool.PdbFile <- "out.pdb" @@ -326,7 +315,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestPlatform1() = let tool = new FSharp.Build.Fsc() tool.Platform <- "x64" @@ -341,7 +330,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestPlatform3() = let tool = new FSharp.Build.Fsc() tool.Platform <- "x86" @@ -356,10 +345,10 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestReferences() = let tool = new FSharp.Build.Fsc() - let dll = "c:\\sd\\staging\\tools\\nunit\\nunit.framework.dll" + let dll = "c:\\sd\\staging\\tools\\xunit\\xunit.core.dll" tool.References <- [| MakeTaskItem dll |] AssertEqual 1 tool.References.Length let cmd = tool.InternalGenerateResponseFileCommands() @@ -372,39 +361,39 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestReferencePath() = let tool = new FSharp.Build.Fsc() - let path = "c:\\sd\\staging\\tools\\nunit\\;c:\\Foo" + let path = "c:\\sd\\staging\\tools\\xunit\\;c:\\Foo" tool.ReferencePath <- path AssertEqual path tool.ReferencePath let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--optimize+" + Environment.NewLine + - "--lib:c:\\sd\\staging\\tools\\nunit\\,c:\\Foo" + Environment.NewLine + + "--lib:c:\\sd\\staging\\tools\\xunit\\,c:\\Foo" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + "--highentropyva-" + Environment.NewLine + "--nocopyfsharpcore") cmd - [] + [] member public this.TestReferencePathWithSpaces() = let tool = new FSharp.Build.Fsc() - let path = "c:\\program files;c:\\sd\\staging\\tools\\nunit;c:\\Foo" + let path = "c:\\program files;c:\\sd\\staging\\tools\\xunit;c:\\Foo" tool.ReferencePath <- path AssertEqual path tool.ReferencePath let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--optimize+" + Environment.NewLine + - "--lib:c:\\program files,c:\\sd\\staging\\tools\\nunit,c:\\Foo" + Environment.NewLine + + "--lib:c:\\program files,c:\\sd\\staging\\tools\\xunit,c:\\Foo" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + "--highentropyva-" + Environment.NewLine + "--nocopyfsharpcore") cmd - [] + [] member public this.TestResources() = let tool = new FSharp.Build.Fsc() tool.Resources <- [| MakeTaskItem "Foo.resources" |] @@ -419,7 +408,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestSources() = let tool = new FSharp.Build.Fsc() let src = "foo.fs" @@ -438,7 +427,7 @@ type Build() = cmd () - [] + [] member public this.TestTargetType1() = let tool = new FSharp.Build.Fsc() tool.TargetType <- "Library" @@ -453,7 +442,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestTargetType2() = let tool = new FSharp.Build.Fsc() tool.TargetType <- "Winexe" @@ -468,7 +457,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestTargetType3() = let tool = new FSharp.Build.Fsc() tool.TargetType <- "Module" @@ -483,7 +472,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestUtf8Output() = let tool = new FSharp.Build.Fsc() tool.Utf8Output <- true @@ -497,7 +486,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestWin32Res() = let tool = new FSharp.Build.Fsc() tool.Win32ResourceFile <- "foo.res" @@ -511,7 +500,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestWin32Manifest() = let tool = new FSharp.Build.Fsc() tool.Win32ManifestFile <- "foo.manifest" @@ -525,7 +514,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestHighEntropyVA() = let tool = new FSharp.Build.Fsc() tool.HighEntropyVA <- true @@ -538,7 +527,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestSubsystemVersion() = let tool = new FSharp.Build.Fsc() tool.SubsystemVersion <- "6.02" @@ -552,7 +541,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestAllCombo() = let tool = new FSharp.Build.Fsc() tool.CodePage <- "65001" @@ -668,7 +657,7 @@ type Build() = let expectedSources = [| "foo.fs"; "C:\\Program Files\\spaces.fs" |] AssertEqual expectedSources hostObject.Sources - [] + [] member public this.``DisabledWarnings build property``() = let tool = new FSharp.Build.Fsc() tool.DisabledWarnings <- " diff --git a/vsintegration/tests/UnitTests/Tests.InternalCollections.fs b/vsintegration/tests/UnitTests/Tests.InternalCollections.fs index 55a4bb1f34e..835eebcd771 100644 --- a/vsintegration/tests/UnitTests/Tests.InternalCollections.fs +++ b/vsintegration/tests/UnitTests/Tests.InternalCollections.fs @@ -4,11 +4,10 @@ namespace Tests.Compiler.InternalCollections open System open System.IO -open NUnit.Framework +open Xunit open Internal.Utilities.Collections -[] type MruCache = new() = { } @@ -23,23 +22,23 @@ type MruCache = member private rb.NumToStringBox n = box (rb.NumToString n) #if DISABLED_OLD_UNITTESTS - [] + [] member public rb.Basic() = let m = new MruCache(3, (fun (x,y) -> x = y)) let s = m.Get(5) - Assert.IsTrue("Five"=s) + Assert.True("Five"=s) let s = m.Get(6) - Assert.IsTrue("Six"=s) + Assert.True("Six"=s) let s = m.Get(7) - Assert.IsTrue("Seven"=s) + Assert.True("Seven"=s) let s = m.Get(8) - Assert.IsTrue("Eight"=s) + Assert.True("Eight"=s) let (i,s) = Option.get m.MostRecent - Assert.AreEqual(8,i) - Assert.IsTrue("Eight"=s) + Assert.Equal(8,i) + Assert.True("Eight"=s) () - [] + [] member public rb.MostRecentOfEmpty() = let m = new MruCache(3, rb.NumToString, (fun (x,y) -> x = y)) match m.MostRecent with @@ -47,21 +46,21 @@ type MruCache = | None->() - [] + [] member public rb.SetAlternate() = let m = new MruCache(3, rb.NumToString, (fun (x,y) -> x = y)) m.SetAlternate(2,"Banana") let (i,s) = Option.get m.MostRecent - Assert.AreEqual(2,i) - Assert.IsTrue("Banana"=s) + Assert.Equal(2,i) + Assert.True("Banana"=s) member private rb.AddBanana(m:MruCache) = let banana = new obj() m.SetAlternate(2,banana) let s = m.Get(2) - Assert.AreEqual(banana,s) + Assert.Equal(banana,s) - [] + [] member public rb.CacheDepthIsHonored() = let m = new MruCache(3, rb.NumToStringBox, (fun (x,y) -> x = y)) rb.AddBanana(m) // Separate function to keep 'banana' out of registers @@ -70,9 +69,9 @@ type MruCache = let _ = m.Get(5) GC.Collect() let s = m.Get(2) - Assert.IsTrue("Two"=downcast s) + Assert.True("Two"=downcast s) - [] + [] member public rb.SubsumptionIsHonored() = let PairToString (s,n) = rb.NumToString n let AreSameForSubsumption((s1,n1),(s2,n2)) = n1=n2 @@ -80,13 +79,13 @@ type MruCache = let m = new MruCache(3, PairToString, (fun (x,y) -> x = y), areSimilar=AreSameForSubsumption) m.SetAlternate(("x",2),"Banana") let s = m.Get (("x",2)) - Assert.IsTrue("Banana"=s, "Check1") + Assert.True("Banana"=s, "Check1") let s = m.Get (("y",2)) - Assert.IsTrue("Two"=s, "Check2") + Assert.True("Two"=s, "Check2") let s = m.Get (("x",2)) - Assert.IsTrue("Two"=s, "Check3") // Not banana because it was subsumed + Assert.True("Two"=s, "Check3") // Not banana because it was subsumed - [] + [] member public rb.OnDiscardIsHonored() = let AreSameForSubsumption((s1,n1),(s2,n2)) = s1=s2 @@ -95,27 +94,26 @@ type MruCache = let m = new MruCache(compute=fst, areSimilar=(fun (x,y) -> x = y), areSimilar=AreSameForSubsumption, keepStrongly=2, keepMax=2, onDiscard=(fun s -> discarded := s :: !discarded)) m.SetAlternate(("x",1),"Banana") // no discard printfn "discarded = %A" discarded.Value - Assert.IsTrue(discarded.Value = [], "Check1") + Assert.True(discarded.Value = [], "Check1") m.SetAlternate(("x",2),"Apple") // forces discard of x --> Banana printfn "discarded = %A" discarded.Value - Assert.IsTrue(discarded.Value = ["Banana"], "Check2") + Assert.True(discarded.Value = ["Banana"], "Check2") let s = m.Get (("x",3)) printfn "discarded = %A" discarded.Value - Assert.IsTrue(discarded.Value = ["Apple"; "Banana"], "Check3") + Assert.True(discarded.Value = ["Apple"; "Banana"], "Check3") let s = m.Get (("y",4)) printfn "discarded = %A" discarded.Value - Assert.IsTrue(discarded.Value = ["Apple"; "Banana"], "Check4") + Assert.True(discarded.Value = ["Apple"; "Banana"], "Check4") let s = m.Get (("z",5)) // forces discard of x --> Bananas printfn "discarded = %A" discarded.Value - Assert.IsTrue(discarded.Value = ["x"; "Apple";"Banana"], "Check5") + Assert.True(discarded.Value = ["x"; "Apple";"Banana"], "Check5") let s = m.Get (("w",6)) // forces discard of y printfn "discarded = %A" discarded.Value - Assert.IsTrue(discarded.Value = ["y";"x";"Apple";"Banana"], "Check6") + Assert.True(discarded.Value = ["y";"x";"Apple";"Banana"], "Check6") #endif type AccessToken() = class end -[] type AgedLookup() = let mutable hold197 : byte [] = null let mutable hold198 : byte [] = null @@ -127,17 +125,17 @@ type AgedLookup() = let AssertCached(i,o:byte array) = match al.TryPeekKeyValue(atok,i) with - | Some(_,x) -> Assert.IsTrue(obj.ReferenceEquals(o,x), sprintf "Object in cache (%d) does not agree with expectation (%d)" x.[0] i) - | None -> Assert.IsTrue(false, "Object fell out of cache") + | Some(_,x) -> Assert.True(obj.ReferenceEquals(o,x), sprintf "Object in cache (%d) does not agree with expectation (%d)" x.[0] i) + | None -> Assert.True(false, "Object fell out of cache") let AssertExistsInCached(i) = match al.TryPeekKeyValue(atok,i) with | Some _ -> () - | None -> Assert.IsTrue(false, "Object fell out of cache") + | None -> Assert.True(false, "Object fell out of cache") let AssertNotCached(i) = match al.TryPeekKeyValue(atok,i) with - | Some _ -> Assert.IsTrue(false, "Expected key to have fallen out of cache") + | Some _ -> Assert.True(false, "Expected key to have fallen out of cache") | None -> () let f() = @@ -215,7 +213,7 @@ type AgedLookup() = GC.Collect() - [] member public rb.WeakRef0() = WeakRefTest 0 - [] member public rb.WeakRef1() = WeakRefTest 1 - [] member public rb.WeakRef2() = WeakRefTest 2 - [] member public rb.WeakRef3() = WeakRefTest 3 + [] member public rb.WeakRef0() = WeakRefTest 0 + [] member public rb.WeakRef1() = WeakRefTest 1 + [] member public rb.WeakRef2() = WeakRefTest 2 + [] member public rb.WeakRef3() = WeakRefTest 3 diff --git a/vsintegration/tests/UnitTests/Tests.Powerpack.fs b/vsintegration/tests/UnitTests/Tests.Powerpack.fs deleted file mode 100644 index 7ea87328bc4..00000000000 --- a/vsintegration/tests/UnitTests/Tests.Powerpack.fs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace UnitTests.Tests.PowerPack - -open NUnit.Framework -open System -open System.IO -open System.Diagnostics -open FSharp.Build -open Microsoft.Build.Framework -open Microsoft.Build.Utilities -open UnitTests.TestLib.Utils.FilesystemHelpers - -[] -type FsLexTests() = - - [] - member this.Setup() = () - - [] - member this.TearDown() = () - - [] - member public this.TestCodePage() = - let tool = new FSharp.Build.FsLex() - tool.CodePage <- "65001" - let cmd = tool.InternalGenerateCommandLineCommands() - Assert.AreEqual("--codepage 65001 ", cmd) - - [] - member public this.TestOutputFile() = - let tool = new FSharp.Build.FsLex() - tool.OutputFile <- "result.fs" - let cmd = tool.InternalGenerateCommandLineCommands() - Assert.AreEqual("-o result.fs ", cmd) - - [] - member public this.TestUnicode() = - let tool = new FSharp.Build.FsLex() - tool.Unicode <- true - let cmd = tool.InternalGenerateCommandLineCommands() - Assert.AreEqual("--unicode ", cmd) - - [] - member public this.TestUnicodeNegCase() = - let tool = new FSharp.Build.FsLex() - tool.Unicode <- false - let cmd = tool.InternalGenerateCommandLineCommands() - // Verify Unicode flag not specified - Assert.AreEqual("", cmd) - -[] -type FsYaccTests() = - - [] - member this.Setup() = () - - [] - member this.TearDown() = () - - [] - member public this.TestCodePage() = - let tool = new FSharp.Build.FsYacc() - tool.CodePage <- "65001" - let cmd = tool.InternalGenerateCommandLineCommands() - Assert.AreEqual("--codepage 65001", cmd) - - [] - member public this.TestOutputFile() = - let tool = new FSharp.Build.FsYacc() - tool.OutputFile <- "result.fs" - let cmd = tool.InternalGenerateCommandLineCommands() - Assert.AreEqual("-o result.fs", cmd) - - [] - member public this.TestMLCompatibility() = - let tool = new FSharp.Build.FsYacc() - tool.MLCompatibility <- true - let cmd = tool.InternalGenerateCommandLineCommands() - Assert.AreEqual("--ml-compatibility", cmd) - - [] - member public this.TestMLCompatibilityFalse() = - let tool = new FSharp.Build.FsYacc() - tool.MLCompatibility <- false - let cmd = tool.InternalGenerateCommandLineCommands() - Assert.AreEqual("", cmd) \ No newline at end of file diff --git a/vsintegration/tests/UnitTests/Tests.TaskReporter.fs b/vsintegration/tests/UnitTests/Tests.TaskReporter.fs index fb5e57bb446..d644a6c3237 100644 --- a/vsintegration/tests/UnitTests/Tests.TaskReporter.fs +++ b/vsintegration/tests/UnitTests/Tests.TaskReporter.fs @@ -2,7 +2,7 @@ namespace Tests.LanguageService.ErrorList -open NUnit.Framework +open Xunit open System open System.IO open System.Diagnostics @@ -20,7 +20,6 @@ open Salsa.VsMocks type TextSpan = Microsoft.VisualStudio.TextManager.Interop.TextSpan type DocumentTask = Microsoft.VisualStudio.FSharp.LanguageService.DocumentTask -[] type TaskReporterTests() = static let err(line) : 'a = printfn "err() called on line %s with %s" line System.Environment.StackTrace @@ -94,7 +93,7 @@ type TaskReporterTests() = // One File Tests // For the next two, add tasks to the task list more than once to ensure that // hashing is occurring correctly - [] + [] member public this.``ErrorList.LanguageServiceErrorsProperlyCoalesced``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) @@ -114,7 +113,7 @@ type TaskReporterTests() = - [] + [] member public this.``ErrorList.ProjectSystemErrorsProperlyCoalesced``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) @@ -134,7 +133,7 @@ type TaskReporterTests() = () /// Test for multiple identical errors being properly coalesced in the error list (bug 2151) - [] + [] member public this.``ErrorList.ErrorsProperlyCoalesced``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) @@ -153,7 +152,7 @@ type TaskReporterTests() = () // modify the span, and check to see if we have two tasks now instead of one - [] + [] member public this.``ErrorList.ProjectSystemErrorsProperlyCoalesced2``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) @@ -175,7 +174,7 @@ type TaskReporterTests() = () /// Ensure that text line markers are only created when a task is output to the task list - [] + [] member public this.``ErrorList.TextLineMarkersCreatedOnce``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) @@ -212,7 +211,7 @@ type TaskReporterTests() = // both files open // errors in each file, build - no duplicates - [] + [] member public this.``ErrorList.TwoFilesBothOpen``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) @@ -238,7 +237,7 @@ type TaskReporterTests() = // file open, one file closed // - error in closed file - [] + [] member public this.``ErrorList.TwoFilesOneOpenErrorInOpen``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) @@ -268,7 +267,7 @@ type TaskReporterTests() = () // all files open - build, then fix - no errors left - [] + [] member public this.``ErrorList.TwoFilesCorrectError``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) @@ -314,7 +313,7 @@ type TaskReporterTests() = // Make sure a 'typecheck' is treated as a background task - [] + [] member public this.``ErrorList.BackgroundTaskIsClassified``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) @@ -342,7 +341,7 @@ type TaskReporterTests() = // Make sure a 'ilxgen' is treated as a build task - [] + [] member public this.``ErrorList.BuildTaskIsClassified``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) diff --git a/vsintegration/tests/UnitTests/Tests.Watson.fs b/vsintegration/tests/UnitTests/Tests.Watson.fs index 35ccf0f4d03..e5c19d5e22d 100644 --- a/vsintegration/tests/UnitTests/Tests.Watson.fs +++ b/vsintegration/tests/UnitTests/Tests.Watson.fs @@ -11,7 +11,7 @@ open FSharp.Compiler.CodeAnalysis open Internal.Utilities.Library open FSharp.Compiler.CompilerConfig open FSharp.Compiler.Driver -open NUnit.Framework +open Xunit open System.IO type Check = @@ -51,122 +51,121 @@ type Check = FileSystem.FileDeleteShim("watson-test.fs") -[] module WatsonTests = - [] + [] let FscOutOfMemory() = Check.FscLevelException("fsc-oom") - [] + [] let FscArgumentNull() = Check.FscLevelException("fsc-an") - [] + [] let FscInvalidOperation() = Check.FscLevelException("fsc-invop") // As of .NET 4.0 some exception types cannot be caught. As a result, we cannot test this case. I did visually confirm a Watson report is sent, though. -// [] +// [] // let FscAccessViolation() = Check.FscLevelException("fsc-ac") - [] + [] let FscArgumentOutOfRange() = Check.FscLevelException("fsc-aor") - [] + [] let FscDivideByZero() = Check.FscLevelException("fsc-dv0") - [] + [] let FscNotFiniteNumber() = Check.FscLevelException("fsc-nfn") - [] + [] let FscOverflow() = Check.FscLevelException("fsc-oe") - [] + [] let FscArrayTypeMismatch() = Check.FscLevelException("fsc-atmm") - [] + [] let FscBadImageFormat() = Check.FscLevelException("fsc-bif") - [] + [] let FscKeyNotFound() = Check.FscLevelException("fsc-knf") - [] + [] let FscIndexOutOfRange() = Check.FscLevelException("fsc-ior") - [] + [] let FscInvalidCast() = Check.FscLevelException("fsc-ic") - [] + [] let FscInvalidProgram() = Check.FscLevelException("fsc-ip") - [] + [] let FscMemberAccess() = Check.FscLevelException("fsc-ma") - [] + [] let FscNotImplemented() = Check.FscLevelException("fsc-ni") - [] + [] let FscNullReference() = Check.FscLevelException("fsc-nr") - [] + [] let FscOperationCancelled() = Check.FscLevelException("fsc-oc") - //[] + //[] //let FscFailure() = Check.FscLevelException("fsc-fail") - [] + [] let TypeCheckOutOfMemory() = Check.FscLevelException("tc-oom") - [] + [] let TypeCheckArgumentNull() = Check.FscLevelException("tc-an") - [] + [] let TypeCheckInvalidOperation() = Check.FscLevelException("tc-invop") // As of .NET 4.0 some exception types cannot be caught. As a result, we cannot test this case. I did visually confirm a Watson report is sent, though. -// [] +// [] // let TypeCheckAccessViolation() = Check.FscLevelException("tc-ac") - [] + [] let TypeCheckArgumentOutOfRange() = Check.FscLevelException("tc-aor") - [] + [] let TypeCheckDivideByZero() = Check.FscLevelException("tc-dv0") - [] + [] let TypeCheckNotFiniteNumber() = Check.FscLevelException("tc-nfn") - [] + [] let TypeCheckOverflow() = Check.FscLevelException("tc-oe") - [] + [] let TypeCheckArrayTypeMismatch() = Check.FscLevelException("tc-atmm") - [] + [] let TypeCheckBadImageFormat() = Check.FscLevelException("tc-bif") - [] + [] let TypeCheckKeyNotFound() = Check.FscLevelException("tc-knf") - [] + [] let TypeCheckIndexOutOfRange() = Check.FscLevelException("tc-ior") - [] + [] let TypeCheckInvalidCast() = Check.FscLevelException("tc-ic") - [] + [] let TypeCheckInvalidProgram() = Check.FscLevelException("tc-ip") - [] + [] let TypeCheckMemberAccess() = Check.FscLevelException("tc-ma") - [] + [] let TypeCheckNotImplemented() = Check.FscLevelException("tc-ni") - [] + [] let TypeCheckNullReference() = Check.FscLevelException("tc-nr") - [] + [] let TypeCheckOperationCancelled() = Check.FscLevelException("tc-oc") - [] + [] let TypeCheckFailure() = Check.FscLevelException("tc-fail") diff --git a/vsintegration/tests/UnitTests/Tests.XmlDocComments.fs b/vsintegration/tests/UnitTests/Tests.XmlDocComments.fs index 432d72ec018..b11bdd9ef8c 100644 --- a/vsintegration/tests/UnitTests/Tests.XmlDocComments.fs +++ b/vsintegration/tests/UnitTests/Tests.XmlDocComments.fs @@ -3,13 +3,12 @@ namespace Tests.LanguageService open System -open NUnit.Framework +open Xunit open Salsa.Salsa open Salsa.VsOpsUtils open UnitTests.TestLib.Salsa open UnitTests.TestLib.Utils -[] type XmlDocComments() = inherit UnitTests.TestLib.LanguageService.LanguageServiceBaseTests(VsOpts = InstalledMSBuildTestFlavour()) @@ -58,31 +57,28 @@ type XmlDocComments() = let project2 = CreateProject(solution, "FSClient") let file1 = AddFileFromTextBlob(project1,"File1.fs", fileContent1) AddProjectReference(project2,project1) - Build(project1) |> fun result -> Assert.IsTrue(result.BuildSucceeded) + Build(project1) |> fun result -> Assert.True(result.BuildSucceeded) let file2 = AddFileFromTextBlob(project2,"File2.fs", fileContent2) let file = OpenFile(project2, "File2.fs") MoveCursorToStartOfMarker(file, marker) GetQuickInfoAtCursor file - [] - [] + [] member this.``MalFormedXML.FromXMLDoc``() = let expected = "XML comment" let tooltip = this.TestMalFormedXML("(*Marker1*)") printfn "%A" tooltip AssertContains(trimnewlines tooltip, trimnewlines expected) - [] - [] + [] member this.``MalFormedXML.FromCurrentProject``() = let expected = "'summary'" let tooltip = this.TestMalFormedXML("(*Marker2*)") printfn "%A" tooltip AssertContains(trimnewlines tooltip, trimnewlines expected) - [] - [] + [] member this.``MalFormedXML.NoXMLComment.Bug5858``() = let notexpected = "summary" let notexpected2 = "param name=" @@ -91,8 +87,7 @@ type XmlDocComments() = AssertNotContains(tooltip, notexpected) AssertNotContains(tooltip, notexpected2) - [] - [] + [] member this.Test() = let fileContent = """ //local custom type value diff --git a/vsintegration/tests/UnitTests/UnusedOpensTests.fs b/vsintegration/tests/UnitTests/UnusedOpensTests.fs index e47b38b46e6..b77d7e257ef 100644 --- a/vsintegration/tests/UnitTests/UnusedOpensTests.fs +++ b/vsintegration/tests/UnitTests/UnusedOpensTests.fs @@ -1,17 +1,14 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -[] + module Tests.ServiceAnalysis.UnusedOpens open System -open NUnit.Framework +open Xunit open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.EditorServices open FSharp.Compiler.Text -/// like "should equal", but validates same-type -let shouldEqual (x: 'a) (y: 'a) = Assert.AreEqual(x, y, sprintf "Expected: %A\nActual: %A" x y) - let private filePath = "C:\\test.fs" let private projectOptions : FSharpProjectOptions = @@ -43,9 +40,9 @@ let (=>) (source: string) (expectedRanges: ((*line*)int * ((*start column*)int * unusedOpenRanges |> List.map (fun x -> x.StartLine, (x.StartColumn, x.EndColumn)) - |> shouldEqual expectedRanges + |> fun actual -> Assert.Equal<(int * (int * int)) list>(expectedRanges, actual) -[] +[] let ``unused open declaration in top level module``() = """ module TopModule @@ -55,7 +52,7 @@ let _ = DateTime.Now """ => [ 4, (5, 14) ] -[] +[] let ``unused open declaration in namespace``() = """ namespace TopNamespace @@ -66,7 +63,7 @@ module Nested = """ => [ 4, (5, 14) ] -[] +[] let ``unused open declaration in nested module``() = """ namespace TopNamespace @@ -77,7 +74,7 @@ module Nested = """ => [ 5, (9, 18) ] -[] +[] let ``unused open declaration due to partially qualified symbol``() = """ module TopModule @@ -87,7 +84,7 @@ let _ = IO.File.Create "" """ => [ 4, (5, 14) ] -[] +[] let ``unused parent open declaration due to partially qualified symbol``() = """ module TopModule @@ -97,7 +94,7 @@ let _ = File.Create "" """ => [ 3, (5, 11) ] -[] +[] let ``open statement duplication in parent module is unused``() = """ module TopModule @@ -108,7 +105,7 @@ module Nested = """ => [ 5, (9, 18) ] -[] +[] let ``open statement duplication in parent module is marked as unused even though it seems to be used in its scope``() = """ module TopModule @@ -120,14 +117,14 @@ let _ = File.Create "" """ => [ 5, (9, 18) ] -[] +[] let ``multiple open declaration in the same line``() = """ open System.IO; let _ = File.Create "";; open System.IO """ => [ 2, (46, 55) ] -[] +[] let ``open a nested module inside another one is not unused``() = """ module Top @@ -139,7 +136,7 @@ module M2 = """ => [] -[] +[] let ``open a nested module inside another one is not unused, complex hierarchy``() = """ module Top = @@ -153,7 +150,7 @@ module Top = """ => [] -[] +[] let ``open a nested module inside another one is not unused, even more complex hierarchy``() = """ module Top = @@ -169,7 +166,7 @@ module Top = """ => [] -[] +[] let ``opening auto open module after it's parent module was opened should be marked as unused``() = """ module NormalModule = @@ -188,7 +185,7 @@ let _ = Class() """ => [ 13, (5, 68) ] -[] +[] let ``opening parent module after one of its auto open module was opened should be marked as unused``() = """ module NormalModule = @@ -207,7 +204,7 @@ let _ = Class() """ => [ 13, (5, 52) ] -[] +[] let ``open declaration is not marked as unused if there is a shortened attribute symbol from it``() = """ open System @@ -216,7 +213,7 @@ type Class() = class end """ => [] -[] +[] let ``open declaration is not marked as unused if an extension property is used``() = """ module Module = @@ -227,7 +224,7 @@ let _ = "a long string".ExtensionProperty """ => [] -[] +[] let ``open declaration is marked as unused if an extension property is not used``() = """ module Module = @@ -238,7 +235,7 @@ let _ = "a long string".Trim() """ => [ 5, (5, 11) ] -[] +[] let ``open declaration is not marked as unused if an extension method is used``() = """ type Class() = class end @@ -251,7 +248,7 @@ let _ = x.ExtensionMethod() """ => [] -[] +[] let ``open declaration is marked as unused if an extension method is not used``() = """ type Class() = class end @@ -263,7 +260,7 @@ let x = Class() """ => [ 6, (5, 11) ] -[] +[] let ``open declaration is not marked as unused if one of its types is used in a constructor signature``() = """ module M = @@ -273,7 +270,7 @@ type Site (x: Class -> unit) = class end """ => [] -[] +[] let ``open declaration is marked as unused if nothing from it is used``() = """ module M = @@ -283,7 +280,7 @@ type Site (x: int -> unit) = class end """ => [ 4, (5, 6) ] -[] +[] let ``static extension method applied to a type results that both namespaces /where the type is declared and where the extension is declared/ is not marked as unused``() = """ module Extensions = @@ -295,7 +292,7 @@ let _ = DateTime.ExtensionMethod """ => [] -[] +[] let ``static extension property applied to a type results that both namespaces /where the type is declared and where the extension is declared/ is not marked as unused``() = """ module Extensions = @@ -307,7 +304,7 @@ let _ = DateTime.ExtensionProperty """ => [] -[] +[] let ``accessing property on a variable should not force the namespace in which the type is declared to be marked as used``() = """ let dt = System.DateTime.Now @@ -317,7 +314,7 @@ module M = """ => [4, (9, 15) ] -[] +[] let ``either of two open declarations are not marked as unused if symbols from both of them are used``() = """ module M1 = @@ -332,7 +329,7 @@ let _ = func2() """ => [] -[] +[] let ``open module with ModuleSuffix attribute value applied is not marked as unused if a symbol declared in it is used``() = """ [] @@ -343,7 +340,7 @@ let _ = func() """ => [] -[] +[] let ``open module all of which symbols are used by qualifier is marked as unused``() = """ module M = @@ -353,7 +350,7 @@ let _ = M.func 1 """ => [4, (5, 6) ] -[] +[] let ``open module is not marked as unused if a symbol defined in it is used in OCaml-style type annotation``() = """ module M = @@ -363,7 +360,7 @@ let func (arg: Class list) = () """ => [] -[] +[] let ``auto open module``() = """ module Top = @@ -375,7 +372,7 @@ let _ = func() """ => [] -[] +[] let ``auto open module with namespace``() = """ namespace Module1Namespace @@ -390,7 +387,7 @@ module Module3 = """ => [] -[] +[] let ``auto open module in the middle of hierarchy``() = """ namespace Ns @@ -404,7 +401,7 @@ module M2 = """ => [] -[] +[] let ``open declaration is not marked as unused if a delegate defined in it is used``() = """ open System @@ -412,7 +409,7 @@ let _ = Func(fun _ -> 1) """ => [] -[] +[] let ``open declaration is not marked as unused if a unit of measure defined in it is used``() = """ module M = @@ -423,7 +420,7 @@ module N = """ => [] -[] +[] let ``open declaration is not marked as unused if an attribute defined in it is applied on an interface member argument``() = """ open System.Runtime.InteropServices @@ -431,7 +428,7 @@ type T = abstract M: [] ?x: int -> unit """ => [] -[] +[] let ``relative module open declaration``() = """ module Top = @@ -443,7 +440,7 @@ let _ = x """ => [] -[] +[] let ``open declaration is used if a symbol defined in it is used in a module top-level do expression``() = """ module Top @@ -453,7 +450,7 @@ File.ReadAllLines "" """ => [] -[] +[] let ``redundant opening a module with ModuleSuffix attribute value is marks as unused``() = """ [] @@ -465,7 +462,7 @@ module M = """ => [ 6, (9, 33) ] -[] +[] let ``redundant opening a module is marks as unused``() = """ module InternalModuleWithSuffix = @@ -476,7 +473,7 @@ module M = """ => [ 5, (9, 33) ] -[] +[] let ``usage of an unqualified union case doesn't make an opening module where it's defined to be marked as unused``() = """ module M = @@ -486,7 +483,7 @@ let _ = Case1 """ => [] -[] +[] let ``usage of qualified union case doesn't make an opening module where it's defined to be marked as unused``() = """ module M = @@ -496,7 +493,7 @@ let _ = DU.Case1 """ => [] -[] +[] let ``type with different DisplayName``() = """ open Microsoft.FSharp.Quotations @@ -504,7 +501,7 @@ let _ = Expr.Coerce (<@@ 1 @@>, typeof) """ => [] -[] +[] let ``auto open module with ModuleSuffix attribute value``() = """ module Top = @@ -517,7 +514,7 @@ module Module1 = """ => [] -[] +[] let ``a type which has more than one DisplayName causes the namespace it's defined in to be not marked as unused``() = """ open System @@ -525,7 +522,7 @@ let _ = IntPtr.Zero """ => [] -[] +[] let ``usage of an operator makes the module it's defined in to be not marked as unused``() = """ module M = @@ -535,7 +532,7 @@ let _ = 1 ++| 2 """ => [] -[] +[] let ``usage of an operator makes the module /with Module suffix/ it's defined in to be not marked as unused``() = """ [] @@ -546,7 +543,7 @@ let _ = 1 ++| 2 """ => [] -[] +[] let ``type used in pattern matching with "as" keyword causes the module in which the type is defined to be not marked as unused``() = """ module M = @@ -558,7 +555,7 @@ let _ = match obj() with """ => [] -[] +[] let ``a function from printf family prevents Printf module from marking as unused``() = """ open Microsoft.FSharp.Core.Printf @@ -567,7 +564,7 @@ let _ = bprintf (StringBuilder()) "%A" 1 """ => [] -[] +[] let ``assembly level attribute prevents namespace in which it's defined to be marked as unused``() = """ open System @@ -576,7 +573,7 @@ open System """ => [] -[] +[] let ``open declaration is not marked as unused if a related type extension is used``() = """ module Module = @@ -586,7 +583,7 @@ module Module = """ => [] -[] +[] let ``open declaration is not marked as unused if a symbol defined in it is used in type do block``() = """ open System.IO.Compression @@ -597,7 +594,7 @@ type OutliningHint() as self = """ => [] -[] +[] let ``should not mark open declaration with global prefix``() = """ module Module = @@ -606,7 +603,7 @@ module Module = """ => [] -[] +[] let ``record fields should be taken into account``() = """ module M1 = @@ -617,7 +614,7 @@ module M2 = """ => [] -[] +[] let ``handle type alias``() = """ module TypeAlias = @@ -628,7 +625,7 @@ module Usage = """ => [] -[] +[] let ``handle override members``() = """ type IInterface = @@ -642,7 +639,7 @@ let f (x: IClass) = (x :> IInterface).Property """ => [] -[] +[] let ``active pattern cases should be taken into account``() = """ module M = @@ -652,7 +649,7 @@ let f (Pattern _) = () """ => [] -[] +[] let ``active patterns applied as a function should be taken into account``() = """ module M = @@ -662,7 +659,7 @@ let _ = (|Pattern|_|) () """ => [] -[] +[] let ``not used active pattern does not make the module in which it's defined to not mark as unused``() = """ module M = @@ -672,7 +669,7 @@ let _ = 1 """ => [ 4, (5, 6) ] -[] +[] let ``type in type parameter constraint should be taken into account``() = """ open System @@ -680,7 +677,7 @@ let f (x: 'a when 'a :> IDisposable) = () """ => [] -[] +[] let ``namespace declaration should never be marked as unused``() = """ namespace Library2 @@ -688,7 +685,7 @@ type T() = class end """ => [] -[] +[] let ``auto open module opened before enclosing one is handled correctly``() = """ module M = @@ -703,7 +700,7 @@ let _ = y """ => [] -[] +[] let ``single relative open declaration opens two independent modules in different parent modules``() = """ module M = @@ -722,7 +719,7 @@ let _ = x """ => [] -[] +[] let ``C# extension methods are taken into account``() = """ open System.Linq @@ -733,7 +730,7 @@ module Test = """ => [] -[] +[] let ``namespace which contains types with C# extension methods is marked as unused if no extension is used``() = """ open System.Linq @@ -743,7 +740,7 @@ module Test = """ => [ 2, (5, 16) ] -[] +[] let ``a type from an auto open module is taken into account``() = """ module M1 = @@ -757,7 +754,7 @@ module M2 = """ => [] -[] +[] let ``unused open declaration in top level rec module``() = """ module rec TopModule @@ -767,7 +764,7 @@ let _ = DateTime.Now """ => [ 4, (5, 14) ] -[] +[] let ``unused open declaration in rec namespace``() = """ namespace rec TopNamespace @@ -778,7 +775,7 @@ module Nested = """ => [ 4, (5, 14) ] -[] +[] let ``unused inner module open declaration in rec module``() = """ module rec TopModule @@ -793,7 +790,7 @@ open Nested """ => [ 10, (5, 11) ] -[] +[] let ``used inner module open declaration in rec module``() = """ module rec TopModule @@ -810,7 +807,7 @@ let _ = f 1 """ => [] -[] +[] let ``used open C# type``() = """ open type System.Console @@ -819,7 +816,7 @@ WriteLine("Hello World") """ => [] -[] +[] let ``unused open C# type``() = """ open type System.Console @@ -828,7 +825,7 @@ printfn "%s" "Hello World" """ => [2, (10, 24)] -[] +[] let ``used open type from module``() = """ module MyModule = @@ -841,7 +838,7 @@ printfn "%A" Thing """ => [] -[] +[] let ``unused open type from module``() = """ module MyModule = diff --git a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj index f99bd68ec58..2a764378864 100644 --- a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj +++ b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj @@ -11,12 +11,12 @@ true true false - nunit + xunit true - + Internal.Utilities.Collections.fsi @@ -68,7 +68,7 @@ {{FSCoreVersion}} $(FSCoreVersion) - + diff --git a/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs b/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs index f411cfa973e..684ae3a6c84 100644 --- a/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs +++ b/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs @@ -19,10 +19,9 @@ open Microsoft.CodeAnalysis.Host.Mef open Microsoft.VisualStudio.LanguageServices open Microsoft.VisualStudio.Shell open VisualFSharp.UnitTests.Editor -open NUnit.Framework +open Xunit open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks -[] module WorkspaceTests = let compileFileAsDll (workspace: Workspace) filePath outputFilePath = @@ -170,15 +169,15 @@ module WorkspaceTests = let doc = getDocument workspace filePath let parseResults, checkResults = doc.GetFSharpParseAndCheckResultsAsync("assertEmptyDocumentDiagnostics") |> CancellableTask.runSynchronouslyWithoutCancellation - Assert.IsEmpty(parseResults.Diagnostics) - Assert.IsEmpty(checkResults.Diagnostics) + Assert.Empty(parseResults.Diagnostics) + Assert.Empty(checkResults.Diagnostics) let assertHasDocumentDiagnostics (workspace: Workspace) (filePath: string) = let doc = getDocument workspace filePath let parseResults, checkResults = doc.GetFSharpParseAndCheckResultsAsync("assertHasDocumentDiagnostics") |> CancellableTask.runSynchronouslyWithoutCancellation - Assert.IsEmpty(parseResults.Diagnostics) - Assert.IsNotEmpty(checkResults.Diagnostics) + Assert.Empty(parseResults.Diagnostics) + Assert.NotEmpty(checkResults.Diagnostics) type TestFSharpWorkspaceProjectContext(mainProj: Project) = @@ -286,7 +285,7 @@ module WorkspaceTests = // let proj = workspace.CurrentSolution.GetProject(projInfo.Id) // new TestFSharpWorkspaceProjectContext(proj) :> IFSharpWorkspaceProjectContext -// [] +// [] // let ``Script file opened in misc files workspace will get transferred to normal workspace``() = // use workspace = createWorkspace() // use miscFilesWorkspace = createMiscFileWorkspace() @@ -306,25 +305,25 @@ module WorkspaceTests = // let projInfo = createProjectInfoWithFileOnDisk filePath // addProject miscFilesWorkspace projInfo -// Assert.IsTrue(hasDocument miscFilesWorkspace filePath) -// Assert.IsFalse(hasDocument workspace filePath) +// Assert.True(hasDocument miscFilesWorkspace filePath) +// Assert.False(hasDocument workspace filePath) -// Assert.IsFalse(isDocumentOpen miscFilesWorkspace filePath) +// Assert.False(isDocumentOpen miscFilesWorkspace filePath) // openDocument miscFilesWorkspace filePath // // Although we opened the document, it has been transferred to the other workspace. -// Assert.IsFalse(hasDocument miscFilesWorkspace filePath) -// Assert.IsTrue(hasDocument workspace filePath) +// Assert.False(hasDocument miscFilesWorkspace filePath) +// Assert.True(hasDocument workspace filePath) // // Should not be automatically opened when transferred. -// Assert.IsFalse(isDocumentOpen workspace filePath) +// Assert.False(isDocumentOpen workspace filePath) // assertEmptyDocumentDiagnostics workspace filePath // finally // try File.Delete(filePath) with | _ -> () -// [] +// [] // let ``Script file referencing another script should have no diagnostics``() = // use workspace = createWorkspace() // use miscFilesWorkspace = createMiscFileWorkspace() @@ -359,7 +358,7 @@ module WorkspaceTests = // try File.Delete(filePath1) with | _ -> () // try File.Delete(filePath2) with | _ -> () -// [] +// [] // let ``Script file referencing another script will correctly update when the referenced script file changes``() = // use workspace = createWorkspace() // use miscFilesWorkspace = createMiscFileWorkspace() @@ -408,7 +407,7 @@ module WorkspaceTests = // try File.Delete(filePath1) with | _ -> () // try File.Delete(filePath2) with | _ -> () -// [] +// [] // let ``Script file referencing another script will correctly update when the referenced script file changes with opening in reverse order``() = // use workspace = createWorkspace() // use miscFilesWorkspace = createMiscFileWorkspace() @@ -457,7 +456,7 @@ module WorkspaceTests = // try File.Delete(filePath1) with | _ -> () // try File.Delete(filePath2) with | _ -> () -// [] +// [] // let ``Script file referencing a DLL will correctly update when the referenced DLL file changes``() = // use workspace = createWorkspace() // use miscFilesWorkspace = createMiscFileWorkspace() diff --git a/vsintegration/tests/UnitTests/app.runsettings b/vsintegration/tests/UnitTests/app.runsettings deleted file mode 100644 index 009d9b69776..00000000000 --- a/vsintegration/tests/UnitTests/app.runsettings +++ /dev/null @@ -1,8 +0,0 @@ - - - - - 1 - - - diff --git a/vsintegration/tests/UnitTests/xunit.runner.json b/vsintegration/tests/UnitTests/xunit.runner.json new file mode 100644 index 00000000000..dc9bc36c8a8 --- /dev/null +++ b/vsintegration/tests/UnitTests/xunit.runner.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://xunit.net/schema/current/xunit.runner.schema.json", + "shadowCopy": false, + "maxParallelThreads": 1 +} \ No newline at end of file