From 5a1f3494eb9517a7b7a332cb74dd10a6a7d32d31 Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Wed, 29 May 2019 21:02:55 +0100 Subject: Enable namespaced modules --- test/std/atom_test.gleam | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 test/std/atom_test.gleam (limited to 'test/std/atom_test.gleam') diff --git a/test/std/atom_test.gleam b/test/std/atom_test.gleam new file mode 100644 index 0000000..54e88da --- /dev/null +++ b/test/std/atom_test.gleam @@ -0,0 +1,46 @@ +import std/atom +import std/expect + +pub fn from_string_test() { + "ok" + |> atom:from_string + |> expect:is_ok + + "expect" + |> atom:from_string + |> expect:is_ok + + "this is not an atom we have seen before" + |> atom:from_string + // |> expect:equal(_, Error(AtomNotLoaded)) + |> expect:is_error +} + +pub fn create_from_string_test() { + "ok" + |> atom:create_from_string + |> Ok + |> expect:equal(_, atom:from_string("ok")) + + "expect" + |> atom:create_from_string + |> Ok + |> expect:equal(_, atom:from_string("expect")) + + "this is another atom we have not seen before" + |> atom:create_from_string + |> Ok + |> expect:equal(_, atom:from_string("this is another atom we have not seen before")) +} + +pub fn to_string_test() { + "ok" + |> atom:create_from_string + |> atom:to_string + |> expect:equal(_, "ok") + + "expect" + |> atom:create_from_string + |> atom:to_string + |> expect:equal(_, "expect") +} -- cgit v1.2.3