Skip to content

Commit 5e3a85c

Browse files
dotnet-botThorstenReichertKevinRansomcartermp
authored
Merge master to feature/string-interp (#9615)
* Moved fsharpqa/Libraries/Core/Unchecked test cases to NUnit (#9576) * Moved fsharpqa/Libraries/Core/Reflectiontest cases to NUnit (#9611) * Migrated PreComputedTupleConstructor01.fs test case * Migrated PreComputedTupleConstructor02.fs test case * Migrated DU.fs and Record.fs test cases * Allow notebook to discover location of shared framework (#9596) Co-authored-by: Thorsten Reichert <[email protected]> Co-authored-by: Kevin Ransom (msft) <[email protected]> Co-authored-by: Phillip Carter <[email protected]>
1 parent edd276c commit 5e3a85c

File tree

9 files changed

+60
-50
lines changed

9 files changed

+60
-50
lines changed

src/fsharp/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.Utilities.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ module internal Utilities =
126126
| value when not (String.IsNullOrEmpty(value)) ->
127127
Some value // Value set externally
128128
| _ ->
129-
// Probe for netsdk install
129+
// Probe for netsdk install, dotnet. and dotnet.exe is a constant offset from the location of System.Int32
130130
let dotnetLocation =
131131
let dotnetApp =
132132
let platform = Environment.OSVersion.Platform
133133
if platform = PlatformID.Unix then "dotnet" else "dotnet.exe"
134-
let assemblyLocation = typeof<DependencyManagerAttribute>.GetTypeInfo().Assembly.Location
134+
let assemblyLocation = typeof<Int32>.GetTypeInfo().Assembly.Location
135135
Path.Combine(assemblyLocation, "../../..", dotnetApp)
136136

137137
if File.Exists(dotnetLocation) then
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
@@ -76,6 +76,8 @@
7676
<Compile Include="Compiler\Libraries\Core\Operators\RoundTests.fs" />
7777
<Compile Include="Compiler\Libraries\Core\Operators\SignTests.fs" />
7878
<Compile Include="Compiler\Libraries\Core\Operators\StringTests.fs" />
79+
<Compile Include="Compiler\Libraries\Core\Reflection\SprintfTests.fs" />
80+
<Compile Include="Compiler\Libraries\Core\Reflection\PreComputedTupleConstructorTests.fs" />
7981
<Compile Include="Compiler\Libraries\Core\Unchecked\DefaultOfTests.fs" />
8082
<None Include="app.config" />
8183
<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)