Current section
Files
Jump to
Current section
Files
gen/test/path_test.erl
-module(path_test).
-compile(no_auto_import).
-export([basename_test/0, extension_test/0, split_test/0, join_test/0, integration_test/0]).
basename_test() ->
gleam@should:equal(gleam@path:basename(<<"foo"/utf8>>), <<"foo"/utf8>>),
gleam@should:equal(gleam@path:basename(<<"/usr/foo"/utf8>>), <<"foo"/utf8>>),
gleam@should:equal(gleam@path:basename(<<"/"/utf8>>), <<""/utf8>>).
extension_test() ->
gleam@should:equal(
gleam@path:extension(<<"foo.gleam"/utf8>>),
<<".gleam"/utf8>>
),
gleam@should:equal(
gleam@path:extension(<<"beam.src/kalle"/utf8>>),
<<""/utf8>>
).
split_test() ->
gleam@should:equal(
gleam@path:split(<<"foo/bar/baz"/utf8>>),
[<<"foo"/utf8>>, <<"bar"/utf8>>, <<"baz"/utf8>>]
),
gleam@should:equal(
gleam@path:split(<<"/foo/bar/baz"/utf8>>),
[<<"/"/utf8>>, <<"foo"/utf8>>, <<"bar"/utf8>>, <<"baz"/utf8>>]
).
join_test() ->
gleam@should:equal(
gleam@path:join([<<"foo"/utf8>>, <<"bar"/utf8>>, <<"baz"/utf8>>]),
<<"foo/bar/baz"/utf8>>
),
gleam@should:equal(
gleam@path:join([<<"/foo"/utf8>>, <<"bar"/utf8>>, <<"baz"/utf8>>]),
<<"/foo/bar/baz"/utf8>>
).
integration_test() ->
gleam@should:equal(
gleam@result:map(gleam@file:user_home(), fun gleam@path:kind/1),
{ok, absolute}
).