aboutsummaryrefslogtreecommitdiff
path: root/gen/test/atom_test.erl
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2019-04-14 13:03:24 +0000
committerLouis Pilfold <louis@lpil.uk>2019-04-14 13:03:32 +0000
commit8cfa606f3834cf7d05f5011bc68295a9d84263dc (patch)
treefa7edc8ea53426b072f35d3d61e0ab821c8d5feb /gen/test/atom_test.erl
parentae5597c1b27982aabe74eb16d5b0c890802730d9 (diff)
downloadgleam_stdlib-8cfa606f3834cf7d05f5011bc68295a9d84263dc.tar.gz
gleam_stdlib-8cfa606f3834cf7d05f5011bc68295a9d84263dc.zip
stdlib: Split out tests
Diffstat (limited to 'gen/test/atom_test.erl')
-rw-r--r--gen/test/atom_test.erl23
1 files changed, 23 insertions, 0 deletions
diff --git a/gen/test/atom_test.erl b/gen/test/atom_test.erl
new file mode 100644
index 0000000..ae9f76b
--- /dev/null
+++ b/gen/test/atom_test.erl
@@ -0,0 +1,23 @@
+-module(atom_test).
+-compile(no_auto_import).
+
+-export([from_string_test/0, create_from_string_test/0, to_string_test/0]).
+
+from_string_test() ->
+ expect:is_ok(atom:from_string(<<"ok">>)),
+ expect:is_ok(atom:from_string(<<"expect">>)),
+ expect:is_error(atom:from_string(<<"this is not an atom we have seen before">>)).
+
+create_from_string_test() ->
+ expect:equal({ok, atom:create_from_string(<<"ok">>)},
+ atom:from_string(<<"ok">>)),
+ expect:equal({ok, atom:create_from_string(<<"expect">>)},
+ atom:from_string(<<"expect">>)),
+ expect:equal({ok,
+ atom:create_from_string(<<"this is another atom we have not seen before">>)},
+ atom:from_string(<<"this is another atom we have not seen before">>)).
+
+to_string_test() ->
+ expect:equal(atom:to_string(atom:create_from_string(<<"ok">>)), <<"ok">>),
+ expect:equal(atom:to_string(atom:create_from_string(<<"expect">>)),
+ <<"expect">>).