Skip to content

Commit 3d04676

Browse files
committed
test associativity
1 parent 4b43180 commit 3d04676

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

tests/FSharpPlus.Tests/Expr.fs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,36 @@ module Expr =
3535
let ``2-layers quotation combination`` evaluator =
3636
let expr =
3737
<@ 4 + 5 @>
38+
>>= (fun x ->
39+
let a = x + 10
40+
<@ (a, a*a) @>
41+
>>= fun (x, y) ->
42+
<@ ([x + y], x, y, [|x; y|]) @>)
43+
let res = Expr.run evaluator expr
44+
45+
areEqual ([380], 19, 361, [|19; 361|]) res
46+
47+
[<Test>]
48+
let ``2-layers quotation combination [Unquote]`` () = ``2-layers quotation combination`` unquote
49+
50+
[<Test>]
51+
let ``2-layers quotation combination [PowerPack]`` () = ``2-layers quotation combination`` powerpack
52+
53+
54+
let ``2-layers quot comb associative`` evaluator =
55+
let expr =
56+
(<@ 4 + 5 @>
3857
>>= fun x ->
3958
let a = x + 10
40-
<@ (a, a*a) @>
59+
<@ (a, a*a) @>)
4160
>>= fun (x, y) ->
4261
<@ ([x + y], x, y, [|x; y|]) @>
4362
let res = Expr.run evaluator expr
4463

4564
areEqual ([380], 19, 361, [|19; 361|]) res
4665

4766
[<Test>]
48-
let ``2-layers quotation combination [Unquote]`` () = ``2-layers quotation combination`` unquote
67+
let ``2-layers quot comb associative [Unquote]`` () = ``2-layers quot comb associative`` unquote
4968

5069
[<Test>]
51-
let ``2-layers quotation combination [PowerPack]`` () = ``2-layers quotation combination`` powerpack
70+
let ``2-layers quot comb associative [PowerPack]`` () = ``2-layers quot comb associative`` powerpack

0 commit comments

Comments
 (0)