From 0963c69598a617d30d88a412bd4fc392338c4cb4 Mon Sep 17 00:00:00 2001 From: RJ Dellecese Date: Mon, 30 Dec 2019 14:08:44 -0500 Subject: Update changelog and alpha order --- test/gleam/function_test.gleam | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'test') diff --git a/test/gleam/function_test.gleam b/test/gleam/function_test.gleam index 86ef9a6..5b3ca42 100644 --- a/test/gleam/function_test.gleam +++ b/test/gleam/function_test.gleam @@ -1,28 +1,10 @@ import gleam/expect -import gleam/function.{flip, compose} +import gleam/function.{compose, flip} import gleam/int as int_mod import gleam/list import gleam/result import gleam/string as string_mod -pub fn flip_test() { - let fun = fn(string: String, int: Int) { - string - |> string_mod.append("String: '", _) - |> string_mod.append(_, "', Int: '") - |> string_mod.append(_, int_mod.to_string(int)) - |> string_mod.append(_, "'") - } - - let flipped_fun = flip(fun) - - fun("Bob", 1) - |> expect.equal(_, "String: 'Bob', Int: '1'") - - flipped_fun(2, "Alice") - |> expect.equal(_, "String: 'Alice', Int: '2'") -} - pub fn compose_test() { let add_two = fn(int: Int) { int + 2 } let add_three = fn(int: Int) { int + 3 } @@ -52,3 +34,21 @@ pub fn compose_test() { |> head_to_string |> expect.equal(_, "0") } + +pub fn flip_test() { + let fun = fn(string: String, int: Int) { + string + |> string_mod.append("String: '", _) + |> string_mod.append(_, "', Int: '") + |> string_mod.append(_, int_mod.to_string(int)) + |> string_mod.append(_, "'") + } + + let flipped_fun = flip(fun) + + fun("Bob", 1) + |> expect.equal(_, "String: 'Bob', Int: '1'") + + flipped_fun(2, "Alice") + |> expect.equal(_, "String: 'Alice', Int: '2'") +} -- cgit v1.2.3