Permalink
Browse files

added automatic detection of module names based on filename

  • Loading branch information...
1 parent 00a3652 commit 0e427859da1db52fc7905abe047d45eaa3021c62 @andrzejsliwa committed Jul 13, 2011
Showing with 8 additions and 8 deletions.
  1. +5 −5 Snippets/Eunit Module.tmSnippet
  2. +3 −3 Snippets/Module.tmSnippet
@@ -7,20 +7,20 @@
%%
%% @author ${TM_AUTHOR} <${TM_AUTHOR_EMAIL}>
%% @copyright ${TM_YEAR} ${TM_AUTHOR}
-%% @doc EUnit test suite module ${1:name}.
+%% @doc EUnit test suite module ${TM_FILEPATH/^.*\/(.*)\_test.erl$/$1/g}.
%% @end
--module(${1:${TM_FILEPATH/^.*\/(.*)\.erl$/$1/g}}).
+-module(${TM_FILEPATH/^.*\/(.*)\.erl$/$1/g}).
-author('${TM_AUTHOR} <${TM_AUTHOR_EMAIL}>').
-define(NOTEST, true).
-define(NOASSERT, true).
-include_lib("eunit/include/eunit.hrl").
--define(MODNAME, ${1:name}).
+-define(MODNAME, ${1:${TM_FILEPATH/^.*\/(.*)\_test.erl$/$1/g}}).
%%%.
%%%' TEST GENERATOR
--spec ${1:name}_test_() -> [term()].
-${1:name}_test_() ->
+-spec ${TM_FILEPATH/^.*\/(.*)\_test.erl$/$1/g}_test_() -> [term()].
+${TM_FILEPATH/^.*\/(.*)\_test.erl$/$1/g}_test_() ->
%% add your asserts in the returned list, e.g.:
%% [
%% ?assert(?MODNAME:double(2) =:= 4),
@@ -7,14 +7,14 @@
%%
%% @author ${TM_AUTHOR} <${TM_AUTHOR_EMAIL}>
%% @copyright ${TM_YEAR} ${TM_AUTHOR}
-%% @doc ${1:description} ${2:${TM_FILEPATH/^.*\/(.*)\.erl$/$1/g}}.
+%% @doc ${1:description} ${TM_FILEPATH/^.*\/(.*)\.erl$/$1/g}.
%% @end
--module(${2:${TM_FILEPATH/^.*\/(.*)\.erl$/$1/g}}).
+-module(${TM_FILEPATH/^.*\/(.*)\.erl$/$1/g}).
-export([]).
%%%.
%%%' PUBLIC API
-${3:...}
+${2:...}
%%%.
%%%' PRIVATE FUNCTIONS

0 comments on commit 0e42785

Please sign in to comment.