From d6b4780c9f215c197bc119f775cd1a7ee2362dc7 Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Sun, 5 Sep 2021 21:00:59 +0100 Subject: Remove should module --- src/gleam/should.gleam | 85 ------------------------------------------------- test/gleam/should.gleam | 85 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 85 deletions(-) delete mode 100644 src/gleam/should.gleam create mode 100644 test/gleam/should.gleam diff --git a/src/gleam/should.gleam b/src/gleam/should.gleam deleted file mode 100644 index 044190f..0000000 --- a/src/gleam/should.gleam +++ /dev/null @@ -1,85 +0,0 @@ -//// A module for testing your Gleam code. The functions found here are -//// compatible with the Erlang eunit test framework. -//// -//// More information on running eunit can be found in [the rebar3 -//// documentation](https://rebar3.org/docs/testing/eunit/). - -if erlang { - // TODO: Move this module into another package so it can be used as a - // dep only in test. - pub external fn equal(a, a) -> Nil = - "gleam_stdlib" "should_equal" - - pub external fn not_equal(a, a) -> Nil = - "gleam_stdlib" "should_not_equal" - - pub external fn be_ok(Result(a, b)) -> Nil = - "gleam_stdlib" "should_be_ok" - - pub external fn be_error(Result(a, b)) -> Nil = - "gleam_stdlib" "should_be_error" -} - -if javascript { - import gleam/string - - external fn stringify(anything) -> String = - "../gleam.js" "inspect" - - external fn crash(String) -> anything = - "../gleam_stdlib.js" "crash" - - pub fn equal(a, b) { - case a == b { - True -> Nil - _ -> - crash(string.concat([ - "\n\t", - stringify(a), - "\n\tshould equal \n\t", - stringify(b), - ])) - } - } - - pub fn not_equal(a, b) { - case a != b { - True -> Nil - _ -> - crash(string.concat([ - "\n", - stringify(a), - "\nshould not equal \n", - stringify(b), - ])) - } - } - - pub fn be_ok(a) { - case a { - Ok(_) -> Nil - _ -> crash(string.concat(["\n", stringify(a), "\nshould be ok"])) - } - } - - pub fn be_error(a) { - case a { - Error(_) -> Nil - _ -> crash(string.concat(["\n", stringify(a), "\nshould be error"])) - } - } -} - -pub fn be_true(actual: Bool) -> Nil { - actual - |> equal(True) -} - -pub fn be_false(actual: Bool) -> Nil { - actual - |> equal(False) -} - -pub fn fail() -> Nil { - be_true(False) -} diff --git a/test/gleam/should.gleam b/test/gleam/should.gleam new file mode 100644 index 0000000..044190f --- /dev/null +++ b/test/gleam/should.gleam @@ -0,0 +1,85 @@ +//// A module for testing your Gleam code. The functions found here are +//// compatible with the Erlang eunit test framework. +//// +//// More information on running eunit can be found in [the rebar3 +//// documentation](https://rebar3.org/docs/testing/eunit/). + +if erlang { + // TODO: Move this module into another package so it can be used as a + // dep only in test. + pub external fn equal(a, a) -> Nil = + "gleam_stdlib" "should_equal" + + pub external fn not_equal(a, a) -> Nil = + "gleam_stdlib" "should_not_equal" + + pub external fn be_ok(Result(a, b)) -> Nil = + "gleam_stdlib" "should_be_ok" + + pub external fn be_error(Result(a, b)) -> Nil = + "gleam_stdlib" "should_be_error" +} + +if javascript { + import gleam/string + + external fn stringify(anything) -> String = + "../gleam.js" "inspect" + + external fn crash(String) -> anything = + "../gleam_stdlib.js" "crash" + + pub fn equal(a, b) { + case a == b { + True -> Nil + _ -> + crash(string.concat([ + "\n\t", + stringify(a), + "\n\tshould equal \n\t", + stringify(b), + ])) + } + } + + pub fn not_equal(a, b) { + case a != b { + True -> Nil + _ -> + crash(string.concat([ + "\n", + stringify(a), + "\nshould not equal \n", + stringify(b), + ])) + } + } + + pub fn be_ok(a) { + case a { + Ok(_) -> Nil + _ -> crash(string.concat(["\n", stringify(a), "\nshould be ok"])) + } + } + + pub fn be_error(a) { + case a { + Error(_) -> Nil + _ -> crash(string.concat(["\n", stringify(a), "\nshould be error"])) + } + } +} + +pub fn be_true(actual: Bool) -> Nil { + actual + |> equal(True) +} + +pub fn be_false(actual: Bool) -> Nil { + actual + |> equal(False) +} + +pub fn fail() -> Nil { + be_true(False) +} -- cgit v1.2.3