Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit72b923c

Browse files
committed
Modify core unit tests to appease older NUnit versions (changeset 1389808)
1 parentf2d286c commit72b923c

File tree

6 files changed

+39
-39
lines changed

6 files changed

+39
-39
lines changed

‎src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule.fs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ type ArrayModule() =
425425
[<Test>]
426426
memberthis.countBy()=
427427
// countBy should work on empty array
428-
Assert.AreEqual([],Array.countBy(fun _-> failwith"should not be executed")[||])
428+
Assert.AreEqual([||],Array.countBy(fun _-> failwith"should not be executed")[||])
429429

430430
// countBy should not work on null
431431
CheckThrowsArgumentNullException(fun()-> Array.countBy(fun _-> failwith"should not be executed")null|> ignore)
@@ -1487,8 +1487,8 @@ type ArrayModule() =
14871487
memberthis.Singleton()=
14881488
Assert.AreEqual([|null|],Array.singletonnull)
14891489
Assert.AreEqual([|"1"|],Array.singleton"1")
1490-
Assert.AreEqual([|[]|],Array.singleton[])
1491-
Assert.AreEqual([|[||]|],Array.singleton[||])
1490+
Assert.AreEqual([|[]|],Array.singleton[])
1491+
Assert.IsTrue([|[||]|]=Array.singleton[||])
14921492

14931493
#if FX_NO_TPL_PARALLEL
14941494
#else

‎src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ArrayModule2.fs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ type ArrayModule2() =
10901090
try
10911091
config.InputArray
10921092
|> Array.windowed config.WindowSize
1093-
|>(fun actual-> Assert.AreEqual(config.ExpectedArray,actual))
1093+
|>(fun actual-> Assert.IsTrue(config.ExpectedArray=actual))
10941094
with
10951095
|_when Option.isNone config.Exception-> Assert.Fail()
10961096
| ewhen e.GetType()=(Option.get config.Exception)->()
@@ -1168,9 +1168,9 @@ type ArrayModule2() =
11681168
if windowSize<=0then
11691169
CheckThrowsArgumentException(fun()-> Array.windowed windowSize[|1..arraySize|]|> ignore)
11701170
elif arraySize< windowSizethen
1171-
Assert.AreEqual([||], Array.windowed windowSize[|1..arraySize|])
1171+
Assert.IsTrue([||]= Array.windowed windowSize[|1..arraySize|])
11721172
else
1173-
Assert.AreEqual(expectedArrays.[arraySize, windowSize], Array.windowed windowSize[|1..arraySize|])
1173+
Assert.IsTrue(expectedArrays.[arraySize, windowSize]= Array.windowed windowSize[|1..arraySize|])
11741174

11751175
()
11761176

‎src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ListModule.fs‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ type ListModule() =
146146

147147
[<Test>]
148148
memberthis.Take()=
149-
Assert.AreEqual([],List.take0[])
150-
Assert.AreEqual([],List.take0["str1";"str2";"str3";"str4"])
149+
Assert.AreEqual([],List.take0[])
150+
Assert.AreEqual(([]: string list),List.take0["str1";"str2";"str3";"str4"])
151151
Assert.AreEqual([1;2;4],List.take3[1;2;4;5;7])
152152
Assert.AreEqual(["str1";"str2"],List.take2["str1";"str2";"str3";"str4"])
153153

@@ -205,12 +205,12 @@ type ListModule() =
205205

206206
[<Test>]
207207
memberthis.takeWhile()=
208-
Assert.AreEqual([],List.takeWhile(fun x-> failwith"should not be used")[])
208+
Assert.AreEqual([],List.takeWhile(fun x-> failwith"should not be used")[])
209209
Assert.AreEqual([1;2;4;5],List.takeWhile(fun x-> x<6)[1;2;4;5;6;7])
210210
Assert.AreEqual(["a";"ab";"abc"],List.takeWhile(fun(x:string)-> x.Length<4)["a";"ab";"abc";"abcd";"abcde"])
211211
Assert.AreEqual(["a";"ab";"abc";"abcd";"abcde"],List.takeWhile(fun _->true)["a";"ab";"abc";"abcd";"abcde"])
212-
Assert.AreEqual([],List.takeWhile(fun _->false)["a";"ab";"abc";"abcd";"abcde"])
213-
Assert.AreEqual([],List.takeWhile(fun _->false)["a"])
212+
Assert.AreEqual(([]: string list),List.takeWhile(fun _->false)["a";"ab";"abc";"abcd";"abcde"])
213+
Assert.AreEqual(([]: string list),List.takeWhile(fun _->false)["a"])
214214
Assert.AreEqual(["a"],List.takeWhile(fun _->true)["a"])
215215
Assert.AreEqual(["a"],List.takeWhile(fun x-> x<>"ab")["a";"ab";"abc";"abcd";"abcde"])
216216

