Skip to content
Permalink
Browse files
Migrate to Rebar 3
This change expects Meck to be built with Rebar 3 from now on. Due to it
not being compatible with Rebar 3, the optional dependency on Hamcrest
has been removed. Meck still supports matchers so it should still be
compatible, but it is no longer tested.
  • Loading branch information
eproxus committed Jun 28, 2017
1 parent 36b208e commit 0e6c040dcee99b39769828377c073c3b67a1794d
Show file tree
Hide file tree
Showing 12 changed files with 109 additions and 154 deletions.
@@ -1,23 +1,21 @@
.rebar3
_*
.eunit
*.o
*.beam
*.log
*.dump
*.coverdata
doc/*.html
doc/*.css
doc/*.png
doc/edoc-info
*.plt
*.swp
*.swo
.erlang.cookie
ebin
.eunit
.DS_Store
tags
.*.swp
.settings
.project
*.sublime-workspace
*.sublime-project
deps/*
log
erl_crash.dump
.rebar
.deps.plt

# Elixir/Hex.pm
logs
_build
.idea
rebar3.crashdump
doc/*.html
doc/edoc-info
doc/erlang.png
doc/stylesheet.css
@@ -1,14 +1,25 @@
language: erlang
notifications:
email:
- hello@alind.io

sudo: false
os: linux
otp_release:
- 20.0
- 19.3
- 18.3
- 17.5
- R16B03-1
- R15B03
before_script: "make get-deps"
script: "make test"

script: rebar3 eunit
install:
- wget https://s3.amazonaws.com/rebar3/rebar3 && chmod +x rebar3
script:
- ./rebar3 as prod compile
# - ./rebar3 as check xref
# - ./rebar3 as check dialyzer
- ./rebar3 eunit
- ./rebar3 edoc

notifications:
recipients:
- hello@alind.io

This file was deleted.

BIN -192 KB rebar
Binary file not shown.
@@ -1,16 +1,28 @@
%% Compiler Options ===========================================================
{erl_opts, [
%% Erlang releases after 17 don't put R in front of their name, and also require dict() to be written like dict:dict()
{platform_define, "^R", non_namespaced_types}, % used by meck
{platform_define, "^[0-9]+", namespaced_types}, % used by hamcrest
warn_export_all,
warn_export_vars,
warn_shadow_vars,
warn_obsolete_guard,
warn_unused_import,
warnings_as_errors,
debug_info
% Erlang releases after 17 don't put R in front of their name, and also
% require dict() to be written like dict:dict()
{platform_define, "^R", non_namespaced_types}, % used by meck
{platform_define, "^[0-9]+", namespaced_types} % used by hamcrest
]}.

%% Misc =======================================================================
{clean_files, [".eunit", "ebin/*.beam", "test/*.beam"]}.
{profiles, [
{test, [
{erl_opts, [
debug_info,
{platform_define, "^R(?!16B03)", cover_empty_compile_opts}
]},
{cover_enabled, true},
{cover_opts, [verbose]}
]},
{compile, [
{erl_opts, [
debug_info,
warnings_as_errors,
warn_export_all,
warn_export_vars,
warn_shadow_vars,
warn_obsolete_guard,
warn_unused_import
]}
]}
]}.
@@ -0,0 +1 @@
[].

This file was deleted.

@@ -44,7 +44,7 @@ from_empty_args_test() ->
?assertMatch(false, meck_args_matcher:match([1, 2, 3], ArgsMatcher)).

matcher_featured_test() ->
ArgsSpec = [meck:is(hamcrest_matchers:equal_to(1)),
ArgsSpec = [meck:is(fun(X) -> X == 1 end),
2,
meck:is(fun(X) -> X == 3 end),
{4, [5, '_'], <<"7">>}],
@@ -56,7 +56,7 @@ expect_wildcard_test() ->
expect_matchers_test() ->
%% Given
Is1003 = meck_matcher:new(fun(X) -> X == 1003 end),
LessThen1004 = meck_matcher:new(hamcrest_matchers:less_than(1004)),
LessThen1004 = meck_matcher:new(fun(X) -> X < 1004 end),
%% When
E = meck_expect:new(blah, [Is1003, LessThen1004], 2001),
%% Then
@@ -69,7 +69,7 @@ expect_matchers_test() ->
expect_with_matchers_multiclause_test() ->
%% Given
Is1003 = meck_matcher:new(fun(X) -> X == 1003 end),
LessThen1004 = meck_matcher:new(hamcrest_matchers:less_than(1004)),
LessThen1004 = meck_matcher:new(fun(X) -> X < 1004 end),
%% When
E = meck_expect:new(blah, [{['_', Is1003, 1004], 2001},
{['_', Is1003, LessThen1004], 2002},
@@ -90,7 +90,7 @@ expect_with_matchers_multiclause_test() ->
expect_with_matchers_masked_clause_test() ->
%% Given
Is1003 = meck_matcher:new(fun(X) -> X == 1003 end),
LessThen1004 = meck_matcher:new(hamcrest_matchers:less_than(1004)),
LessThen1004 = meck_matcher:new(fun(X) -> X < 1004 end),
%% When
E = meck_expect:new(blah, [{[Is1003, LessThen1004], 2001},
{[Is1003, Is1003], 2002}]),
@@ -78,7 +78,7 @@ capture_different_args_specs_test() ->
?assertMatch(2003, meck:capture(first, test, foo, 3, 2)),
?assertMatch(2005, meck:capture(first, test, foo, ['_', '_'], 2)),
?assertMatch(2006, meck:capture(first, test, foo, [1006, '_', '_'], 2)),
?assertMatch(2008, meck:capture(first, test, foo, ['_', '_', meck:is(hamcrest_matchers:greater_than(3006))], 2)),
?assertMatch(2008, meck:capture(first, test, foo, ['_', '_', meck:is(fun(X) -> X > 3006 end)], 2)),
%% Clean
meck:unload().

@@ -126,7 +126,7 @@ result_different_args_specs_test() ->
?assertMatch(2003, meck_history:result(first, '_', test, foo, 3)),
?assertMatch(2005, meck_history:result(first, '_', test, foo, ['_', '_'])),
?assertMatch(2006, meck_history:result(first, '_', test, foo, [1006, '_', '_'])),
Matcher = meck:is(hamcrest_matchers:greater_than(3006)),
Matcher = meck:is(fun(X) -> X > 3006 end),
?assertMatch(2008, meck_history:result(first, '_', test, foo, ['_', '_', Matcher])),
%% Clean
meck:unload().
@@ -28,7 +28,7 @@ match_predicate_not_bool_test() ->
?assertMatch(false, meck_matcher:match_ignore(1001, Matcher)).

match_hamcrest_test() ->
Matcher = meck_matcher:new(hamcrest_matchers:equal_to(1000)),
Matcher = meck_matcher:new(fun(X) -> X == 1000 end),
?assertMatch(true, meck_matcher:match_ignore(1000, Matcher)),
?assertMatch(false, meck_matcher:match_ignore(1001, Matcher)).

@@ -43,6 +43,4 @@ predicate_wrong_arity_test() ->
is_matcher_test() ->
?assertMatch(true, meck_matcher:is_matcher(meck_matcher:new(fun(X) -> X == 1000 end))),
?assertMatch(false, meck_matcher:is_matcher(fun(X) -> X == 1000 end)),
?assertMatch(true, meck_matcher:is_matcher(meck_matcher:new(hamcrest_matchers:equal_to(1000)))),
?assertMatch(false, meck_matcher:is_matcher(hamcrest_matchers:equal_to(1000))),
?assertMatch(false, meck_matcher:is_matcher(blah)).

0 comments on commit 0e6c040

Please sign in to comment.