From d24ad720347b72b745c9e3492e61e3f4d0829501 Mon Sep 17 00:00:00 2001 From: Ariel Otilibili Date: Thu, 18 Jul 2024 23:18:07 +0200 Subject: [PATCH] Moved `ec_git_vsn` tests into separate file --- src/ec_git_vsn.erl | 20 +++++++------------- test/ec_git_vsn_tests.erl | 13 +++++++++++++ 2 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 test/ec_git_vsn_tests.erl diff --git a/src/ec_git_vsn.erl b/src/ec_git_vsn.erl index d690d1a..e67d8e4 100644 --- a/src/ec_git_vsn.erl +++ b/src/ec_git_vsn.erl @@ -17,6 +17,13 @@ -export([new/0, vsn/1]). +-ifdef(TEST). +-export([parse_tags/1, + get_patch_count/1, + collect_default_refcount/1 + ]). +-endif. + -export_type([t/0]). %%%=================================================================== @@ -98,16 +105,3 @@ parse_tags(Pattern) -> Vsn1 = string:trim(string:trim(Vsn, leading, "v"), trailing, "\n"), {Tag, Vsn1} end. - --ifdef(TEST). --include_lib("eunit/include/eunit.hrl"). - -parse_tags_test() -> - ?assertEqual({undefined, ""}, parse_tags("a.b.c")). - -get_patch_count_test() -> - ?assertEqual(0, get_patch_count("a.b.c")). - -collect_default_refcount_test() -> - ?assertMatch({"", _, _}, collect_default_refcount("a.b.c")). --endif. diff --git a/test/ec_git_vsn_tests.erl b/test/ec_git_vsn_tests.erl new file mode 100644 index 0000000..0d2efe1 --- /dev/null +++ b/test/ec_git_vsn_tests.erl @@ -0,0 +1,13 @@ +%%% @copyright 2024 Erlware, LLC. +-module(ec_git_vsn_tests). + +-include_lib("eunit/include/eunit.hrl"). + +parse_tags_test() -> + ?assertEqual({undefined, ""}, ec_git_vsn:parse_tags("a.b.c")). + +get_patch_count_test() -> + ?assertEqual(0, ec_git_vsn:get_patch_count("a.b.c")). + +collect_default_refcount_test() -> + ?assertMatch({"", _, _}, ec_git_vsn:collect_default_refcount("a.b.c")).