@@ -242,19 +242,19 @@ type ListModule() =
242242

243243
[<Test>]
244244
memberthis.splitAt()=
245-
Assert.AreEqual(([],[]), List.splitAt0[])
245+
Assert.IsTrue(([],[])= List.splitAt0[])
246246

247247
Assert.AreEqual([1..4], List.splitAt4[1..10]|> fst)
248248
Assert.AreEqual([5..10], List.splitAt4[1..10]|> snd)
249249

250-
Assert.AreEqual([], List.splitAt0[1..2]|> fst)
250+
Assert.AreEqual(([]: int list), List.splitAt0[1..2]|> fst)
251251
Assert.AreEqual([1..2], List.splitAt0[1..2]|> snd)
252252

253253
Assert.AreEqual([1], List.splitAt1[1..2]|> fst)
254254
Assert.AreEqual([2], List.splitAt1[1..2]|> snd)
255255

256256
Assert.AreEqual([1..2], List.splitAt2[1..2]|> fst)
257-
Assert.AreEqual([], List.splitAt2[1..2]|> snd)
257+
Assert.AreEqual(([]: int list), List.splitAt2[1..2]|> snd)
258258

259259
Assert.AreEqual(["a"], List.splitAt1["a";"b";"c"]|> fst)
260260
Assert.AreEqual(["b";"c"], List.splitAt1["a";"b";"c"]|> snd)
@@ -268,7 +268,7 @@ type ListModule() =
268268
[<Test>]
269269
memberthis.countBy()=
270270
// countBy should work on empty list
271-
Assert.AreEqual([],List.countBy(fun _-> failwith"should not be executed")[])
271+
Assert.AreEqual(([]:(obj*int) list),List.countBy(fun _-> failwith"should not be executed")[])
272272

273273
// countBy should count by the given key function
274274
Assert.AreEqual([5,1;2,2;3,2],List.countBy id[5;2;2;3;3])
@@ -362,7 +362,7 @@ type ListModule() =
362362

363363
[<Test>]
364364
memberthis.``where should work like filter``()=
365-
Assert.AreEqual([], List.where(fun x-> x%2=0)[])
365+
Assert.AreEqual(([]: int list), List.where(fun x-> x%2=0)[])
366366
Assert.AreEqual([0;2;4;6;8], List.where(fun x-> x%2=0)[0..9])
367367
Assert.AreEqual(["a";"b";"c"], List.where(fun _->true)["a";"b";"c"])
368368

@@ -394,8 +394,8 @@ type ListModule() =
394394
[<Test>]
395395
memberthis.replicate()=
396396
// replicate should create multiple copies of the given value
397-
Assert.AreEqual([],List.replicate0null)
398-
Assert.AreEqual([],List.replicate01)
397+
Assert.AreEqual([],List.replicate0null)
398+
Assert.AreEqual(([]: int list),List.replicate01)
399399
Assert.AreEqual([null],List.replicate1null)
400400
Assert.AreEqual(["1";"1"],List.replicate2"1")
401401

@@ -923,8 +923,8 @@ type ListModule() =
923923

924924
[<Test>]
925925
memberthis.``pairwise should return pairs of the input list``()=
926-
Assert.AreEqual([],List.pairwise[])
927-
Assert.AreEqual([],List.pairwise[1])
926+
Assert.AreEqual(([]:(obj*obj) list),List.pairwise[])
927+
Assert.AreEqual(([]:(int*int) list),List.pairwise[1])
928928
Assert.AreEqual([1,2],List.pairwise[1;2])
929929
Assert.AreEqual([1,2;2,3],List.pairwise[1;2;3])
930930
Assert.AreEqual(["H","E";"E","L";"L","L";"L","O"],List.pairwise["H";"E";"L";"L";"O"])

‎src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ListModule2.fs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ type ListModule02() =
223223

224224
// empty List
225225
letresultEpt,resultEptAcc= List.mapFold funcInt100[]
226-
Assert.AreEqual([], resultEpt)
226+
Assert.AreEqual(([]: int list), resultEpt)
227227
Assert.AreEqual(100, resultEptAcc)
228228

229229
()
@@ -249,7 +249,7 @@ type ListModule02() =
249249

250250
// empty List
251251
letresultEpt,resultEptAcc= List.mapFoldBack funcInt[]100
252-
Assert.AreEqual([], resultEpt)
252+
Assert.AreEqual(([]: int list), resultEpt)
253253
Assert.AreEqual(100, resultEptAcc)
254254

255255
()
@@ -681,7 +681,7 @@ type ListModule02() =
681681

682682
// empty list
683683
letresultEpt= List.sortWith intComparer[]
684-
Assert.AreEqual([], resultEpt)
684+
Assert.AreEqual(([]: int list), resultEpt)
685685

