Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Commit 688cbf6

Browse files
ThorstenReichertnosami
authored andcommitted
Moved fsharpqa/Libraries/Core/Reflectiontest cases to NUnit (dotnet#9611)
* Migrated PreComputedTupleConstructor01.fs test case * Migrated PreComputedTupleConstructor02.fs test case * Migrated DU.fs and Record.fs test cases
1 parent c3bdf14 commit 688cbf6

File tree

8 files changed

+58
-48
lines changed

8 files changed

+58
-48
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
2+
3+
namespace FSharp.Compiler.UnitTests
4+
5+
open NUnit.Framework
6+
7+
[<TestFixture>]
8+
module ``PreComputedTupleConstructor Tests`` =
9+
10+
[<Test>]
11+
let ``PreComputedTupleConstructor of int and string``() =
12+
// Regression test for FSHARP1.0:5113
13+
// MT DCR: Reflection.FSharpValue.PreComputeTupleConstructor fails when executed for NetFx 2.0 by a Dev10 compiler
14+
15+
let testDelegate = TestDelegate (fun () ->
16+
Reflection.FSharpValue.PreComputeTupleConstructor(typeof<int * string>) [| box 12; box "text" |] |> ignore)
17+
18+
Assert.DoesNotThrow testDelegate |> ignore
19+
20+
[<Test>]
21+
let ``PreComputedTupleConstructor with wrong order of arguments``() =
22+
// Regression test for FSHARP1.0:5113
23+
// MT DCR: Reflection.FSharpValue.PreComputeTupleConstructor fails when executed for NetFx 2.0 by a Dev10 compiler
24+
25+
let testDelegate = TestDelegate (fun () ->
26+
Reflection.FSharpValue.PreComputeTupleConstructor(typeof<int * string>) [| box "text"; box 12; |] |> ignore)
27+
28+
Assert.Throws<System.ArgumentException> testDelegate |> ignore
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
2+
3+
namespace FSharp.Compiler.UnitTests
4+
5+
open NUnit.Framework
6+
7+
[<TestFixture>]
8+
module ``Sprintf Tests`` =
9+
10+
type MyR = {c:int;b:int;a:int}
11+
12+
[<Test>]
13+
let ``Sprintf %A of record type``() =
14+
// Regression test for FSHARP1.0:5113
15+
16+
let s1 = sprintf "%A" {a=1;b=2;c=3}
17+
let s2 = sprintf "%A" {c=3;b=2;a=1}
18+
19+
Assert.areEqual s1 s2
20+
21+
type MyT = MyC of int * string * bool
22+
23+
[<Test>]
24+
let ``Sprintf %A of discriminated union type``() =
25+
// Regression test for FSHARP1.0:5113
26+
27+
let DU = MyC (1,"2",true)
28+
Assert.areEqual "MyC (1, \"2\", true)" (sprintf "%A" DU)

tests/fsharp/FSharpSuite.Tests.fsproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
<Compile Include="Compiler\Libraries\Core\Operators\RoundTests.fs" />
8282
<Compile Include="Compiler\Libraries\Core\Operators\SignTests.fs" />
8383
<Compile Include="Compiler\Libraries\Core\Operators\StringTests.fs" />
84+
<Compile Include="Compiler\Libraries\Core\Reflection\SprintfTests.fs" />
85+
<Compile Include="Compiler\Libraries\Core\Reflection\PreComputedTupleConstructorTests.fs" />
8486
<Compile Include="Compiler\Libraries\Core\Unchecked\DefaultOfTests.fs" />
8587
<None Include="app.config" />
8688
<None Include="update.base.line.with.actuals.fsx" />

tests/fsharpqa/Source/Libraries/Core/Reflection/DU.fs

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/fsharpqa/Source/Libraries/Core/Reflection/PreComputeTupleConstructor01.fs

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/fsharpqa/Source/Libraries/Core/Reflection/PreComputeTupleConstructor02.fs

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/fsharpqa/Source/Libraries/Core/Reflection/Record.fs

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/fsharpqa/Source/Libraries/Core/Reflection/env.lst

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)