From 2a7d9061e4ec9c763053b078db2d98400bd08dd5 Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Sun, 10 Mar 2019 20:07:37 +0000 Subject: Surround Fn's in parens if called directly Closes https://github.com/lpil/gleam/issues/88 --- gen/bool.erl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'gen/bool.erl') diff --git a/gen/bool.erl b/gen/bool.erl index 52a9379..9024a16 100644 --- a/gen/bool.erl +++ b/gen/bool.erl @@ -14,10 +14,10 @@ max(A, B) -> -ifdef(TEST). max_test() -> - _ = fun(Capture1) -> expect:equal(Capture1, true) end(max(true, true)), - _ = fun(Capture1) -> expect:equal(Capture1, true) end(max(true, false)), - _ = fun(Capture1) -> expect:equal(Capture1, false) end(max(false, false)), - fun(Capture1) -> expect:equal(Capture1, true) end(max(false, true)). + _ = (fun(Capture1) -> expect:equal(Capture1, true) end)(max(true, true)), + _ = (fun(Capture1) -> expect:equal(Capture1, true) end)(max(true, false)), + _ = (fun(Capture1) -> expect:equal(Capture1, false) end)(max(false, false)), + (fun(Capture1) -> expect:equal(Capture1, true) end)(max(false, true)). -endif. min(A, B) -> @@ -31,10 +31,10 @@ min(A, B) -> -ifdef(TEST). min_test() -> - _ = fun(Capture1) -> expect:equal(Capture1, true) end(min(true, true)), - _ = fun(Capture1) -> expect:equal(Capture1, false) end(min(true, false)), - _ = fun(Capture1) -> expect:equal(Capture1, false) end(min(false, false)), - fun(Capture1) -> expect:equal(Capture1, false) end(min(false, true)). + _ = (fun(Capture1) -> expect:equal(Capture1, true) end)(min(true, true)), + _ = (fun(Capture1) -> expect:equal(Capture1, false) end)(min(true, false)), + _ = (fun(Capture1) -> expect:equal(Capture1, false) end)(min(false, false)), + (fun(Capture1) -> expect:equal(Capture1, false) end)(min(false, true)). -endif. to_int(Bool) -> @@ -48,6 +48,6 @@ to_int(Bool) -> -ifdef(TEST). to_int_test() -> - _ = fun(Capture1) -> expect:equal(Capture1, 1) end(to_int(true)), - fun(Capture1) -> expect:equal(Capture1, 0) end(to_int(false)). + _ = (fun(Capture1) -> expect:equal(Capture1, 1) end)(to_int(true)), + (fun(Capture1) -> expect:equal(Capture1, 0) end)(to_int(false)). -endif. -- cgit v1.2.3