686686
()
687687

@@ -821,7 +821,7 @@ type ListModule02() =
821821
// integer list
822822
Assert.AreEqual([1..3], List.truncate3[1..5])
823823
Assert.AreEqual([1..5], List.truncate10[1..5])
824-
Assert.AreEqual([], List.truncate0[1..5])
824+
Assert.AreEqual(([]: int list), List.truncate0[1..5])
825825

826826
// string list
827827
Assert.AreEqual(["str1";"str2"], List.truncate2["str1";"str2";"str3"])
@@ -1044,7 +1044,7 @@ type ListModule02() =
10441044
if windowSize<=0then
10451045
CheckThrowsArgumentException(fun()-> List.windowed windowSize[1..arraySize]|> ignore)
10461046
elif arraySize< windowSizethen
1047-
Assert.AreEqual([], List.windowed windowSize[1..arraySize])
1047+
Assert.AreEqual(([]: int[] list), List.windowed windowSize[1..arraySize])
10481048
else
10491049
Assert.AreEqual(expectedLists.[arraySize, windowSize], List.windowed windowSize[1..arraySize])
10501050

‎src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/ListType.fs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ type ListType() =
223223
Assert.AreEqual(lst.[1..],[2;3;4;5;6])
224224
Assert.AreEqual(lst.[2..],[3;4;5;6])
225225
Assert.AreEqual(lst.[5..],[6])
226-
Assert.AreEqual(lst.[6..],[])
226+
Assert.AreEqual(lst.[6..],([]: int list))
227227
CheckThrowsIndexOutRangException((fun _-> lst.[7..]|> ignore))
228228

229229
CheckThrowsIndexOutRangException((fun _-> lst.[..-1]|> ignore))
@@ -235,8 +235,8 @@ type ListType() =
235235
Assert.AreEqual(lst.[..5],[1;2;3;4;5;6])
236236
CheckThrowsIndexOutRangException((fun _-> lst.[..6]|> ignore))
237237

238-
Assert.AreEqual(lst.[1..-1],[])
239-
Assert.AreEqual(lst.[1..0],[])
238+
Assert.AreEqual(lst.[1..-1],([]: int list))
239+
Assert.AreEqual(lst.[1..0],([]: int list))
240240
Assert.AreEqual(lst.[1..1],[2])
241241
Assert.AreEqual(lst.[1..2],[2;3])
242242
Assert.AreEqual(lst.[1..3],[2;3;4])
@@ -247,11 +247,11 @@ type ListType() =
247247
CheckThrowsIndexOutRangException((fun _-> lst.[-1..1]|> ignore))
248248
Assert.AreEqual(lst.[0..1],[1;2])
249249
Assert.AreEqual(lst.[1..1],[2])
250-
Assert.AreEqual(lst.[2..1],[])
251-
Assert.AreEqual(lst.[3..1],[])
252-
Assert.AreEqual(lst.[4..1],[])
250+
Assert.AreEqual(lst.[2..1],([]: int list))
251+
Assert.AreEqual(lst.[3..1],([]: int list))
252+
Assert.AreEqual(lst.[4..1],([]: int list))
253253

254-
Assert.AreEqual(lst.[-3..-4],[])
254+
Assert.AreEqual(lst.[-3..-4],([]: int list))
255255
CheckThrowsIndexOutRangException((fun _-> lst.[-4..-3]|> ignore))
256256

257257
letempty:obj list= List.empty

‎src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/SeqModule2.fs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,17 @@ type SeqModule2() =
6464

6565
[<Test>]
6666
memberthis.Tl()=
67-
// integer seq
68-
letresultInt= Seq.tail<|seq{1..10}
69-
Assert.AreEqual(seq{2..10}, resultInt)
67+
// integer seq
68+
letresultInt= Seq.tail<|seq{1..10}
69+
VerifySeqsEqual(seq{2..10}) resultInt
7070

71-
// string seq
71+
// string seq
7272
letresultStr= Seq.tail<|seq{yield"a";yield"b";yield"c";yield"d"}
73-
Assert.AreEqual(seq{yield"b";yield"c";yield"d"}, resultStr)
73+
VerifySeqsEqual(seq{yield"b";yield"c";yield"d"}) resultStr
7474

75-
// 1-element seq
75+
// 1-element seq
7676
letresultStr2= Seq.tail<|seq{yield"a"}
77-
Assert.AreEqual(Seq.empty, resultStr2)
77+
VerifySeqsEqualSeq.empty resultStr2
7878

7979
CheckThrowsArgumentNullException(fun()-> Seq.tailnull|> ignore)
8080
CheckThrowsArgumentException(fun()-> Seq.tail Seq.empty|> Seq.iter(fun _-> failwith"Should not be reached"))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp