diff options
author | Louis Pilfold <louis@lpil.uk> | 2019-04-14 13:03:24 +0000 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2019-04-14 13:03:32 +0000 |
commit | 8cfa606f3834cf7d05f5011bc68295a9d84263dc (patch) | |
tree | fa7edc8ea53426b072f35d3d61e0ab821c8d5feb /src/tuple.gleam | |
parent | ae5597c1b27982aabe74eb16d5b0c890802730d9 (diff) | |
download | gleam_stdlib-8cfa606f3834cf7d05f5011bc68295a9d84263dc.tar.gz gleam_stdlib-8cfa606f3834cf7d05f5011bc68295a9d84263dc.zip |
stdlib: Split out tests
Diffstat (limited to 'src/tuple.gleam')
-rw-r--r-- | src/tuple.gleam | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/tuple.gleam b/src/tuple.gleam index 418c5bc..41902db 100644 --- a/src/tuple.gleam +++ b/src/tuple.gleam @@ -1,52 +1,24 @@ -import expect -import result import list pub fn new(a, b) { {a, b} } -test new { - new(1, 2) - |> expect:equal(_, {1, 2}) - - new(2, "3") - |> expect:equal(_, {2, "3"}) -} - pub fn first(tup) { let {a, _} = tup a } -test first { - {1, 2} - |> first - |> expect:equal(_, 1) -} - pub fn second(tup) { let {_, a} = tup a } -test second { - {1, 2} - |> second - |> expect:equal(_, 2) -} - pub fn swap(tup) { let {a, b} = tup {b, a} } -test swap { - {1, "2"} - |> swap - |> expect:equal(_, {"2", 1}) -} - pub fn fetch(haystack, needle) { list:find(haystack, fn(tuple) { case first(tuple) == needle { @@ -55,19 +27,3 @@ pub fn fetch(haystack, needle) { } }) } - -test fetch { - let proplist = [{0, "1"}, {1, "2"}] - - proplist - |> fetch(_, 0) - |> expect:equal(_, Ok("1")) - - proplist - |> fetch(_, 1) - |> expect:equal(_, Ok("2")) - - proplist - |> fetch(_, 2) - |> expect:is_error -} |