зеркало из https://github.com/dotnet/fsharp.git
[WIP] Moving to xUnit
This commit is contained in:
Родитель
079276b4bc
Коммит
d9014b2553
|
@ -24,7 +24,7 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsiAnyCpu", "src\fsharp\fsi
|
|||
{649FA588-F02E-457C-9FCF-87E46407481E} = {649FA588-F02E-457C-9FCF-87E46407481E}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.TestsHelpers", "tests\FSharp.TestHelpers\FSharp.TestHelpers.fsproj", "{60D275B0-B14A-41CB-A1B2-E815A7448FCB} "
|
||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.TestsHelpers", "tests\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj", "{60D275B0-B14A-41CB-A1B2-E815A7448FCB} "
|
||||
EndProject
|
||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharpSuite.Tests", "tests\fsharp\FSharpSuite.Tests.fsproj", "{C163E892-5BF7-4B59-AA99-B0E8079C67C4}"
|
||||
EndProject
|
||||
|
|
|
@ -86,7 +86,7 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsiAnyCpu", "src\fsharp\fsi
|
|||
EndProject
|
||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsi", "src\fsharp\fsi\fsi.fsproj", "{D0E98C0D-490B-4C61-9329-0862F6E87645}"
|
||||
EndProject
|
||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.TestsHelpers", "tests\FSharp.TestHelpers\FSharp.TestHelpers.fsproj", "{60D275B0-B14A-41CB-A1B2-E815A7448FCB} "
|
||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.TestsHelpers", "tests\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj", "{60D275B0-B14A-41CB-A1B2-E815A7448FCB} "
|
||||
EndProject
|
||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharpSuite.Tests", "tests\fsharp\FSharpSuite.Tests.fsproj", "{C163E892-5BF7-4B59-AA99-B0E8079C67C4}"
|
||||
EndProject
|
||||
|
|
|
@ -176,7 +176,7 @@
|
|||
<MicrosoftNetCompilersVersion>2.7.0</MicrosoftNetCompilersVersion>
|
||||
<MicrosoftNETCoreILDAsmVersion>3.0.0-preview-27318-01</MicrosoftNETCoreILDAsmVersion>
|
||||
<MicrosoftNETCoreILAsmVersion>3.0.0-preview-27318-01</MicrosoftNETCoreILAsmVersion>
|
||||
<MicrosoftNETTestSdkVersion>15.8.0</MicrosoftNETTestSdkVersion>
|
||||
<MicrosoftNETTestSdkVersion>16.6.1</MicrosoftNETTestSdkVersion>
|
||||
<MicrosoftWin32RegistryVersion>4.3.0</MicrosoftWin32RegistryVersion>
|
||||
<NewtonsoftJsonVersion>9.0.1</NewtonsoftJsonVersion>
|
||||
<NUnitVersion>3.11.0</NUnitVersion>
|
||||
|
@ -186,5 +186,7 @@
|
|||
<RoslynToolsSignToolVersion>1.0.0-beta2-dev3</RoslynToolsSignToolVersion>
|
||||
<StrawberryPerlVersion>5.28.0.1</StrawberryPerlVersion>
|
||||
<StreamJsonRpcVersion>2.0.187</StreamJsonRpcVersion>
|
||||
<XUnitVersion>2.4.1</XUnitVersion>
|
||||
<FluentAssertionsVersion>2.4.1</FluentAssertionsVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
|
@ -8,5 +8,11 @@
|
|||
<PackageReference Include="NUnit3TestAdapter" Version="$(NUnit3TestAdapterVersion)" />
|
||||
<PackageReference Include="NunitXml.TestLogger" Version="$(NunitXmlTestLoggerVersion)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(UnitTestType)' == 'xunit'">
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkVersion)" />
|
||||
<PackageReference Include="xunit" Version="$(XUnitVersion)" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitVersion)" />
|
||||
<PackageReference Include="NunitXml.TestLogger" Version="$(NunitXmlTestLoggerVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -3,14 +3,15 @@ namespace FSharp.Compiler.UnitTests
|
|||
|
||||
open System
|
||||
open System.Globalization
|
||||
open NUnit.Framework
|
||||
open Xunit
|
||||
open FSharp.Test.Utilities
|
||||
|
||||
|
||||
[<TestFixture>]
|
||||
module ByteMemoryTests =
|
||||
open FSharp.Compiler.AbstractIL.Internal
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``ByteMemory.CreateMemoryMappedFile succeeds with byte length of zero``() =
|
||||
let memory = ByteMemory.Empty.AsReadOnly()
|
||||
let newMemory = ByteMemory.CreateMemoryMappedFile memory
|
||||
Assert.AreEqual(0, newMemory.Length)
|
||||
Assert.shouldBe(0, newMemory.Length)
|
|
@ -3,23 +3,25 @@ namespace FSharp.Compiler.UnitTests
|
|||
|
||||
open System
|
||||
open System.Globalization
|
||||
open NUnit.Framework
|
||||
open Xunit
|
||||
open FSharp.Test.Utilities
|
||||
|
||||
[<TestFixture>]
|
||||
module EditDistance =
|
||||
open Internal.Utilities.EditDistance
|
||||
|
||||
[<Test>]
|
||||
[<TestCase("RICK", "RICK", ExpectedResult = "1.000")>]
|
||||
[<TestCase("MARTHA", "MARHTA", ExpectedResult = "0.961")>]
|
||||
[<TestCase("DWAYNE", "DUANE", ExpectedResult = "0.840")>]
|
||||
[<TestCase("DIXON", "DICKSONX", ExpectedResult = "0.813")>]
|
||||
let JaroWinklerTest (str1 : string, str2 : string) : string =
|
||||
[<Theory>]
|
||||
[<InlineData("RICK", "RICK", "1.000")>]
|
||||
[<InlineData("MARTHA", "MARHTA", "0.961")>]
|
||||
[<InlineData("DWAYNE", "DUANE", "0.840")>]
|
||||
[<InlineData("DIXON", "DICKSONX", "0.813")>]
|
||||
let JaroWinklerTest (str1 : string, str2 : string, expected : string) : unit =
|
||||
String.Format(CultureInfo.InvariantCulture, "{0:0.000}", JaroWinklerDistance str1 str2)
|
||||
|> Assert.shouldBe expected
|
||||
|
||||
[<Test>]
|
||||
[<TestCase("RICK", "RICK", ExpectedResult = 0)>]
|
||||
[<TestCase("MARTHA", "MARHTA", ExpectedResult = 1)>]
|
||||
[<TestCase("'T", "'u", ExpectedResult = 1)>]
|
||||
let EditDistanceTest (str1 : string, str2 : string) : int =
|
||||
CalcEditDistance(str1,str2)
|
||||
[<Theory>]
|
||||
[<InlineData("RICK", "RICK", 0)>]
|
||||
[<InlineData("MARTHA", "MARHTA", 1)>]
|
||||
[<InlineData("'T", "'u", 1)>]
|
||||
let EditDistanceTest (str1 : string, str2 : string, expected : string) : unit =
|
||||
CalcEditDistance(str1,str2)
|
||||
|> Assert.shouldBe expected
|
||||
|
|
|
@ -7,11 +7,10 @@
|
|||
<TargetFrameworks Condition="'$(OS)' == 'Unix'">netcoreapp3.0</TargetFrameworks>
|
||||
<OutputType>Library</OutputType>
|
||||
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
|
||||
<UnitTestType>nunit</UnitTestType>
|
||||
<UnitTestType>xunit</UnitTestType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="NunitHelpers.fs" />
|
||||
<Compile Include="CompilerTestHelpers.fs" />
|
||||
<Compile Include="ManglingNameOfProvidedTypes.fs" />
|
||||
<Compile Include="HashIfExpression.fs" />
|
||||
|
|
|
@ -4,7 +4,8 @@ module FSharp.Compiler.UnitTests.FsiTests
|
|||
open System
|
||||
open System.IO
|
||||
open FSharp.Compiler.Interactive.Shell
|
||||
open NUnit.Framework
|
||||
open Xunit
|
||||
open FSharp.Test.Utilities
|
||||
|
||||
#nowarn "1104"
|
||||
|
||||
|
@ -21,13 +22,13 @@ let createFsiSession () =
|
|||
let fsiConfig = FsiEvaluationSession.GetDefaultConfiguration()
|
||||
FsiEvaluationSession.Create(fsiConfig, allArgs, inStream, new StreamWriter(outStream), new StreamWriter(errStream), collectible = true)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``No bound values at the start of FSI session`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
let values = fsiSession.GetBoundValues()
|
||||
Assert.IsEmpty values
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Bound value has correct name`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -35,9 +36,9 @@ let ``Bound value has correct name`` () =
|
|||
|
||||
let boundValue = fsiSession.GetBoundValues() |> List.exactlyOne
|
||||
|
||||
Assert.AreEqual("x", boundValue.Name)
|
||||
Assert.shouldBe("x", boundValue.Name)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Bound value has correct value`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -45,9 +46,9 @@ let ``Bound value has correct value`` () =
|
|||
|
||||
let boundValue = fsiSession.GetBoundValues() |> List.exactlyOne
|
||||
|
||||
Assert.AreEqual(2, boundValue.Value.ReflectionValue)
|
||||
Assert.shouldBe(2, boundValue.Value.ReflectionValue)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Bound value has correct type`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -55,9 +56,9 @@ let ``Bound value has correct type`` () =
|
|||
|
||||
let boundValue = fsiSession.GetBoundValues() |> List.exactlyOne
|
||||
|
||||
Assert.AreEqual(typeof<int>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe(typeof<int>, boundValue.Value.ReflectionType)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Seven bound values are ordered and have their correct name`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -71,9 +72,9 @@ let ``Seven bound values are ordered and have their correct name`` () =
|
|||
|
||||
let names = fsiSession.GetBoundValues() |> List.map (fun x -> x.Name)
|
||||
|
||||
Assert.AreEqual(["a";"aa";"b";"ccc";"x";"y";"z"], names)
|
||||
Assert.shouldBe(["a";"aa";"b";"ccc";"x";"y";"z"], names)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Seven bound values are ordered and have their correct value`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -87,9 +88,9 @@ let ``Seven bound values are ordered and have their correct value`` () =
|
|||
|
||||
let values = fsiSession.GetBoundValues() |> List.map (fun x -> x.Value.ReflectionValue)
|
||||
|
||||
Assert.AreEqual([4;7;6;5;1;2;3], values)
|
||||
Assert.shouldBe([4;7;6;5;1;2;3], values)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Seven bound values are ordered and have their correct type`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -103,9 +104,9 @@ let ``Seven bound values are ordered and have their correct type`` () =
|
|||
|
||||
let types = fsiSession.GetBoundValues() |> List.map (fun x -> x.Value.ReflectionType)
|
||||
|
||||
Assert.AreEqual([typeof<float>;typeof<int>;typeof<float32>;typeof<int>;typeof<int>;typeof<int>;typeof<int>], types)
|
||||
Assert.shouldBe([typeof<float>;typeof<int>;typeof<float32>;typeof<int>;typeof<int>;typeof<int>;typeof<int>], types)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Able to find a bound value by the identifier`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -121,7 +122,7 @@ let ``Able to find a bound value by the identifier`` () =
|
|||
|
||||
Assert.IsTrue boundValueOpt.IsSome
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Able to find a bound value by the identifier and has valid info`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -135,11 +136,11 @@ let ``Able to find a bound value by the identifier and has valid info`` () =
|
|||
|
||||
let boundValue = (fsiSession.TryFindBoundValue "z").Value
|
||||
|
||||
Assert.AreEqual("z", boundValue.Name)
|
||||
Assert.AreEqual(3, boundValue.Value.ReflectionValue)
|
||||
Assert.AreEqual(typeof<int>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe("z", boundValue.Name)
|
||||
Assert.shouldBe(3, boundValue.Value.ReflectionValue)
|
||||
Assert.shouldBe(typeof<int>, boundValue.Value.ReflectionType)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Not Able to find a bound value by the identifier`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -155,7 +156,7 @@ let ``Not Able to find a bound value by the identifier`` () =
|
|||
|
||||
Assert.IsTrue boundValueOpt.IsNone
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``The 'it' value does not exist at the start of a FSI session`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -163,7 +164,7 @@ let ``The 'it' value does not exist at the start of a FSI session`` () =
|
|||
|
||||
Assert.IsTrue boundValueOpt.IsNone
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``The 'it' bound value does exists after a value is not explicitly bound`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -173,7 +174,7 @@ let ``The 'it' bound value does exists after a value is not explicitly bound`` (
|
|||
|
||||
Assert.IsTrue boundValueOpt.IsSome
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``The 'it' value does exists after a value is not explicitly bound and has valid info`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -181,47 +182,47 @@ let ``The 'it' value does exists after a value is not explicitly bound and has v
|
|||
|
||||
let boundValue = (fsiSession.TryFindBoundValue "it").Value
|
||||
|
||||
Assert.AreEqual("it", boundValue.Name)
|
||||
Assert.AreEqual(456, boundValue.Value.ReflectionValue)
|
||||
Assert.AreEqual(typeof<int>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe("it", boundValue.Name)
|
||||
Assert.shouldBe(456, boundValue.Value.ReflectionValue)
|
||||
Assert.shouldBe(typeof<int>, boundValue.Value.ReflectionType)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``The latest shadowed value is only available`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
fsiSession.EvalInteraction("let x = 1")
|
||||
let boundValue = fsiSession.GetBoundValues() |> List.exactlyOne
|
||||
|
||||
Assert.AreEqual("x", boundValue.Name)
|
||||
Assert.AreEqual(1, boundValue.Value.ReflectionValue)
|
||||
Assert.AreEqual(typeof<int>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe("x", boundValue.Name)
|
||||
Assert.shouldBe(1, boundValue.Value.ReflectionValue)
|
||||
Assert.shouldBe(typeof<int>, boundValue.Value.ReflectionType)
|
||||
|
||||
fsiSession.EvalInteraction("let x = (1, 2)")
|
||||
let boundValue = fsiSession.GetBoundValues() |> List.exactlyOne
|
||||
|
||||
Assert.AreEqual("x", boundValue.Name)
|
||||
Assert.AreEqual((1, 2), boundValue.Value.ReflectionValue)
|
||||
Assert.AreEqual(typeof<int * int>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe("x", boundValue.Name)
|
||||
Assert.shouldBe((1, 2), boundValue.Value.ReflectionValue)
|
||||
Assert.shouldBe(typeof<int * int>, boundValue.Value.ReflectionType)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``The latest shadowed value is only available and can be found`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
fsiSession.EvalInteraction("let x = 1")
|
||||
let boundValue = (fsiSession.TryFindBoundValue "x").Value
|
||||
|
||||
Assert.AreEqual("x", boundValue.Name)
|
||||
Assert.AreEqual(1, boundValue.Value.ReflectionValue)
|
||||
Assert.AreEqual(typeof<int>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe("x", boundValue.Name)
|
||||
Assert.shouldBe(1, boundValue.Value.ReflectionValue)
|
||||
Assert.shouldBe(typeof<int>, boundValue.Value.ReflectionType)
|
||||
|
||||
fsiSession.EvalInteraction("let x = (1, 2)")
|
||||
let boundValue = (fsiSession.TryFindBoundValue "x").Value
|
||||
|
||||
Assert.AreEqual("x", boundValue.Name)
|
||||
Assert.AreEqual((1, 2), boundValue.Value.ReflectionValue)
|
||||
Assert.AreEqual(typeof<int * int>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe("x", boundValue.Name)
|
||||
Assert.shouldBe((1, 2), boundValue.Value.ReflectionValue)
|
||||
Assert.shouldBe(typeof<int * int>, boundValue.Value.ReflectionType)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Values are successfully shadowed even with intermediate interactions`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -232,21 +233,21 @@ let ``Values are successfully shadowed even with intermediate interactions`` ()
|
|||
|
||||
let boundValues = fsiSession.GetBoundValues()
|
||||
|
||||
Assert.AreEqual(3, boundValues.Length)
|
||||
Assert.shouldBe(3, boundValues.Length)
|
||||
|
||||
let boundValue = boundValues |> List.find (fun x -> x.Name = "x")
|
||||
|
||||
Assert.AreEqual("x", boundValue.Name)
|
||||
Assert.AreEqual((1, 2), boundValue.Value.ReflectionValue)
|
||||
Assert.AreEqual(typeof<int * int>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe("x", boundValue.Name)
|
||||
Assert.shouldBe((1, 2), boundValue.Value.ReflectionValue)
|
||||
Assert.shouldBe(typeof<int * int>, boundValue.Value.ReflectionType)
|
||||
|
||||
let boundValue = (fsiSession.TryFindBoundValue "x").Value
|
||||
|
||||
Assert.AreEqual("x", boundValue.Name)
|
||||
Assert.AreEqual((1, 2), boundValue.Value.ReflectionValue)
|
||||
Assert.AreEqual(typeof<int * int>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe("x", boundValue.Name)
|
||||
Assert.shouldBe((1, 2), boundValue.Value.ReflectionValue)
|
||||
Assert.shouldBe(typeof<int * int>, boundValue.Value.ReflectionType)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a simple bound value succeeds`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -254,11 +255,11 @@ let ``Creation of a simple bound value succeeds`` () =
|
|||
|
||||
let boundValue = fsiSession.GetBoundValues() |> List.exactlyOne
|
||||
|
||||
Assert.AreEqual("x", boundValue.Name)
|
||||
Assert.AreEqual(typeof<int>, boundValue.Value.ReflectionType)
|
||||
Assert.AreEqual(1, boundValue.Value.ReflectionValue)
|
||||
Assert.shouldBe("x", boundValue.Name)
|
||||
Assert.shouldBe(typeof<int>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe(1, boundValue.Value.ReflectionValue)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value succeeds with underscores in the identifier`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -266,9 +267,9 @@ let ``Creation of a bound value succeeds with underscores in the identifier`` ()
|
|||
|
||||
let boundValue = fsiSession.GetBoundValues() |> List.exactlyOne
|
||||
|
||||
Assert.AreEqual("x_y_z", boundValue.Name)
|
||||
Assert.shouldBe("x_y_z", boundValue.Name)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value succeeds with tildes in the identifier`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -276,9 +277,9 @@ let ``Creation of a bound value succeeds with tildes in the identifier`` () =
|
|||
|
||||
let boundValue = fsiSession.GetBoundValues() |> List.exactlyOne
|
||||
|
||||
Assert.AreEqual("``hello world``", boundValue.Name)
|
||||
Assert.shouldBe("``hello world``", boundValue.Name)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value succeeds with 'it' as the indentifier`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -286,77 +287,77 @@ let ``Creation of a bound value succeeds with 'it' as the indentifier`` () =
|
|||
|
||||
let boundValue = fsiSession.GetBoundValues() |> List.exactlyOne
|
||||
|
||||
Assert.AreEqual("it", boundValue.Name)
|
||||
Assert.AreEqual(typeof<string>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe("it", boundValue.Name)
|
||||
Assert.shouldBe(typeof<string>, boundValue.Value.ReflectionType)
|
||||
|
||||
fsiSession.AddBoundValue("it", 1)
|
||||
|
||||
let boundValue = fsiSession.GetBoundValues() |> List.exactlyOne
|
||||
|
||||
Assert.AreEqual("it", boundValue.Name)
|
||||
Assert.AreEqual(typeof<int>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe("it", boundValue.Name)
|
||||
Assert.shouldBe(typeof<int>, boundValue.Value.ReflectionType)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value fails with tildes in the identifier and with 'at' but has warning`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
Assert.Throws<ArgumentException>(fun () -> fsiSession.AddBoundValue("``hello @ world``", 1)) |> ignore
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value fails if the name is not a valid identifier with 'at' in front`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
Assert.Throws<ArgumentException>(fun () -> fsiSession.AddBoundValue("@x", 1)) |> ignore
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value fails if the name is not a valid identifier with 'at' in back`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
Assert.Throws<ArgumentException>(fun () -> fsiSession.AddBoundValue("x@", 1)) |> ignore
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value fails if the name is null`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
Assert.Throws<ArgumentException>(fun () -> fsiSession.AddBoundValue(null, 1)) |> ignore
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value fails if the name is empty`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
Assert.Throws<ArgumentException>(fun () -> fsiSession.AddBoundValue("", 1)) |> ignore
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value fails if the name is whitespace`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
Assert.Throws<ArgumentException>(fun () -> fsiSession.AddBoundValue(" ", 1)) |> ignore
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value fails if the name contains spaces`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
Assert.Throws<ArgumentException>(fun () -> fsiSession.AddBoundValue("x x", 1)) |> ignore
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value fails if the name contains an operator at the end`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
Assert.Throws<ArgumentException>(fun () -> fsiSession.AddBoundValue("x+", 1)) |> ignore
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value fails if the name contains an operator at the front`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
Assert.Throws<ArgumentException>(fun () -> fsiSession.AddBoundValue("+x", 1)) |> ignore
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value fails if the name contains dots`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
Assert.Throws<ArgumentException>(fun () -> fsiSession.AddBoundValue("x.x", 1)) |> ignore
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value fails if the value passed is null`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -364,13 +365,13 @@ let ``Creation of a bound value fails if the value passed is null`` () =
|
|||
|
||||
type CustomType = { X: int }
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value succeeds if the value contains types from assemblies that are not referenced in the session, due to implicit resolution`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
fsiSession.AddBoundValue("x", { X = 1 })
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value succeeds if the value contains types from assemblies that are not referenced in the session, due to implicit resolution, and then doing some evaluation`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -378,20 +379,20 @@ let ``Creation of a bound value succeeds if the value contains types from assemb
|
|||
fsiSession.EvalInteraction("let y = { x with X = 5 }")
|
||||
|
||||
let boundValues = fsiSession.GetBoundValues()
|
||||
Assert.AreEqual(2, boundValues.Length)
|
||||
Assert.shouldBe(2, boundValues.Length)
|
||||
|
||||
let v1 = boundValues.[0]
|
||||
let v2 = boundValues.[1]
|
||||
|
||||
Assert.AreEqual("x", v1.Name)
|
||||
Assert.AreEqual({ X = 1 }, v1.Value.ReflectionValue)
|
||||
Assert.AreEqual(typeof<CustomType>, v1.Value.ReflectionType)
|
||||
Assert.shouldBe("x", v1.Name)
|
||||
Assert.shouldBe({ X = 1 }, v1.Value.ReflectionValue)
|
||||
Assert.shouldBe(typeof<CustomType>, v1.Value.ReflectionType)
|
||||
|
||||
Assert.AreEqual("y", v2.Name)
|
||||
Assert.AreEqual({ X = 5 }, v2.Value.ReflectionValue)
|
||||
Assert.AreEqual(typeof<CustomType>, v2.Value.ReflectionType)
|
||||
Assert.shouldBe("y", v2.Name)
|
||||
Assert.shouldBe({ X = 5 }, v2.Value.ReflectionValue)
|
||||
Assert.shouldBe(typeof<CustomType>, v2.Value.ReflectionType)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value, of type ResizeArray<string>, succeeds`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -402,19 +403,19 @@ let ``Creation of a bound value, of type ResizeArray<string>, succeeds`` () =
|
|||
fsiSession.AddBoundValue("xs", xs)
|
||||
|
||||
let boundValues = fsiSession.GetBoundValues()
|
||||
Assert.AreEqual(1, boundValues.Length)
|
||||
Assert.shouldBe(1, boundValues.Length)
|
||||
|
||||
let v1 = boundValues.[0]
|
||||
|
||||
Assert.AreEqual("xs", v1.Name)
|
||||
Assert.AreEqual(xs, v1.Value.ReflectionValue)
|
||||
Assert.AreEqual(typeof<ResizeArray<string>>, v1.Value.ReflectionType)
|
||||
Assert.shouldBe("xs", v1.Name)
|
||||
Assert.shouldBe(xs, v1.Value.ReflectionValue)
|
||||
Assert.shouldBe(typeof<ResizeArray<string>>, v1.Value.ReflectionType)
|
||||
|
||||
type CustomType2() =
|
||||
|
||||
member _.Message = "hello"
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value succeeds if the value contains types from assemblies that are not referenced in the session, due to implicit resolution, and then use a member from it`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -423,19 +424,19 @@ let ``Creation of a bound value succeeds if the value contains types from assemb
|
|||
|
||||
let boundValue = fsiSession.GetBoundValues() |> List.exactlyOne
|
||||
|
||||
Assert.AreEqual("x", boundValue.Name)
|
||||
Assert.AreEqual(value, boundValue.Value.ReflectionValue)
|
||||
Assert.AreEqual(typeof<CustomType2>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe("x", boundValue.Name)
|
||||
Assert.shouldBe(value, boundValue.Value.ReflectionValue)
|
||||
Assert.shouldBe(typeof<CustomType2>, boundValue.Value.ReflectionType)
|
||||
|
||||
fsiSession.EvalInteraction("let x = x.Message")
|
||||
|
||||
let boundValue = fsiSession.GetBoundValues() |> List.exactlyOne
|
||||
|
||||
Assert.AreEqual("x", boundValue.Name)
|
||||
Assert.AreEqual("hello", boundValue.Value.ReflectionValue)
|
||||
Assert.AreEqual(typeof<string>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe("x", boundValue.Name)
|
||||
Assert.shouldBe("hello", boundValue.Value.ReflectionValue)
|
||||
Assert.shouldBe(typeof<string>, boundValue.Value.ReflectionType)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value succeeds if the value contains generic types from assemblies that are not referenced in the session, due to implicit resolution, and then use a member from it`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -446,19 +447,19 @@ let ``Creation of a bound value succeeds if the value contains generic types fro
|
|||
|
||||
let boundValue = fsiSession.GetBoundValues() |> List.exactlyOne
|
||||
|
||||
Assert.AreEqual("x", boundValue.Name)
|
||||
Assert.AreEqual(value, boundValue.Value.ReflectionValue)
|
||||
Assert.AreEqual(typeof<ResizeArray<CustomType2>>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe("x", boundValue.Name)
|
||||
Assert.shouldBe(value, boundValue.Value.ReflectionValue)
|
||||
Assert.shouldBe(typeof<ResizeArray<CustomType2>>, boundValue.Value.ReflectionType)
|
||||
|
||||
fsiSession.EvalInteraction("let x = x.[0].Message")
|
||||
|
||||
let boundValue = fsiSession.GetBoundValues() |> List.exactlyOne
|
||||
|
||||
Assert.AreEqual("x", boundValue.Name)
|
||||
Assert.AreEqual("hello", boundValue.Value.ReflectionValue)
|
||||
Assert.AreEqual(typeof<string>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe("x", boundValue.Name)
|
||||
Assert.shouldBe("hello", boundValue.Value.ReflectionValue)
|
||||
Assert.shouldBe(typeof<string>, boundValue.Value.ReflectionType)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value succeeds if the value contains two generic types from assemblies that are not referenced in the session, due to implicit resolution`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -468,11 +469,11 @@ let ``Creation of a bound value succeeds if the value contains two generic types
|
|||
|
||||
let boundValue = fsiSession.GetBoundValues() |> List.exactlyOne
|
||||
|
||||
Assert.AreEqual("x", boundValue.Name)
|
||||
Assert.AreEqual(value, boundValue.Value.ReflectionValue)
|
||||
Assert.AreEqual(typeof<CustomType * CustomType2>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe("x", boundValue.Name)
|
||||
Assert.shouldBe(value, boundValue.Value.ReflectionValue)
|
||||
Assert.shouldBe(typeof<CustomType * CustomType2>, boundValue.Value.ReflectionType)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value fails if the value contains types from a dynamic assembly`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -483,18 +484,18 @@ type TypeInDynamicAssembly() = class end
|
|||
fsiSession.AddBoundValue("x", TypeInDynamicAssembly())""")
|
||||
|
||||
match res with
|
||||
| Choice2Of2 ex -> Assert.AreEqual(typeof<NotSupportedException>, ex.GetType())
|
||||
| Choice2Of2 ex -> Assert.shouldBe(typeof<NotSupportedException>, ex.GetType())
|
||||
| _ -> failwith "Expected an exception"
|
||||
|
||||
type internal NonPublicCustomType() = class end
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value fails if the value's type is not public`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
Assert.Throws<InvalidOperationException>(fun () -> fsiSession.AddBoundValue("x", NonPublicCustomType())) |> ignore
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value succeeds if the value is a partial application function type`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -502,9 +503,9 @@ let ``Creation of a bound value succeeds if the value is a partial application f
|
|||
|
||||
let boundValue = fsiSession.GetBoundValues() |> List.exactlyOne
|
||||
|
||||
Assert.AreEqual(typeof<unit -> FsiEvaluationSession>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe(typeof<unit -> FsiEvaluationSession>, boundValue.Value.ReflectionType)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value succeeds if the value is a partial application function type with four arguments`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -516,9 +517,9 @@ let ``Creation of a bound value succeeds if the value is a partial application f
|
|||
|
||||
let boundValue = fsiSession.GetBoundValues() |> List.exactlyOne
|
||||
|
||||
Assert.AreEqual(typeof<int -> int -> int>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe(typeof<int -> int -> int>, boundValue.Value.ReflectionType)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value succeeds if the value is a lambda`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -526,7 +527,7 @@ let ``Creation of a bound value succeeds if the value is a lambda`` () =
|
|||
|
||||
let boundValue = fsiSession.GetBoundValues() |> List.exactlyOne
|
||||
|
||||
Assert.AreEqual(typeof<int -> int -> int -> int>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe(typeof<int -> int -> int -> int>, boundValue.Value.ReflectionType)
|
||||
|
||||
type TestFSharpFunc() =
|
||||
inherit FSharpFunc<int, int>()
|
||||
|
@ -536,7 +537,7 @@ type TestFSharpFunc() =
|
|||
type ``Test2FSharp @ Func``() =
|
||||
inherit TestFSharpFunc()
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``Creation of a bound value succeeds if the value is a type that inherits FSharpFunc`` () =
|
||||
use fsiSession = createFsiSession ()
|
||||
|
||||
|
@ -544,4 +545,4 @@ let ``Creation of a bound value succeeds if the value is a type that inherits FS
|
|||
|
||||
let boundValue = fsiSession.GetBoundValues() |> List.exactlyOne
|
||||
|
||||
Assert.AreEqual(typeof<``Test2FSharp @ Func``>, boundValue.Value.ReflectionType)
|
||||
Assert.shouldBe(typeof<``Test2FSharp @ Func``>, boundValue.Value.ReflectionType)
|
||||
|
|
|
@ -5,7 +5,8 @@ namespace FSharp.Compiler.UnitTests
|
|||
open System
|
||||
open System.Text
|
||||
|
||||
open NUnit.Framework
|
||||
open Xunit
|
||||
open FSharp.Test.Utilities
|
||||
|
||||
open Internal.Utilities
|
||||
open Internal.Utilities.Text.Lexing
|
||||
|
@ -18,7 +19,6 @@ open FSharp.Compiler.Features
|
|||
open FSharp.Compiler.ParseHelpers
|
||||
open FSharp.Compiler.SyntaxTree
|
||||
|
||||
[<TestFixture>]
|
||||
type HashIfExpression() =
|
||||
|
||||
let preludes = [|"#if "; "#elif "|]
|
||||
|
@ -94,7 +94,7 @@ type HashIfExpression() =
|
|||
member this.TearDown() =
|
||||
tearDown ()
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
member this.PositiveParserTestCases()=
|
||||
|
||||
let errors, warnings, parser = createParser ()
|
||||
|
@ -151,11 +151,11 @@ type HashIfExpression() =
|
|||
|
||||
let failure = String.Join ("\n", fs)
|
||||
|
||||
Assert.AreEqual("", failure)
|
||||
Assert.shouldBe("", failure)
|
||||
|
||||
()
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
member this.NegativeParserTestCases()=
|
||||
|
||||
let errors, warnings, parser = createParser ()
|
||||
|
@ -214,9 +214,9 @@ type HashIfExpression() =
|
|||
|
||||
let fails = String.Join ("\n", fs)
|
||||
|
||||
Assert.AreEqual("", fails)
|
||||
Assert.shouldBe("", fails)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
member this.LexerIfdefEvalTestCases()=
|
||||
|
||||
let failures = ResizeArray<string> ()
|
||||
|
@ -267,4 +267,4 @@ type HashIfExpression() =
|
|||
|
||||
let fails = String.Join ("\n", fs)
|
||||
|
||||
Assert.AreEqual("", fails)
|
||||
Assert.shouldBe("", fails)
|
||||
|
|
|
@ -3,66 +3,67 @@ namespace FSharp.Compiler.UnitTests
|
|||
|
||||
open System
|
||||
open System.Text
|
||||
open NUnit.Framework
|
||||
open Xunit
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler
|
||||
|
||||
[<TestFixture>]
|
||||
|
||||
type ManglingNamesOfProvidedTypesWithSingleParameter() =
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
member this.MangleWithNonDefaultValue() =
|
||||
let mangled =
|
||||
PrettyNaming.computeMangledNameWithoutDefaultArgValues("MyNamespace.Test", [| "xyz" |], [| "Foo", Some "abc" |])
|
||||
Assert.AreEqual("MyNamespace.Test,Foo=\"xyz\"", mangled)
|
||||
Assert.shouldBe("MyNamespace.Test,Foo=\"xyz\"", mangled)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
member this.MangleWithDefaultValue() =
|
||||
let mangled =
|
||||
PrettyNaming.computeMangledNameWithoutDefaultArgValues("MyNamespace.Test", [| "xyz" |], [| "Foo", Some "xyz" |])
|
||||
Assert.AreEqual("MyNamespace.Test", mangled)
|
||||
Assert.shouldBe("MyNamespace.Test", mangled)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
member this.DemangleNonDefaultValue() =
|
||||
let name, parameters = PrettyNaming.demangleProvidedTypeName "MyNamespace.Test,Foo=\"xyz\""
|
||||
Assert.AreEqual("MyNamespace.Test", name)
|
||||
Assert.AreEqual([| "Foo", "xyz" |], parameters)
|
||||
Assert.shouldBe("MyNamespace.Test", name)
|
||||
Assert.shouldBe([| "Foo", "xyz" |], parameters)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
member this.DemangleDefaultValue() =
|
||||
let name, parameters = PrettyNaming.demangleProvidedTypeName "MyNamespace.Test,"
|
||||
Assert.AreEqual("MyNamespace.Test", name)
|
||||
Assert.AreEqual([||], parameters)
|
||||
Assert.shouldBe("MyNamespace.Test", name)
|
||||
Assert.shouldBe([||], parameters)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
member this.DemangleNewDefaultValue() =
|
||||
let name, parameters = PrettyNaming.demangleProvidedTypeName "MyNamespace.Test"
|
||||
Assert.AreEqual("MyNamespace.Test", name)
|
||||
Assert.AreEqual([||], parameters)
|
||||
Assert.shouldBe("MyNamespace.Test", name)
|
||||
Assert.shouldBe([||], parameters)
|
||||
|
||||
|
||||
[<TestFixture>]
|
||||
type ManglingNamesOfProvidedTypesWithMultipleParameter() =
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
member this.MangleWithNonDefaultValue() =
|
||||
let mangled =
|
||||
PrettyNaming.computeMangledNameWithoutDefaultArgValues
|
||||
("MyNamespace.Test", [| "xyz"; "abc" |],
|
||||
[| "Foo", Some "foo"
|
||||
"Foo2", Some "foo2" |])
|
||||
Assert.AreEqual("MyNamespace.Test,Foo=\"xyz\",Foo2=\"abc\"", mangled)
|
||||
Assert.shouldBe("MyNamespace.Test,Foo=\"xyz\",Foo2=\"abc\"", mangled)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
member this.MangleWithDefaultValue() =
|
||||
let mangled =
|
||||
PrettyNaming.computeMangledNameWithoutDefaultArgValues
|
||||
("MyNamespace.Test", [| "xyz"; "abc" |],
|
||||
[| "Foo", Some "xyz"
|
||||
"Foo2", Some "abc" |])
|
||||
Assert.AreEqual("MyNamespace.Test", mangled)
|
||||
Assert.shouldBe("MyNamespace.Test", mangled)
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
member this.DemangleMultiParameter() =
|
||||
let name, parameters = PrettyNaming.demangleProvidedTypeName "TestType,Foo=\"xyz\",Foo2=\"abc\""
|
||||
Assert.AreEqual("TestType", name)
|
||||
Assert.AreEqual([| "Foo", "xyz"
|
||||
Assert.shouldBe("TestType", name)
|
||||
Assert.shouldBe([| "Foo", "xyz"
|
||||
"Foo2", "abc" |], parameters)
|
|
@ -7,7 +7,7 @@ module Assert =
|
|||
let inline failf fmt = Printf.kprintf fail fmt
|
||||
|
||||
let inline areEqual (expected: ^T) (actual: ^T) =
|
||||
Assert.AreEqual(expected, actual)
|
||||
Assert.shouldBe(expected, actual)
|
||||
|
||||
module StringAssert =
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
open System
|
||||
open System.IO
|
||||
open System.Text
|
||||
open NUnit.Framework
|
||||
open Xunit
|
||||
open FSharp.Test.Utilities
|
||||
|
||||
open FSharp.Compiler.AbstractIL.IL
|
||||
open FSharp.Compiler.Driver.MainModuleBuilder
|
||||
|
@ -14,47 +15,47 @@ module FileVersionTest =
|
|||
|
||||
let fileVersionAttrName = typeof<System.Reflection.AssemblyFileVersionAttribute>.FullName
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let parseILVersion () =
|
||||
"0.0.0.0" |> parseILVersion |> Assert.areEqual (ILVersionInfo(0us,0us,0us,0us))
|
||||
"1.2.3.4" |> parseILVersion |> Assert.areEqual (ILVersionInfo(1us,2us,3us,4us))
|
||||
"0.0.0.0" |> parseILVersion |> Assert.shouldBe (ILVersionInfo(0us,0us,0us,0us))
|
||||
"1.2.3.4" |> parseILVersion |> Assert.shouldBe (ILVersionInfo(1us,2us,3us,4us))
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``should use AssemblyFileVersionAttribute if set`` () =
|
||||
let findStringAttr n = n |> Assert.areEqual fileVersionAttrName; Some "1.2.3.4"
|
||||
fileVersion findStringAttr (ILVersionInfo(1us,0us,0us,0us)) |> Assert.areEqual (ILVersionInfo(1us,2us,3us,4us))
|
||||
let findStringAttr n = n |> Assert.shouldBe fileVersionAttrName; Some "1.2.3.4"
|
||||
fileVersion findStringAttr (ILVersionInfo(1us,0us,0us,0us)) |> Assert.shouldBe (ILVersionInfo(1us,2us,3us,4us))
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``should fallback if AssemblyFileVersionAttribute is not a valid version`` () =
|
||||
fileVersion (fun _ -> Some "1.2a.3.3") (ILVersionInfo(3us,7us,8us,6us))
|
||||
|> Assert.areEqual (ILVersionInfo(3us,7us,8us,6us))
|
||||
|> Assert.shouldBe (ILVersionInfo(3us,7us,8us,6us))
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``should fallback to assemblyVersion if AssemblyFileVersionAttribute not set`` () =
|
||||
let findStringAttr n = n |> Assert.areEqual fileVersionAttrName; None;
|
||||
fileVersion findStringAttr (ILVersionInfo(1us,0us,0us,4us)) |> Assert.areEqual (ILVersionInfo(1us,0us,0us,4us))
|
||||
let findStringAttr n = n |> Assert.shouldBe fileVersionAttrName; None;
|
||||
fileVersion findStringAttr (ILVersionInfo(1us,0us,0us,4us)) |> Assert.shouldBe (ILVersionInfo(1us,0us,0us,4us))
|
||||
|
||||
module ProductVersionTest =
|
||||
|
||||
let informationalVersionAttrName = typeof<System.Reflection.AssemblyInformationalVersionAttribute>.FullName
|
||||
let fileVersionAttrName = typeof<System.Reflection.AssemblyFileVersionAttribute>.FullName
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``should use AssemblyInformationalVersionAttribute if set`` () =
|
||||
let mutable args = []
|
||||
let findStrAttr x = args <- List.append args [x]; Some "12.34.56.78"
|
||||
productVersion findStrAttr (ILVersionInfo(1us,0us,0us,6us)) |> Assert.areEqual "12.34.56.78"
|
||||
args |> Assert.areEqual [ informationalVersionAttrName ]
|
||||
productVersion findStrAttr (ILVersionInfo(1us,0us,0us,6us)) |> Assert.shouldBe "12.34.56.78"
|
||||
args |> Assert.shouldBe [ informationalVersionAttrName ]
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``should fallback if AssemblyInformationalVersionAttribute is not a valid version`` () =
|
||||
productVersion (fun _ -> Some "1.2.3-main (build #12)") (ILVersionInfo(1us,0us,0us,6us))
|
||||
|> Assert.areEqual "1.2.3-main (build #12)"
|
||||
|> Assert.shouldBe "1.2.3-main (build #12)"
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``should fallback to fileVersion if AssemblyInformationalVersionAttribute not set or empty`` () =
|
||||
productVersion (fun _ -> None) (ILVersionInfo(3us,2us,1us,0us)) |> Assert.areEqual "3.2.1.0"
|
||||
productVersion (fun _ -> Some "") (ILVersionInfo(3us,2us,1us,0us)) |> Assert.areEqual "3.2.1.0"
|
||||
productVersion (fun _ -> None) (ILVersionInfo(3us,2us,1us,0us)) |> Assert.shouldBe "3.2.1.0"
|
||||
productVersion (fun _ -> Some "") (ILVersionInfo(3us,2us,1us,0us)) |> Assert.shouldBe "3.2.1.0"
|
||||
|
||||
let validValues () =
|
||||
let max = System.UInt16.MaxValue
|
||||
|
@ -65,10 +66,10 @@ module ProductVersionTest =
|
|||
"3213.57843.32382.59493", ILVersionInfo(3213us,57843us,32382us,59493us)
|
||||
(sprintf "%d.%d.%d.%d" max max max max), ILVersionInfo(max,max,max,max) ]
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``should use values if valid major.minor.revision.build version format`` () =
|
||||
for (v, expected) in validValues() do
|
||||
v |> productVersionToILVersionInfo |> Assert.areEqual expected
|
||||
v |> productVersionToILVersionInfo |> Assert.shouldBe expected
|
||||
|
||||
let invalidValues () =
|
||||
[ "1.2.3.4", ILVersionInfo(1us,2us,3us,4us)
|
||||
|
@ -83,7 +84,7 @@ module ProductVersionTest =
|
|||
"70000.80000.90000.100000", ILVersionInfo(0us,0us,0us,0us)
|
||||
(sprintf "%d.70000.80000.90000" System.UInt16.MaxValue), ILVersionInfo(System.UInt16.MaxValue,0us,0us,0us) ]
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let ``should zero starting from first invalid version part`` () =
|
||||
for (v, expected) in invalidValues() do
|
||||
v |> productVersionToILVersionInfo |> Assert.areEqual expected
|
||||
v |> productVersionToILVersionInfo |> Assert.shouldBe expected
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
|
||||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open Xunit
|
||||
open FSharp.Test.Utilities
|
||||
|
||||
|
||||
[<TestFixture>]
|
||||
module SuggestionBuffer =
|
||||
open FSharp.Compiler.ErrorResolutionHints
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let NewBufferShouldBeEmpty() =
|
||||
let buffer = SuggestionBuffer("abdef")
|
||||
|
||||
Assert.IsFalse buffer.Disabled
|
||||
Assert.IsEmpty buffer
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let BufferShouldOnlyAcceptSimilarElements() =
|
||||
let buffer = SuggestionBuffer("abcd")
|
||||
buffer.Add("abce")
|
||||
|
@ -22,9 +23,9 @@ module SuggestionBuffer =
|
|||
|
||||
let results = Array.ofSeq buffer
|
||||
|
||||
Assert.areEqual [| "abce" |] results
|
||||
Assert.shouldBe [| "abce" |] results
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let SmallIdentifierShouldBeIgnored() =
|
||||
let buffer = SuggestionBuffer("ab")
|
||||
|
||||
|
@ -41,9 +42,9 @@ module SuggestionBuffer =
|
|||
let results = Array.ofSeq buffer
|
||||
|
||||
Assert.IsTrue buffer.Disabled
|
||||
Assert.areEqual [||] results
|
||||
Assert.shouldBe [||] results
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let BufferShouldOnlyTakeTop5Elements() =
|
||||
let buffer = SuggestionBuffer("abcd")
|
||||
buffer.Add("abce")
|
||||
|
@ -56,9 +57,9 @@ module SuggestionBuffer =
|
|||
|
||||
let results = Array.ofSeq buffer
|
||||
|
||||
Assert.areEqual [| "abce"; "abcg"; "abch"; "abci"; "abcj"|] results
|
||||
Assert.shouldBe [| "abce"; "abcg"; "abch"; "abci"; "abcj"|] results
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let BufferShouldUseEarlierElementsIfTheyHaveSameScore() =
|
||||
let buffer = SuggestionBuffer("abcd")
|
||||
buffer.Add("abce")
|
||||
|
@ -70,10 +71,10 @@ module SuggestionBuffer =
|
|||
|
||||
let results = Array.ofSeq buffer
|
||||
|
||||
Assert.areEqual [| "abce"; "abcf"; "abcg"; "abch"; "abci"|] results
|
||||
Assert.shouldBe [| "abce"; "abcf"; "abcg"; "abch"; "abci"|] results
|
||||
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let BufferShouldDisableItselfIfItSeesTheOriginalIdentifier() =
|
||||
let buffer = SuggestionBuffer("abcd")
|
||||
buffer.Add("abce")
|
||||
|
@ -90,7 +91,7 @@ module SuggestionBuffer =
|
|||
Assert.IsTrue buffer.Disabled
|
||||
Assert.IsEmpty buffer
|
||||
|
||||
[<Test>]
|
||||
[<Fact>]
|
||||
let BufferShouldIgnoreSmallIdentifiers() =
|
||||
let buffer = SuggestionBuffer("abd")
|
||||
buffer.Add("abce")
|
||||
|
@ -100,4 +101,4 @@ module SuggestionBuffer =
|
|||
|
||||
let results = Array.ofSeq buffer
|
||||
|
||||
Assert.areEqual [| "abc"; "abce" |] results
|
||||
Assert.shouldBe [| "abc"; "abce" |] results
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
|
||||
|
||||
namespace FSharp.TestHelpers
|
||||
namespace FSharp.Test.Utilities
|
||||
|
||||
open System
|
||||
open System.Diagnostics
|
||||
|
@ -19,7 +19,7 @@ open NUnit.Framework
|
|||
open System.Reflection.Emit
|
||||
open Microsoft.CodeAnalysis
|
||||
open Microsoft.CodeAnalysis.CSharp
|
||||
open FSharp.TestHelpers.Utilities
|
||||
open FSharp.Test.Utilities.Utilities
|
||||
|
||||
[<Sealed>]
|
||||
type ILVerifier (dllFilePath: string) =
|
|
@ -39,6 +39,7 @@
|
|||
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="$(MicrosoftCodeAnalysisWorkspacesCommonVersion)" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="$(MicrosoftCodeAnalysisCSharpVersion)" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Test.Resources.Proprietary" Version="$(MicrosoftCodeAnalysisTestResourcesProprietaryVersion)" />
|
||||
<PackageReference Include="NUnit" Version="$(NUnitVersion)" />
|
||||
<PackageReference Include="NUnit" Version="$(NUnitVersion)" /> <!-- TODO: This should be removed once all NUnit frameworks are migrated to xUnit -->
|
||||
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
|
||||
|
||||
namespace FSharp.TestHelpers
|
||||
namespace FSharp.Test.Utilities
|
||||
|
||||
open System
|
||||
open System.IO
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
|
||||
|
||||
namespace FSharp.TestHelpers
|
||||
namespace FSharp.Test.Utilities
|
||||
|
||||
open System
|
||||
open System.IO
|
||||
|
@ -8,7 +8,7 @@ open System.Collections.Immutable
|
|||
open Microsoft.CodeAnalysis
|
||||
open Microsoft.CodeAnalysis.CSharp
|
||||
open System.Diagnostics
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
|
||||
// This file mimics how Roslyn handles their compilation references for compilation testing
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL
|
||||
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open NUnit.Framework
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL
|
||||
|
||||
open FSharp.Compiler.UnitTests
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open NUnit.Framework
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL
|
|||
|
||||
open System.IO
|
||||
open System.Reflection
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open NUnit.Framework
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL
|
||||
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open NUnit.Framework
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL
|
||||
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open NUnit.Framework
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
@ -73,4 +73,4 @@ module Library =
|
|||
module Library =
|
||||
type Hidden = Hidden of unit
|
||||
type Exported = Hidden
|
||||
"""
|
||||
"""
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
@ -19,4 +19,4 @@ x <- 20
|
|||
FSharpErrorSeverity.Error
|
||||
27
|
||||
(3, 1, 3, 8)
|
||||
"This value is not mutable. Consider using the mutable keyword, e.g. 'let mutable x = expression'."
|
||||
"This value is not mutable. Consider using the mutable keyword, e.g. 'let mutable x = expression'."
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
@ -18,4 +18,4 @@ let foo = 1up // int
|
|||
FSharpErrorSeverity.Error
|
||||
1156
|
||||
(2, 11, 2, 14)
|
||||
"This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger)."
|
||||
"This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger)."
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
@ -20,4 +20,4 @@ for x in 0 .. 10 do
|
|||
FSharpErrorSeverity.Error
|
||||
588
|
||||
(4,5,4,8)
|
||||
"The block following this 'let' is unfinished. Every code block is an expression and must have a result. 'let' cannot be the final code element in a block. Consider giving this block an explicit result."
|
||||
"The block following this 'let' is unfinished. Every code block is an expression and must have a result. 'let' cannot be the final code element in a block. Consider giving this block an explicit result."
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
@ -18,4 +18,4 @@ module public L1 = List
|
|||
FSharpErrorSeverity.Error
|
||||
536
|
||||
(2, 1, 2, 7)
|
||||
"The 'Public' accessibility attribute is not allowed on module abbreviation. Module abbreviations are always private."
|
||||
"The 'Public' accessibility attribute is not allowed on module abbreviation. Module abbreviations are always private."
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
@ -43,4 +43,4 @@ let r = { Size=3; Height=4; Wall=1 }
|
|||
FSharpErrorSeverity.Error
|
||||
39
|
||||
(9, 29, 9, 33)
|
||||
"The record label 'Wall' is not defined. Maybe you want one of the following:\r\n Walls\r\n Wallis"
|
||||
"The record label 'Wall' is not defined. Maybe you want one of the following:\r\n Walls\r\n Wallis"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
@ -318,4 +318,4 @@ let x =
|
|||
FSharpErrorSeverity.Error
|
||||
39
|
||||
(11, 15, 11, 19)
|
||||
"The type 'MyUnion' does not define the field, constructor or member 'Cas1'. Maybe you want one of the following:\r\n Case1\r\n Case2"
|
||||
"The type 'MyUnion' does not define the field, constructor or member 'Cas1'. Maybe you want one of the following:\r\n Case1\r\n Case2"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.TestHelpers.Utilities
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Test.Utilities.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.TestHelpers.Utilities
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Test.Utilities.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<AutoOpen>]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace FSharp.Compiler.UnitTests
|
|||
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
|
||||
|
||||
(*
|
||||
|
@ -186,4 +186,4 @@ module OpenAFieldFromMath =
|
|||
|
||||
// TODO - wait for Will's integration of testing changes that makes this easlier
|
||||
// [<Test>]
|
||||
// let ``OpenStaticClassesTests - InternalsVisibleWhenHavingAnIVT - langversion:preview``() = ...
|
||||
// let ``OpenStaticClassesTests - InternalsVisibleWhenHavingAnIVT - langversion:preview``() = ...
|
||||
|
|
|
@ -4,8 +4,8 @@ namespace FSharp.Compiler.UnitTests
|
|||
|
||||
open System.Collections.Immutable
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.TestHelpers.Utilities
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Test.Utilities.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
open Microsoft.CodeAnalysis
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
|
||||
#if NETCOREAPP
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace FSharp.Compiler.UnitTests
|
|||
open System
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
|
||||
#if NETCOREAPP
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace FSharp.Compiler.UnitTests
|
|||
|
||||
open System
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
|
||||
#if !NETCOREAPP
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
|
||||
[<TestFixture>]
|
||||
module UIntTests =
|
||||
let ``uint type abbreviation works`` () =
|
||||
let src = "let x = uint 12"
|
||||
let expectedErrors = [||]
|
||||
CompilerAssert.TypeCheckWithErrors src expectedErrors
|
||||
CompilerAssert.TypeCheckWithErrors src expectedErrors
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
@ -57,4 +57,4 @@ List.tl [1] |> ignore
|
|||
Assert.areEqual "a" (List.head ["a"])
|
||||
Assert.areEqual [2 .. 10] (List.tail [1 .. 10])
|
||||
Assert.areEqual [] (List.tail [1])
|
||||
Assert.areEqual (List.head (List.tail ['a'; 'a'])) (List.head ['a'; 'a'])
|
||||
Assert.areEqual (List.head (List.tail ['a'; 'a'])) (List.head ['a'; 'a'])
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
|
||||
module ``Dictionary Tests`` =
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
|
||||
[<TestFixture>]
|
||||
module ``Cast to Units Tests`` =
|
||||
|
@ -26,4 +26,4 @@ let r4 = Int64WithMeasure<M> 5L / 5L<M>
|
|||
let r5 = FloatWithMeasure<M> 11.11 + 1.1<M>
|
||||
let r6 = Float32WithMeasure<M> 22.22f - 11.11f<M>
|
||||
let r7 = DecimalWithMeasure<M> 33.33M * 44.44M<M>
|
||||
"""
|
||||
"""
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace FSharp.Compiler.UnitTests
|
|||
|
||||
open System
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
|
||||
[<TestFixture()>]
|
||||
module ForInDoMutableRegressionTest =
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace FSharp.Compiler.UnitTests
|
|||
|
||||
open System
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
|
||||
[<TestFixture()>]
|
||||
module IndexerRegressionTests =
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
|
||||
[<TestFixture>]
|
||||
module LargeExprTests =
|
||||
|
@ -5573,4 +5573,4 @@ let test () : unit =
|
|||
|
||||
test ()
|
||||
"""
|
||||
CompilerAssert.RunScript source []
|
||||
CompilerAssert.RunScript source []
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
@ -96,4 +96,4 @@ let changeProperty() =
|
|||
FSharpErrorSeverity.Warning
|
||||
20
|
||||
(9, 5, 9, 23)
|
||||
"The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'."
|
||||
"The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'."
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace FSharp.Compiler.UnitTests
|
||||
|
||||
open NUnit.Framework
|
||||
open FSharp.TestHelpers
|
||||
open FSharp.Test.Utilities
|
||||
open FSharp.Compiler.SourceCodeServices
|
||||
|
||||
[<TestFixture>]
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
<ItemGroup>
|
||||
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Compiler.Private\FSharp.Compiler.Private.fsproj" />
|
||||
<ProjectReference Include="$(FSharpSourcesRoot)\fsharp\FSharp.Core\FSharp.Core.fsproj" />
|
||||
<ProjectReference Include="..\FSharp.TestHelpers\FSharp.TestHelpers.fsproj" />
|
||||
<ProjectReference Include="..\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
//#r @"../../release/net40/bin/FSharp.Compiler.dll"
|
||||
#r @"../../packages/NUnit.3.5.0/lib/net45/nunit.framework.dll"
|
||||
#load "../../src/scripts/scriptlib.fsx"
|
||||
#load "../FSharp.TestHelpers/TestFramework.fs"
|
||||
#load "../FSharp.Test.Utilities/TestFramework.fs"
|
||||
#load "single-test.fs"
|
||||
#else
|
||||
[<NUnit.Framework.Category "Type Provider">]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#if INTERACTIVE
|
||||
#r @"../../packages/NUnit.3.5.0/lib/net45/nunit.framework.dll"
|
||||
#load "../../src/scripts/scriptlib.fsx"
|
||||
#load "../FSharp.TestHelpers/TestFramework.fs"
|
||||
#load "../FSharp.Test.Utilities/TestFramework.fs"
|
||||
#load "single-test.fs"
|
||||
#else
|
||||
module ``FSharp-Tests-Core``
|
||||
|
@ -2990,4 +2990,4 @@ module OverloadResolution =
|
|||
let [<Test>] ``neg_known_return_type_and_known_type_arguments`` () = singleNegTest (testConfig' "typecheck/overloads") "neg_known_return_type_and_known_type_arguments"
|
||||
let [<Test>] ``neg_generic_known_argument_types`` () = singleNegTest (testConfig' "typecheck/overloads") "neg_generic_known_argument_types"
|
||||
let [<Test>] ``neg_tupled_arguments`` () = singleNegTest (testConfig' "typecheck/overloads") "neg_tupled_arguments"
|
||||
#endif
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче