Skip to content

Commit 6366d1e

Browse files
moved fsharpqa/Libraries/Core/ExtraTopLevelOperators test cases to NUnit (#9388)
1 parent b17ecf2 commit 6366d1e

5 files changed

Lines changed: 48 additions & 33 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
open FSharp.TestHelpers
7+
8+
module ``Dictionary Tests`` =
9+
10+
[<Test>]
11+
let ``Assigning to dictionary should compile``() =
12+
// Regression test for FSHARP1.0:5365
13+
14+
CompilerAssert.Pass
15+
"""
16+
module N.M
17+
18+
open System
19+
open System.Collections.Generic
20+
21+
type ICloneable<'a> =
22+
abstract Clone : unit -> 'a
23+
24+
type DictionaryFeature<'key> (dict: IDictionary<'key, int>) =
25+
member this.Add key value =
26+
dict.[key] <- value
27+
"""
28+
29+
[<Test>]
30+
let ``Assigning to dictionary with type constraint should compile``() =
31+
// Regression test for FSHARP1.0:5365
32+
// Used to give error: value must be local and mutable in order to mutate the contents of a value type, e.g. 'let mutable x = ...'
33+
34+
CompilerAssert.Pass
35+
"""
36+
module N.M
37+
38+
open System
39+
open System.Collections.Generic
40+
41+
type ICloneable<'a> =
42+
abstract Clone : unit -> 'a
43+
44+
type DictionaryFeature<'key, 'dict when 'dict :> IDictionary<'key, int> and 'dict :> ICloneable<'dict>> (dict: 'dict) =
45+
member this.Add key value =
46+
dict.[key] <- value
47+
"""

tests/fsharp/FSharpSuite.Tests.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
<Compile Include="Compiler\Libraries\Core\Collections\MapTests.fs" />
8080
<Compile Include="Compiler\Libraries\Core\Collections\CollectionTests.fs" />
8181
<Compile Include="Compiler\Libraries\Core\Collections\ListTests.fs" />
82+
<Compile Include="Compiler\Libraries\Core\ExtraTopLevelOperators\DictionaryTests.fs" />
8283
<None Include="app.config" />
8384
<None Include="update.base.line.with.actuals.fsx" />
8485

tests/fsharpqa/Source/Libraries/Core/ExtraTopLevelOperators/dict_typecheck01.fs

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

tests/fsharpqa/Source/Libraries/Core/ExtraTopLevelOperators/dict_typecheck02.fs

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

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

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

0 commit comments

Comments
 (0)