@@ -14,9 +14,14 @@ let makeDisposable () =
1414 { new System.IDisposable
1515 with member this.Dispose () = () }
1616
17+
18+ // type Option<'a> = | Some of 'a | None
19+
1720let ceTests =
1821 testList " CE Tests" [
1922 testCase " Return value" <| fun _ ->
23+
24+
2025 let expected = Some 42
2126 let actual = option {
2227 return 42
@@ -127,22 +132,24 @@ let ceTests =
127132 return data
128133 }
129134 Expect.equal actual ( Some data) " Should be ok"
135+ #if ! FABLE_ COMPILER
130136 testCase " Nullable value" <| fun () ->
131137 let data = 42
132138 let actual = option {
133- return ! System.Nullable data
139+ let! value = System.Nullable< int> data
140+ return value
134141 }
135142 Expect.equal actual ( Some data) " "
136143 testCase " Nullable null" <| fun () ->
137144 let actual = option {
138145 return ! System.Nullable<_> ()
139146 }
140147 Expect.equal actual None " "
141-
148+ #endif
142149 testCase " string value" <| fun () ->
143150 let data = " hello"
144151 let actual = option {
145- let! v = data
152+ let! v = data
146153 return v
147154 }
148155 Expect.equal actual ( Some data) " "
@@ -197,6 +204,7 @@ let ``OptionCE applicative tests`` =
197204 }
198205 Expect.equal actual ( Some 4 ) " Should be Some 4"
199206
207+ #if ! FABLE_ COMPILER
200208 testCase " Happy Path Nullable" <| fun () ->
201209 let actual = option {
202210 let! a = Nullable<_> 3
@@ -205,7 +213,7 @@ let ``OptionCE applicative tests`` =
205213 return a + b - c
206214 }
207215 Expect.equal actual ( Some 4 ) " Should be Some 4"
208-
216+ #endif
209217 testCase " Happy Path null Objects" <| fun () ->
210218 // let hello = CustomClass
211219 let actual = option {
@@ -244,6 +252,7 @@ let ``OptionCE applicative tests`` =
244252 }
245253 Expect.equal actual ( Some 6 ) " Should be Some"
246254
255+ #if ! FABLE_ COMPILER
247256 testCase " Happy Path Option.Some/Nullable" <| fun () ->
248257 let actual = option {
249258 let! a = Some 3
@@ -263,27 +272,29 @@ let ``OptionCE applicative tests`` =
263272 Expect.equal actual ( Some 4 ) " Should be Some 4"
264273
265274
266- testCase " Hapy Combo" <| fun () ->
275+ testCase " Happy Combo all " <| fun () ->
267276 let actual = option {
268277 let! a = Nullable<_> 3
269278 and! b = Some 2
270- and! c = " Nullable<_>() "
279+ and! c = " hello "
271280 and! d = ResizeArray [ 1 ]
272281 and! e = CustomClass 5
273- and! f = Uri " http ://github.com"
274- return a , b , c , d , e , f
282+ and! f = Uri " https ://github.com/ "
283+ return sprintf " %d %d %s %d %d %s " a b c ( Seq.head d ) e.getX ( string f )
275284 }
276- Expect.isSome actual " Should be Some"
277-
285+
286+ Expect.equal actual ( Some " 3 2 hello 1 5 https://github.com/" ) " Should be Some"
287+ #endif
278288 testCase " Fail Path Option.None" <| fun () ->
279289 let actual = option {
280290 let! a = Some 3
281291 and! b = Some 2
282292 and! c = None
283293 return a + b - c
284294 }
285- Expect.isNone actual " Should be None"
286-
295+ Expect.equal actual None " Should be None"
296+
297+ #if ! FABLE_ COMPILER
287298 testCase " Fail Path Nullable" <| fun () ->
288299 let actual = option {
289300 let! a = Nullable 3
@@ -292,7 +303,7 @@ let ``OptionCE applicative tests`` =
292303 return a + b - c
293304 }
294305 Expect.equal actual ( None) " Should be None"
295-
306+ #endif
296307 testCase " Fail Path Objects" <| fun () ->
297308 let c1 = CustomClass 3
298309 let c2 = CustomClass 2
@@ -318,15 +329,16 @@ let ``OptionCE applicative tests`` =
318329 }
319330 Expect.equal actual ( None) " Should be None"
320331
332+ #if ! FABLE_ COMPILER
321333 testCase " Fail Path Option.Some/Nullable" <| fun () ->
322334 let actual = option {
323335 let! a = Nullable<_> 3
324336 and! b = Some 2
325337 and! c = Nullable<_>()
326338 return a + b - c
327339 }
328- Expect.isNone actual " Should be None"
329-
340+ Expect.equal actual None " Should be None"
341+ #endif
330342 ]
331343
332344let allTests = testList " Option CE tests" [
0 commit comments