diff options
author | Étienne Lévesque <contact@etiennel.dev> | 2022-10-20 21:05:30 -0400 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2022-10-25 14:49:22 +0100 |
commit | ed7bd3774c46d374c0a466cc0a946fa96fe2003f (patch) | |
tree | 26b0971c45b6e45769114acbde8c858b46148a1c /test | |
parent | a0c6b16febffa0c52293016fc82dd23610f23009 (diff) | |
download | gleam_stdlib-ed7bd3774c46d374c0a466cc0a946fa96fe2003f.tar.gz gleam_stdlib-ed7bd3774c46d374c0a466cc0a946fa96fe2003f.zip |
add function.applyX
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/function_test.gleam | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/gleam/function_test.gleam b/test/gleam/function_test.gleam index eff4dea..d481893 100644 --- a/test/gleam/function_test.gleam +++ b/test/gleam/function_test.gleam @@ -122,3 +122,51 @@ pub fn tap_test() { }) |> should.equal("Thanks Joe & Louis") } + +pub fn apply1_test() { + let fun = fn(x1) { x1 } + + fun + |> function.apply1(1) + |> should.equal(1) +} + +pub fn apply2_test() { + let fun = fn(x1, x2) { x1 + x2 } + + fun + |> function.apply2(1, 2) + |> should.equal(3) +} + +pub fn apply3_test() { + let fun = fn(x1, x2, x3) { x1 + x2 + x3 } + + fun + |> function.apply3(1, 2, 3) + |> should.equal(6) +} + +pub fn apply4_test() { + let fun = fn(x1, x2, x3, x4) { x1 + x2 + x3 + x4 } + + fun + |> function.apply4(1, 2, 3, 4) + |> should.equal(10) +} + +pub fn apply5_test() { + let fun = fn(x1, x2, x3, x4, x5) { x1 + x2 + x3 + x4 + x5 } + + fun + |> function.apply5(1, 2, 3, 4, 5) + |> should.equal(15) +} + +pub fn apply6_test() { + let fun = fn(x1, x2, x3, x4, x5, x6) { x1 + x2 + x3 + x4 + x5 + x6 } + + fun + |> function.apply6(1, 2, 3, 4, 5, 6) + |> should.equal(21) +} |