Skip to content

Commit 2aa3874

Browse files
authored
Merge pull request #9436 from dotnet/merges/master-to-release/dev16.7
Merge master to release/dev16.7
2 parents d7c00c9 + 4dd0741 commit 2aa3874

File tree

5 files changed

+93
-153
lines changed

5 files changed

+93
-153
lines changed

tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/ComparisonTests.fs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace FSharp.Compiler.UnitTests
44

55
open NUnit.Framework
6+
open FSharp.TestHelpers
67

78
[<TestFixture>]
89
module ``Comparison Tests`` =
@@ -16,4 +17,27 @@ module ``Comparison Tests`` =
1617

1718
Assert.IsFalse (W System.Double.NaN = W System.Double.NaN)
1819
Assert.IsTrue ((W System.Double.NaN).Equals(W System.Double.NaN))
19-
Assert.areEqual (compare (W System.Double.NaN) (W System.Double.NaN)) 0
20+
Assert.areEqual (compare (W System.Double.NaN) (W System.Double.NaN)) 0
21+
22+
[<Test>]
23+
let ``Comparisons with wrapped NaN in FSI``() =
24+
// Regression test for FSHARP1.0:5640
25+
// This is a sanity test: more coverage in FSHARP suite...
26+
27+
CompilerAssert.RunScriptWithOptions [| "--langversion:preview" |]
28+
"""
29+
type 'a www = W of 'a
30+
31+
let assertTrue a =
32+
if (not a) then failwithf "Expected true, but found false."
33+
()
34+
35+
let p = W System.Double.NaN = W System.Double.NaN
36+
let q = (W System.Double.NaN).Equals(W System.Double.NaN)
37+
let z = compare (W System.Double.NaN) (W System.Double.NaN)
38+
39+
assertTrue (not p)
40+
assertTrue q
41+
assertTrue (z = 0)
42+
"""
43+
[]

tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/StringFormatTests.fs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace FSharp.Compiler.UnitTests
44

55
open NUnit.Framework
6+
open FSharp.TestHelpers
67

78
[<TestFixture>]
89
module ``String Format Tests`` =
@@ -137,3 +138,70 @@ module ``String Format Tests`` =
137138
Assert.areEqual (string infinityf) "Infinity"
138139
Assert.areEqual (string nanf) "NaN"
139140
Assert.areEqual (string (new System.Guid("210f4d6b-cb42-4b09-baa1-f1aa8e59d4b0"))) "210f4d6b-cb42-4b09-baa1-f1aa8e59d4b0"
141+
142+
[<Test>]
143+
let ``string constructor in FSI``() =
144+
// Regression test for FSHARP1.0:5894
145+
146+
CompilerAssert.RunScriptWithOptions [| "--langversion:preview" |]
147+
"""
148+
let assertEqual a b =
149+
if a <> b then failwithf "Expected '%s', but got '%s'" a b
150+
()
151+
152+
assertEqual (string 1.0f) "1"
153+
assertEqual (string 1.00001f) "1.00001"
154+
assertEqual (string -1.00001f) "-1.00001"
155+
assertEqual (string 1.0) "1"
156+
assertEqual (string 1.00001) "1.00001"
157+
assertEqual (string -1.00001) "-1.00001"
158+
assertEqual (string System.SByte.MaxValue) "127"
159+
assertEqual (string System.SByte.MinValue) "-128"
160+
assertEqual (string 0y) "0"
161+
assertEqual (string -1y) "-1"
162+
assertEqual (string 1y) "1"
163+
assertEqual (string System.Byte.MaxValue) "255"
164+
assertEqual (string System.Byte.MinValue) "0"
165+
assertEqual (string 0uy) "0"
166+
assertEqual (string 1uy) "1"
167+
assertEqual (string System.Int16.MaxValue) "32767"
168+
assertEqual (string System.Int16.MinValue) "-32768"
169+
assertEqual (string 0s) "0"
170+
assertEqual (string -10s) "-10"
171+
assertEqual (string 10s) "10"
172+
assertEqual (string System.UInt16.MaxValue) "65535"
173+
assertEqual (string System.UInt16.MinValue) "0"
174+
assertEqual (string 0us) "0"
175+
assertEqual (string 110us) "110"
176+
assertEqual (string System.Int32.MaxValue) "2147483647"
177+
assertEqual (string System.Int32.MinValue) "-2147483648"
178+
assertEqual (string 0) "0"
179+
assertEqual (string -10) "-10"
180+
assertEqual (string 10) "10"
181+
assertEqual (string System.UInt32.MaxValue) "4294967295"
182+
assertEqual (string System.UInt32.MinValue) "0"
183+
assertEqual (string 0u) "0"
184+
assertEqual (string 10u) "10"
185+
assertEqual (string System.Int64.MaxValue) "9223372036854775807"
186+
assertEqual (string System.Int64.MinValue) "-9223372036854775808"
187+
assertEqual (string 0L) "0"
188+
assertEqual (string -10L) "-10"
189+
assertEqual (string 10L) "10"
190+
assertEqual (string System.UInt64.MaxValue) "18446744073709551615"
191+
assertEqual (string System.UInt64.MinValue) "0"
192+
assertEqual (string 0UL) "0"
193+
assertEqual (string 10UL) "10"
194+
assertEqual (string System.Decimal.MaxValue) "79228162514264337593543950335"
195+
assertEqual (string System.Decimal.MinValue) "-79228162514264337593543950335"
196+
assertEqual (string System.Decimal.Zero) "0"
197+
assertEqual (string 12345678M) "12345678"
198+
assertEqual (string -12345678M) "-12345678"
199+
assertEqual (string -infinity) "-Infinity"
200+
assertEqual (string infinity) "Infinity"
201+
assertEqual (string nan) "NaN"
202+
assertEqual (string -infinityf) "-Infinity"
203+
assertEqual (string infinityf) "Infinity"
204+
assertEqual (string nanf) "NaN"
205+
assertEqual (string (new System.Guid("210f4d6b-cb42-4b09-baa1-f1aa8e59d4b0"))) "210f4d6b-cb42-4b09-baa1-f1aa8e59d4b0"
206+
"""
207+
[]

tests/fsharpqa/Source/Libraries/Core/LanguagePrimitives/anytostring01.fsx

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

tests/fsharpqa/Source/Libraries/Core/LanguagePrimitives/compare01.fsx

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

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

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

0 commit comments

Comments
 (0)