-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use eqc(mini) if it's defined, fetching proper otherwise
- Loading branch information
Tim Watson
committed
Nov 16, 2012
1 parent
a45de8a
commit 4e8d990
Showing
6 changed files
with
105 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ test/logs/ | |
ebin/*.beam | ||
logs/* | ||
include/hamcrest.hrl | ||
qc.hrl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
|
||
all: clean build test | ||
.PHONY: clean build test | ||
|
||
all: clean test | ||
|
||
clean: | ||
@(./rebar clean) | ||
|
||
build: | ||
@(./rebar get-deps compile) | ||
|
||
test: | ||
@(./rebar skip_deps=true ct) | ||
@(./rebar compile xref) | ||
|
||
.PHONY: deps test clean build | ||
test: build | ||
@(./rebar -C test.config get-deps compile) | ||
@(./rebar -C test.config skip_deps=true ct) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
%% ----------------------------------------------------------------------------- | ||
%% | ||
%% Hamcrest Erlang. | ||
%% | ||
%% Copyright (c) 2010 Tim Watson (watson.timothy@gmail.com) | ||
%% | ||
%% Permission is hereby granted, free of charge, to any person obtaining a copy | ||
%% of this software and associated documentation files (the "Software"), to deal | ||
%% in the Software without restriction, including without limitation the rights | ||
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
%% copies of the Software, and to permit persons to whom the Software is | ||
%% furnished to do so, subject to the following conditions: | ||
%% | ||
%% The above copyright notice and this permission notice shall be included in | ||
%% all copies or substantial portions of the Software. | ||
%% | ||
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
%% THE SOFTWARE. | ||
%% ----------------------------------------------------------------------------- | ||
%% @author Tim Watson <watson.timothy@gmail.com> | ||
%% @copyright 2010 Tim Watson. | ||
%% | ||
%% Generates hamcrest.hrl header file during build process. Loaded by rebar. | ||
%% ----------------------------------------------------------------------------- | ||
-module(eqc_resolver). | ||
|
||
-export([preprocess/2]). | ||
|
||
preprocess(Config, _) -> | ||
case rebar_utils:processing_base_dir(Config) of | ||
false -> {ok, []}; | ||
true -> case code:lib_dir(eqc, include) of | ||
{error, bad_name} -> | ||
write_include("proper"), | ||
{ok, []}; | ||
_ -> | ||
write_include("eqc"), | ||
Deps = rebar_config:get_local(Config, deps, []), | ||
DepsNoPropEr = proplists:delete(proper, Deps), | ||
Config2 = rebar_config:set(Config, deps, DepsNoPropEr), | ||
{ok, Config2, []} | ||
end | ||
end. | ||
|
||
write_include(Lib) -> | ||
file:write_file(filename:join(test_dir(), "qc.hrl"), | ||
include(Lib)). | ||
|
||
test_dir() -> | ||
filename:join(rebar_utils:get_cwd(), "test"). | ||
|
||
include(Lib) -> | ||
[<<"-include_lib(\"">>, | ||
Lib, <<"/include/">>, | ||
Lib, <<".hrl\").\n">>, | ||
<<"-define(">>, Lib, <<", true).">>]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,26 @@ | ||
|
||
{lib_dirs, ["deps"]}. | ||
{erl_opts, [debug_info, fail_on_warning]}. | ||
{cover_enabled, true}. | ||
{clean_files, ["logs", "build", "include/hamcrest.hrl"]}. | ||
{deps, [ | ||
{proper, "1.0", {git, "http://github.com/manopapad/proper.git", "master"}} | ||
]}. | ||
|
||
%{pre_hooks, [ | ||
% {compile, "sh priv/build/scripts/bootstrap-deps.sh"} | ||
%]}. | ||
|
||
{plugin_dir, "priv/build/plugins"}. | ||
{plugins, [header_generator]}. | ||
{plugins, [header_generator, eqc_resolver]}. | ||
|
||
{xref_checks, []}. | ||
{xref_queries, | ||
[{"((XC - UC) || (XU - X - B))",[]}, %% calls to undefined functions | ||
{"(L - LU)", []}, %% local unused | ||
{"(LU * (X - XU))", [ %% exported functions only used locally | ||
{hamcrest,assert_that,2}, %% NB: we're a library so this is expected... | ||
{hamcrest,assert_that,3}, | ||
{hamcrest,check,2}, | ||
{hamcrest,describe,2}, | ||
{hamcrest,heckle,2}, | ||
{hamcrest,match,3}, | ||
{hamcrest_matchers,check_member,2}, %% called via apply/3 | ||
{hamcrest_matchers,equal_to,1}, | ||
{hamcrest_matchers,foreach,1}, | ||
{hamcrest_matchers,is_not,1}, | ||
{hamcrest_matchers,match_mfa,3}, | ||
{hamcrest_matchers,reverse_match_mfa,3}]}, | ||
{"(DF * (XU + LU))", []}]}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
{cover_enabled, true}. | ||
{deps, [ | ||
%% TODO: bind to a specific commit or tag instead of 'master' | ||
{proper, "1.0", {git, "http://github.com/manopapad/proper.git", "master"}} | ||
]}. | ||
|
||
{plugin_dir, "priv/build/plugins"}. | ||
{plugins, [eqc_resolver]}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters