Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.

namespace FSharp.Compiler.UnitTests

open NUnit.Framework

[<TestFixture>]
module ``PreComputedTupleConstructor Tests`` =

[<Test>]
let ``PreComputedTupleConstructor of int and string``() =
// Regression test for FSHARP1.0:5113
// MT DCR: Reflection.FSharpValue.PreComputeTupleConstructor fails when executed for NetFx 2.0 by a Dev10 compiler

let testDelegate = TestDelegate (fun () ->
Reflection.FSharpValue.PreComputeTupleConstructor(typeof<int * string>) [| box 12; box "text" |] |> ignore)

Assert.DoesNotThrow testDelegate |> ignore

[<Test>]
let ``PreComputedTupleConstructor with wrong order of arguments``() =
// Regression test for FSHARP1.0:5113
// MT DCR: Reflection.FSharpValue.PreComputeTupleConstructor fails when executed for NetFx 2.0 by a Dev10 compiler

let testDelegate = TestDelegate (fun () ->
Reflection.FSharpValue.PreComputeTupleConstructor(typeof<int * string>) [| box "text"; box 12; |] |> ignore)

Assert.Throws<System.ArgumentException> testDelegate |> ignore
28 changes: 28 additions & 0 deletions tests/fsharp/Compiler/Libraries/Core/Reflection/SprintfTests.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.

namespace FSharp.Compiler.UnitTests

open NUnit.Framework

[<TestFixture>]
module ``Sprintf Tests`` =

type MyR = {c:int;b:int;a:int}

[<Test>]
let ``Sprintf %A of record type``() =
// Regression test for FSHARP1.0:5113

let s1 = sprintf "%A" {a=1;b=2;c=3}
let s2 = sprintf "%A" {c=3;b=2;a=1}

Assert.areEqual s1 s2

type MyT = MyC of int * string * bool

[<Test>]
let ``Sprintf %A of discriminated union type``() =
// Regression test for FSHARP1.0:5113

let DU = MyC (1,"2",true)
Assert.areEqual "MyC (1, \"2\", true)" (sprintf "%A" DU)
2 changes: 2 additions & 0 deletions tests/fsharp/FSharpSuite.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
<Compile Include="Compiler\Libraries\Core\Operators\RoundTests.fs" />
<Compile Include="Compiler\Libraries\Core\Operators\SignTests.fs" />
<Compile Include="Compiler\Libraries\Core\Operators\StringTests.fs" />
<Compile Include="Compiler\Libraries\Core\Reflection\SprintfTests.fs" />
<Compile Include="Compiler\Libraries\Core\Reflection\PreComputedTupleConstructorTests.fs" />
<Compile Include="Compiler\Libraries\Core\Unchecked\DefaultOfTests.fs" />
<None Include="app.config" />
<None Include="update.base.line.with.actuals.fsx" />
Expand Down
10 changes: 0 additions & 10 deletions tests/fsharpqa/Source/Libraries/Core/Reflection/DU.fs

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions tests/fsharpqa/Source/Libraries/Core/Reflection/Record.fs

This file was deleted.

4 changes: 0 additions & 4 deletions tests/fsharpqa/Source/Libraries/Core/Reflection/env.lst

This file was deleted.