11namespace XakeLibTests
22
3- open System.IO
4- open System.Collections .Generic
53open NUnit.Framework
64
75open Xake
86
97[<TestFixture>]
108type ``action block allows`` () =
119
12- let MakeDebugOptions () =
13- let errorlist = new System.Collections.Generic.List< string>() in
14- { ExecOptions.Default with FailOnError = true ; CustomLogger = CustomLogger ((=) Level.Error) errorlist.Add; FileLog = " " }, errorlist
15-
10+ let makeStringList () = new System.Collections.Generic.List< string>()
1611 let DebugOptions =
1712 { ExecOptions.Default with FailOnError = true ; FileLog = " " }
1813
19- [<Test ( Description = " Verifies we could use logging from inside action block " ) >]
20- member test.Simple () =
14+ [<Test>]
15+ member __. ``executes the body`` () =
2116
2217 let wasExecuted = ref false
2318
@@ -29,12 +24,12 @@ type ``action block allows``() =
2924
3025 Assert.IsTrue(! wasExecuted)
3126
32- [<Test ( Description = " Verifies simple statements " ) >]
33- member test.Logging () =
27+ [<Test>]
28+ member __. ``execution is ordered`` () =
3429
3530 let wasExecuted = ref false
3631
37- let errorlist = new System.Collections.Generic.List < string > ()
32+ let errorlist = makeStringList ()
3833 let note = errorlist.Add
3934
4035 do xake DebugOptions {
@@ -50,12 +45,12 @@ type ``action block allows``() =
5045 Assert.IsTrue(! wasExecuted)
5146 Assert.That( errorlist, Is.EquivalentTo([ " 1" ; " 2" ; " 3" ]))
5247
53- [<Test ( Description = " Verifies do! " ) >]
54- member test . ``do ! async op `` () =
48+ [<Test>]
49+ member __ .``allows async operations `` () =
5550
5651 let wasExecuted = ref false
5752
58- let errorlist = new System.Collections.Generic.List < string > ()
53+ let errorlist = makeStringList ()
5954 let note = errorlist.Add
6055
6156 do xake DebugOptions {
@@ -73,11 +68,11 @@ type ``action block allows``() =
7368 Assert.That( errorlist, Is.EqualTo([ " 1" ; " 2" ; " 3" ; " 4" ]))
7469
7570 [<Test>]
76- member test . ``do ! action`` () =
71+ member __ . ``do ! action`` () =
7772
7873 let wasExecuted = ref false
7974
80- let errorlist = new System.Collections.Generic.List < string > ()
75+ let errorlist = makeStringList ()
8176 let note = errorlist.Add
8277
8378 let noteAction t = action { do note t}
@@ -98,11 +93,11 @@ type ``action block allows``() =
9893
9994
10095 [<Test>]
101- member test . ``do ! action with result ignored`` () =
96+ member __ . ``do ! action with result ignored`` () =
10297
10398 let wasExecuted = ref false
10499
105- let errorlist = new System.Collections.Generic.List < string > ()
100+ let errorlist = makeStringList ()
106101 let note = errorlist.Add
107102
108103 let testee t =
@@ -127,9 +122,9 @@ type ``action block allows``() =
127122
128123
129124 [<Test>]
130- member test . ``let! returning value`` () =
125+ member __ . ``let! returning value`` () =
131126
132- let errorlist = new System.Collections.Generic.List < string > ()
127+ let errorlist = makeStringList ()
133128 let note = errorlist.Add
134129
135130 let testee t =
@@ -150,9 +145,9 @@ type ``action block allows``() =
150145 Assert.That( errorlist, Is.EqualTo([ " 1" ; " 2+1" ; " 3" ] |> List.toArray))
151146
152147 [<Test>]
153- member test .``if of various kinds`` () =
148+ member __ .``if of various kinds`` () =
154149
155- let errorlist = new System.Collections.Generic.List < string > ()
150+ let errorlist = makeStringList ()
156151 let note = errorlist.Add
157152
158153 let iif f a b =
@@ -182,9 +177,9 @@ type ``action block allows``() =
182177 Assert.That( errorlist, Is.EqualTo([ " i1-t" ; " i2-f" ; " 2" ; " 3" ] |> List.toArray))
183178
184179 [<Test>]
185- member test .``if without else`` () =
180+ member __ .``if without else`` () =
186181
187- let errorlist = new System.Collections.Generic.List < string > ()
182+ let errorlist = makeStringList ()
188183 let note = errorlist.Add
189184
190185 let iif f a b =
@@ -202,7 +197,7 @@ type ``action block allows``() =
202197 if s1 = " 2" then
203198 do note " 3"
204199
205- for i in [ 1 .. 5 ] do
200+ for _ in [ 1 .. 5 ] do
206201 ()
207202
208203 do note " 4"
@@ -212,9 +207,9 @@ type ``action block allows``() =
212207 Assert.That( errorlist, Is.EqualTo([ " i1-t" ; " 3" ; " 4" ] |> List.toArray))
213208
214209 [<Test>]
215- member test .``for and while`` () =
210+ member __ .``for and while`` () =
216211
217- let errorlist = new System.Collections.Generic.List < string > ()
212+ let errorlist = makeStringList ()
218213 let note = errorlist.Add
219214
220215 do xake DebugOptions {
@@ -226,7 +221,7 @@ type ``action block allows``() =
226221 do note " 1"
227222
228223 for i in [ 1 .. 3 ] do
229- do ! writeLog Info " %A " i
224+ do ! trace Info " %A " i
230225 do note ( sprintf " i=%i " i)
231226
232227 let j = ref 3
@@ -241,9 +236,9 @@ type ``action block allows``() =
241236 Assert.That( errorlist, Is.EqualTo([ " 1" ; " i=1" ; " i=2" ; " i=3" ; " j=3" ; " j=4" ; " 4" ] |> List.toArray))
242237
243238 [<Test; Explicit>]
244- member test .``try catch finally`` () =
239+ member __ .``try catch finally`` () =
245240
246- let errorlist = new System.Collections.Generic.List < string > ()
241+ let errorlist = makeStringList ()
247242 let note = errorlist.Add
248243
249244 do xake DebugOptions {
0 commit comments