mirror of
https://github.com/amix/vimrc
synced 2025-07-19 18:14:59 +08:00
merge
This commit is contained in:
@ -24,6 +24,10 @@ snippet incl
|
||||
# behavior directive
|
||||
snippet beh
|
||||
-behaviour(${1:behaviour}).
|
||||
snippet ifd
|
||||
-ifdef(${1:TEST}).
|
||||
${0}
|
||||
-endif.
|
||||
# if expression
|
||||
snippet if
|
||||
if
|
||||
@ -42,7 +46,7 @@ snippet fun
|
||||
# try...catch
|
||||
snippet try
|
||||
try
|
||||
${1}
|
||||
${1:${VISUAL}}
|
||||
catch
|
||||
${2:_:_} -> ${0:got_some_exception}
|
||||
end
|
||||
@ -103,8 +107,8 @@ snippet supervisor
|
||||
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
|
||||
|
||||
init([]) ->
|
||||
Server = {${0:my_server}, {$2, start_link, []},
|
||||
permanent, 2000, worker, [$2]},
|
||||
Server = {${0:my_server}, {${2}, start_link, []},
|
||||
permanent, 2000, worker, [${2}]},
|
||||
Children = [Server],
|
||||
RestartStrategy = {one_for_one, 0, 1},
|
||||
{ok, {RestartStrategy, Children}}.
|
||||
@ -478,26 +482,57 @@ snippet gen_event
|
||||
%%%===================================================================
|
||||
%%% Internal functions
|
||||
%%%===================================================================
|
||||
# EUnit snippets
|
||||
snippet eunit
|
||||
-module(${1:`vim_snippets#Filename('', 'my')`}).
|
||||
-include_lib("eunit/include/eunit.hrl").
|
||||
|
||||
${0}
|
||||
snippet ieunit
|
||||
-ifdef(TEST).
|
||||
-include_lib("eunit/include/eunit.hrl").
|
||||
|
||||
${0}
|
||||
|
||||
-endif.
|
||||
snippet as
|
||||
?assert(${0})
|
||||
snippet asn
|
||||
?assertNot(${0})
|
||||
snippet aseq
|
||||
?assertEqual(${1}, ${0})
|
||||
snippet asneq
|
||||
?assertNotEqual(${1}, ${0})
|
||||
snippet asmat
|
||||
?assertMatch(${1:Pattern}, ${0:Expression})
|
||||
snippet asnmat
|
||||
?assertNotMatch(${1:Pattern}, ${0:Expression})
|
||||
snippet aserr
|
||||
?assertError(${1:Pattern}, ${0:Expression})
|
||||
snippet asex
|
||||
?assertExit(${1:Pattern}, ${0:Expression})
|
||||
snippet asexc
|
||||
?assertException(${1:Class}, ${2:Pattern}, ${0:Expression})
|
||||
# common_test test_SUITE
|
||||
snippet testsuite
|
||||
-module(${0:`vim_snippets#Filename('', 'my')`}).
|
||||
|
||||
-include_lib("common_test/include/ct.hrl").
|
||||
|
||||
|
||||
%% Test server callbacks
|
||||
-export([suite/0, all/0, groups/0,
|
||||
init_per_suite/1, end_per_suite/1,
|
||||
init_per_group/2, end_per_group/2,
|
||||
init_per_testcase/2, end_per_testcase/2]).
|
||||
|
||||
|
||||
%% Test cases
|
||||
-export([
|
||||
]).
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% COMMON TEST CALLBACK FUNCTIONS
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: suite() -> Info
|
||||
%%
|
||||
@ -512,7 +547,7 @@ snippet testsuite
|
||||
%%--------------------------------------------------------------------
|
||||
suite() ->
|
||||
[{timetrap,{minutes,10}}].
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: init_per_suite(Config0) ->
|
||||
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
|
||||
@ -529,7 +564,7 @@ snippet testsuite
|
||||
%%--------------------------------------------------------------------
|
||||
init_per_suite(Config) ->
|
||||
Config.
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: end_per_suite(Config0) -> void() | {save_config,Config1}
|
||||
%%
|
||||
@ -540,7 +575,7 @@ snippet testsuite
|
||||
%%--------------------------------------------------------------------
|
||||
end_per_suite(_Config) ->
|
||||
ok.
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: init_per_group(GroupName, Config0) ->
|
||||
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
|
||||
@ -556,7 +591,7 @@ snippet testsuite
|
||||
%%--------------------------------------------------------------------
|
||||
init_per_group(_GroupName, Config) ->
|
||||
Config.
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: end_per_group(GroupName, Config0) ->
|
||||
%% void() | {save_config,Config1}
|
||||
@ -570,7 +605,7 @@ snippet testsuite
|
||||
%%--------------------------------------------------------------------
|
||||
end_per_group(_GroupName, _Config) ->
|
||||
ok.
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: init_per_testcase(TestCase, Config0) ->
|
||||
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
|
||||
@ -589,7 +624,7 @@ snippet testsuite
|
||||
%%--------------------------------------------------------------------
|
||||
init_per_testcase(_TestCase, Config) ->
|
||||
Config.
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: end_per_testcase(TestCase, Config0) ->
|
||||
%% void() | {save_config,Config1} | {fail,Reason}
|
||||
@ -605,7 +640,7 @@ snippet testsuite
|
||||
%%--------------------------------------------------------------------
|
||||
end_per_testcase(_TestCase, _Config) ->
|
||||
ok.
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: groups() -> [Group]
|
||||
%%
|
||||
@ -629,7 +664,7 @@ snippet testsuite
|
||||
%%--------------------------------------------------------------------
|
||||
groups() ->
|
||||
[].
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: all() -> GroupsAndTestCases | {skip,Reason}
|
||||
%%
|
||||
@ -644,14 +679,14 @@ snippet testsuite
|
||||
%% Description: Returns the list of groups and test cases that
|
||||
%% are to be executed.
|
||||
%%--------------------------------------------------------------------
|
||||
all() ->
|
||||
all() ->
|
||||
[].
|
||||
|
||||
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% TEST CASES
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: TestCase(Config0) ->
|
||||
%% ok | exit() | {skip,Reason} | {comment,Comment} |
|
||||
|
Reference in New Issue
Block a user