aboutsummaryrefslogtreecommitdiff
path: root/gen/order.erl
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2019-03-10 20:07:37 +0000
committerLouis Pilfold <louis@lpil.uk>2019-03-10 20:07:37 +0000
commit2a7d9061e4ec9c763053b078db2d98400bd08dd5 (patch)
treea6f36c30dc08db6a85cd1dad4b99031380e81832 /gen/order.erl
parentd74af16e6a527f46730c3d35554ef55677c9caf4 (diff)
downloadgleam_stdlib-2a7d9061e4ec9c763053b078db2d98400bd08dd5.tar.gz
gleam_stdlib-2a7d9061e4ec9c763053b078db2d98400bd08dd5.zip
Surround Fn's in parens if called directly
Closes https://github.com/lpil/gleam/issues/88
Diffstat (limited to 'gen/order.erl')
-rw-r--r--gen/order.erl66
1 files changed, 33 insertions, 33 deletions
diff --git a/gen/order.erl b/gen/order.erl
index 10b5dd7..edf63a7 100644
--- a/gen/order.erl
+++ b/gen/order.erl
@@ -17,9 +17,9 @@ reverse(Order) ->
-ifdef(TEST).
reverse_test() ->
- _ = fun(Capture1) -> expect:equal(Capture1, gt) end(reverse(lt)),
- _ = fun(Capture1) -> expect:equal(Capture1, eq) end(reverse(eq)),
- fun(Capture1) -> expect:equal(Capture1, lt) end(reverse(gt)).
+ _ = (fun(Capture1) -> expect:equal(Capture1, gt) end)(reverse(lt)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, eq) end)(reverse(eq)),
+ (fun(Capture1) -> expect:equal(Capture1, lt) end)(reverse(gt)).
-endif.
to_int(Order) ->
@@ -36,9 +36,9 @@ to_int(Order) ->
-ifdef(TEST).
to_int_test() ->
- _ = fun(Capture1) -> expect:equal(Capture1, -1) end(to_int(lt)),
- _ = fun(Capture1) -> expect:equal(Capture1, 0) end(to_int(eq)),
- fun(Capture1) -> expect:equal(Capture1, 1) end(to_int(gt)).
+ _ = (fun(Capture1) -> expect:equal(Capture1, -1) end)(to_int(lt)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, 0) end)(to_int(eq)),
+ (fun(Capture1) -> expect:equal(Capture1, 1) end)(to_int(gt)).
-endif.
compare(A, B) ->
@@ -64,15 +64,15 @@ compare(A, B) ->
-ifdef(TEST).
compare_test() ->
- _ = fun(Capture1) -> expect:equal(Capture1, eq) end(compare(lt, lt)),
- _ = fun(Capture1) -> expect:equal(Capture1, lt) end(compare(lt, eq)),
- _ = fun(Capture1) -> expect:equal(Capture1, lt) end(compare(lt, gt)),
- _ = fun(Capture1) -> expect:equal(Capture1, gt) end(compare(eq, lt)),
- _ = fun(Capture1) -> expect:equal(Capture1, eq) end(compare(eq, eq)),
- _ = fun(Capture1) -> expect:equal(Capture1, lt) end(compare(eq, gt)),
- _ = fun(Capture1) -> expect:equal(Capture1, gt) end(compare(gt, lt)),
- _ = fun(Capture1) -> expect:equal(Capture1, gt) end(compare(gt, eq)),
- fun(Capture1) -> expect:equal(Capture1, eq) end(compare(gt, gt)).
+ _ = (fun(Capture1) -> expect:equal(Capture1, eq) end)(compare(lt, lt)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, lt) end)(compare(lt, eq)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, lt) end)(compare(lt, gt)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, gt) end)(compare(eq, lt)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, eq) end)(compare(eq, eq)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, lt) end)(compare(eq, gt)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, gt) end)(compare(gt, lt)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, gt) end)(compare(gt, eq)),
+ (fun(Capture1) -> expect:equal(Capture1, eq) end)(compare(gt, gt)).
-endif.
max(A, B) ->
@@ -89,15 +89,15 @@ max(A, B) ->
-ifdef(TEST).
max_test() ->
- _ = fun(Capture1) -> expect:equal(Capture1, lt) end(max(lt, lt)),
- _ = fun(Capture1) -> expect:equal(Capture1, eq) end(max(lt, eq)),
- _ = fun(Capture1) -> expect:equal(Capture1, gt) end(max(lt, gt)),
- _ = fun(Capture1) -> expect:equal(Capture1, eq) end(max(eq, lt)),
- _ = fun(Capture1) -> expect:equal(Capture1, eq) end(max(eq, eq)),
- _ = fun(Capture1) -> expect:equal(Capture1, gt) end(max(eq, gt)),
- _ = fun(Capture1) -> expect:equal(Capture1, gt) end(max(gt, lt)),
- _ = fun(Capture1) -> expect:equal(Capture1, gt) end(max(gt, eq)),
- fun(Capture1) -> expect:equal(Capture1, gt) end(max(gt, gt)).
+ _ = (fun(Capture1) -> expect:equal(Capture1, lt) end)(max(lt, lt)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, eq) end)(max(lt, eq)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, gt) end)(max(lt, gt)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, eq) end)(max(eq, lt)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, eq) end)(max(eq, eq)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, gt) end)(max(eq, gt)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, gt) end)(max(gt, lt)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, gt) end)(max(gt, eq)),
+ (fun(Capture1) -> expect:equal(Capture1, gt) end)(max(gt, gt)).
-endif.
min(A, B) ->
@@ -114,13 +114,13 @@ min(A, B) ->
-ifdef(TEST).
min_test() ->
- _ = fun(Capture1) -> expect:equal(Capture1, lt) end(min(lt, lt)),
- _ = fun(Capture1) -> expect:equal(Capture1, lt) end(min(lt, eq)),
- _ = fun(Capture1) -> expect:equal(Capture1, lt) end(min(lt, gt)),
- _ = fun(Capture1) -> expect:equal(Capture1, lt) end(min(eq, lt)),
- _ = fun(Capture1) -> expect:equal(Capture1, eq) end(min(eq, eq)),
- _ = fun(Capture1) -> expect:equal(Capture1, eq) end(min(eq, gt)),
- _ = fun(Capture1) -> expect:equal(Capture1, lt) end(min(gt, lt)),
- _ = fun(Capture1) -> expect:equal(Capture1, eq) end(min(gt, eq)),
- fun(Capture1) -> expect:equal(Capture1, gt) end(min(gt, gt)).
+ _ = (fun(Capture1) -> expect:equal(Capture1, lt) end)(min(lt, lt)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, lt) end)(min(lt, eq)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, lt) end)(min(lt, gt)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, lt) end)(min(eq, lt)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, eq) end)(min(eq, eq)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, eq) end)(min(eq, gt)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, lt) end)(min(gt, lt)),
+ _ = (fun(Capture1) -> expect:equal(Capture1, eq) end)(min(gt, eq)),
+ (fun(Capture1) -> expect:equal(Capture1, gt) end)(min(gt, gt)).
-endif.