mirror of
https://github.com/valitydev/riak_test.git
synced 2024-11-06 08:35:22 +00:00
fbbacdd0b3
Allow intercept functions passed to rt_intercept:add/2 to be anonymous. In compiled code they can either be a plain anonymous function, assuming they don't use any variables from the surrounding context, or they can be a 2-tuple like this: {[FreeVar1, ...], fun(Arg1, ...) -> ... end} where FreeVar1 etc. is a list of free variables to be closed over so that they can be used within the anonymous function. For making interactive calls to rt_intercept:add/2 from the Erlang shell, only the anonymous function form is required, even if it uses free variables, though the 2-tuple form is also acceptable. For compiled code, support for anonymous intercept functions is implemented via a parse transform, and so to use anonymous functions the intercept structure(s) containing them must be defined directly inline as part of the final argument to rt_intercept:add/2, i.e., they cannot be first assigned to a variable that is then used within the argument. This is because the value of such a variable might not be visible to the parse transform. Add a description of anonymous function intercepts to the README.
29 lines
1.4 KiB
Erlang
29 lines
1.4 KiB
Erlang
{require_otp_vsn, "R13B04|R14|R15|R16"}.
|
|
{cover_enabled, true}.
|
|
{edoc_opts, [{preprocess, true}]}.
|
|
%%{edoc_opts, [{doclet, edown_doclet}, {pretty_printer, erl_pp}]}.
|
|
%%{edoc_opts, [{doclet, my_layout}, {pretty_printer, erl_pp}]}.
|
|
%%{edoc_opts, [{layout, my_layout}, {file_suffix, ".xml"}, {pretty_printer, erl_pp}]}.
|
|
{erl_opts, [{src_dirs, [src, intercepts]},
|
|
warnings_as_errors, {parse_transform, lager_transform}]}.
|
|
{erl_first_files, ["src/rt_intercept_pt.erl"]}.
|
|
|
|
{deps, [
|
|
{lager, ".*", {git, "git://github.com/basho/lager", {tag, "2.0.3"}}},
|
|
{getopt, ".*", {git, "git://github.com/jcomellas/getopt", {tag, "v0.4"}}},
|
|
{meck, ".*", {git, "git://github.com/eproxus/meck"}},
|
|
{mapred_verify, ".*", {git, "git://github.com/basho/mapred_verify", {branch, "master"}}},
|
|
{riakc, ".*", {git, "git://github.com/basho/riak-erlang-client", {branch, "master"}}},
|
|
{riakhttpc, ".*", {git, "git://github.com/basho/riak-erlang-http-client", {branch, "master"}}},
|
|
{kvc, "1.3.0", {git, "https://github.com/etrepum/kvc", {tag, "v1.3.0"}}}
|
|
]}.
|
|
|
|
{escript_incl_apps, [goldrush, lager, getopt, riakhttpc, riakc, ibrowse, mochiweb, kvc]}.
|
|
{escript_emu_args, "%%! -escript main riak_test_escript +K true +P 10000 -env ERL_MAX_PORTS 10000\n"}.
|
|
{plugin_dir, "src"}.
|
|
{plugins, [rebar_riak_test_plugin]}.
|
|
{riak_test, [
|
|
{test_paths, ["tests"]},
|
|
{test_output, "ebin"}
|
|
]}.
|