Skip to content

Commit 0365dd2

Browse files
authored
Test with rebar3 (#234)
* Add proper exports instead of export_all * Silence a deliberate export_all directive * Add export_type declarations * Enable testing with rebar3 * Enable some nowarn_* options when compiling the tests * Remove a broken test PR #184, along with various improvements and very good tests, also introduced a test that does not make much sense: containing a ?SUCHTHAT as the third argument of a ?LET macro. This commit removes that test. See also the comment and discussion at: 6540152#commitcomment-35664733 * Eliminate clause cannot match warnings from proper_tests * So Long, patched rebar (and Thanks for All the Fish) * Remove obsolete entries from .gitignore * Fix code coverage measurements on Travis
1 parent 11b936e commit 0365dd2

File tree

13 files changed

+87
-241
lines changed

13 files changed

+87
-241
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,4 @@ doc/edoc-info
1111
rebar3
1212
rebar.lock
1313
ebin
14-
.eunit/
15-
.rebar/
1614
_build/

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
before_script:
2121
- >
2222
printf "\n{cover_enabled, true}.\n{cover_export_enabled, true}.
23-
\n{cover_skip_modules, [
23+
\n{cover_excl_mods, [
2424
proper_array,
2525
proper_dict,
2626
proper_gb_sets,
@@ -36,8 +36,8 @@ jobs:
3636
after_success:
3737
- git clone https://github.com/covertool/covertool.git
3838
- cd covertool && make compile && cd ..
39-
- find .eunit/ -name *.coverdata -exec ./covertool/covertool -cover {} -output {}.coverage.xml \;
40-
- mv .eunit/*.xml .
39+
- find _build/test/cover/ -name *.coverdata -exec ./covertool/covertool -cover {} -output {}.coverage.xml \;
40+
- mv _build/test/cover/*.xml .
4141
- rm -rf covertool/
4242
- bash <(curl -s https://codecov.io/bash)
4343

Makefile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2010-2019 Manolis Papadakis <manopapad@gmail.com>,
1+
# Copyright 2010-2020 Manolis Papadakis <manopapad@gmail.com>,
22
# Eirini Arvaniti <eirinibob@gmail.com>
33
# and Kostis Sagonas <kostis@cs.ntua.gr>
44
#
@@ -28,8 +28,6 @@ else
2828
SEP := $(strip /)
2929
endif
3030

31-
PROPER_REBAR := .$(SEP)rebar
32-
3331
REBAR3_URL := https://s3.amazonaws.com/rebar3/rebar3
3432
REBAR3 ?= $(shell which rebar3 || which .$(SEP)rebar3 || \
3533
(wget $(REBAR3_URL) && chmod +x rebar3 && echo .$(SEP)rebar3))
@@ -44,7 +42,7 @@ compile:
4442
ln -s _build/default/lib/proper/ebin .
4543

4644
dialyzer: .plt/proper_plt compile
47-
dialyzer -n -nn --plt $< -Wunmatched_returns ebin
45+
dialyzer -n -nn --plt $< -Wunmatched_returns -Wunknown ebin
4846

4947
.plt/proper_plt: .plt
5048
dialyzer --build_plt --output_plt $@ --apps erts kernel stdlib compiler crypto syntax_tools eunit
@@ -53,7 +51,7 @@ check_escripts:
5351
./scripts/check_escripts.sh make_doc
5452

5553
test:
56-
$(PROPER_REBAR) eunit
54+
$(REBAR3) eunit
5755

5856
doc: compile
5957
./scripts/make_doc
@@ -63,12 +61,11 @@ clean:
6361

6462
distclean: clean
6563
$(REBAR3) clean
66-
$(RM) -r .eunit .rebar
6764
$(RM) .plt/proper_plt
6865
$(RM) -r _build ebin rebar3 rebar.lock
6966

7067
rebuild: distclean compile
7168

7269
retest:
73-
$(RM) -r .eunit
74-
$(PROPER_REBAR) eunit
70+
$(RM) -r _build/test/lib/proper/test
71+
$(REBAR3) eunit

rebar

-204 KB
Binary file not shown.

rebar.b6d3094.patch

Lines changed: 0 additions & 183 deletions
This file was deleted.

rebar.config

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,26 @@
2424
%%% Author(s): Manolis Papadakis, Kostis Sagonas
2525
%%% Description: Options for rebar/rebar3
2626

27-
%% WARNING: Our version of rebar does NOT automatically report warnings,
28-
%% nor does it add erl_opts to eunit_compile_opts.
29-
3027
{minimum_otp_vsn, "19.0"}.
3128

3229
{erl_first_files, ["src/vararg.erl"]}.
30+
3331
{eunit_first_files, ["src/vararg.erl",
3432
"src/proper_transformer.erl",
3533
"src/proper_prop_remover.erl",
3634
"src/proper_typeserver.erl"]}.
35+
3736
{erl_opts, [debug_info,
38-
report_warnings, {warn_format,1}, warn_export_vars,
37+
report_warnings, {warn_format,1},
38+
warn_export_vars, warn_unused_vars,
3939
warn_obsolete_guard, warn_unused_import,
4040
warn_missing_spec, warn_untyped_record,
4141
{platform_define, "^2", 'AT_LEAST_20'}]}.
4242

43+
{profiles, [{test, [{erl_opts, [nowarn_untyped_record,
44+
nowarn_missing_spec]}]}]}.
45+
4346
{post_hooks, [{clean, "./scripts/clean_doc.sh"}]}.
4447

45-
{dialyzer, [{warnings, [unmatched_returns]},
46-
{plt_extra_apps, [erts, kernel, stdlib, compiler, crypto, syntax_tools]}]}.
48+
{dialyzer, [{warnings, [unmatched_returns, unknown]},
49+
{plt_extra_apps, [erts, kernel, stdlib, compiler, crypto, syntax_tools, eunit]}]}.

test/error_statem.erl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%%% -*- coding: utf-8 -*-
22
%%% -*- erlang-indent-level: 2 -*-
33
%%% -------------------------------------------------------------------
4-
%%% Copyright 2010-2019 Manolis Papadakis <manopapad@gmail.com>,
4+
%%% Copyright 2010-2020 Manolis Papadakis <manopapad@gmail.com>,
55
%%% Eirini Arvaniti <eirinibob@gmail.com>
66
%%% and Kostis Sagonas <kostis@cs.ntua.gr>
77
%%%
@@ -20,12 +20,13 @@
2020
%%% You should have received a copy of the GNU General Public License
2121
%%% along with PropEr. If not, see <http://www.gnu.org/licenses/>.
2222

23-
%%% @copyright 2010-2019 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas
23+
%%% @copyright 2010-2020 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas
2424
%%% @version {@version}
2525
%%% @author Eirini Arvaniti
2626

2727
-module(error_statem).
28-
-compile(export_all).
28+
-export([command/1, initial_state/0, next_state/3,
29+
precondition/2, postcondition/3, foo/1, bar/0]).
2930

3031
-include_lib("proper/include/proper.hrl").
3132

test/nogen_statem.erl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%%% -*- coding: utf-8 -*-
22
%%% -*- erlang-indent-level: 2 -*-
33
%%% -------------------------------------------------------------------
4-
%%% Copyright 2010-2011 Manolis Papadakis <manopapad@gmail.com>,
4+
%%% Copyright 2010-2020 Manolis Papadakis <manopapad@gmail.com>,
55
%%% Eirini Arvaniti <eirinibob@gmail.com>
66
%%% and Kostis Sagonas <kostis@cs.ntua.gr>
77
%%%
@@ -20,12 +20,13 @@
2020
%%% You should have received a copy of the GNU General Public License
2121
%%% along with PropEr. If not, see <http://www.gnu.org/licenses/>.
2222

23-
%%% @copyright 2010-2011 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas
23+
%%% @copyright 2010-2020 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas
2424
%%% @version {@version}
2525
%%% @author Eirini Arvaniti
2626

2727
-module(nogen_statem).
28-
-compile(export_all).
28+
-export([command/1, initial_state/0, next_state/3,
29+
precondition/2, postcondition/3, foo/1, bar/0]).
2930

3031
-include_lib("proper/include/proper.hrl").
3132

test/numbers_fsm.erl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%%% -*- coding: utf-8 -*-
22
%%% -*- erlang-indent-level: 2 -*-
33
%%% -------------------------------------------------------------------
4-
%%% Copyright 2010-2011 Manolis Papadakis <manopapad@gmail.com>,
4+
%%% Copyright 2010-2020 Manolis Papadakis <manopapad@gmail.com>,
55
%%% Eirini Arvaniti <eirinibob@gmail.com>
66
%%% and Kostis Sagonas <kostis@cs.ntua.gr>
77
%%%
@@ -20,13 +20,17 @@
2020
%%% You should have received a copy of the GNU General Public License
2121
%%% along with PropEr. If not, see <http://www.gnu.org/licenses/>.
2222

23-
%%% @copyright 2010-2011 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas
23+
%%% @copyright 2010-2020 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas
2424
%%% @version {@version}
2525
%%% @author Eirini Arvaniti
2626
%%% @doc Tests for fsm transition targets
2727

2828
-module(numbers_fsm).
29-
-compile(export_all).
29+
30+
-export([zero/1, one/1, two/1, three/1, four/1, num/4]).
31+
-export([idle/0, inc/0, dec/0, insert/1, delete/1]).
32+
-export([initial_state/0, initial_state_data/0, precondition/4,
33+
postcondition/5, weight/3, next_state_data/5]).
3034

3135
-include_lib("proper/include/proper.hrl").
3236

@@ -35,7 +39,7 @@
3539
-define(LOOKUP, [{zero,0}, {one,1}, {two,2}, {three,3}, {four,4}]).
3640

3741

38-
%%% Fsm callbacks
42+
%%% FSM callbacks
3943

4044
zero(S) ->
4145
idle_transition() ++
@@ -131,8 +135,8 @@ mod(0, _Y) -> 0.
131135
mod_add(X, Y) -> mod(X+Y, 5).
132136
mod_sub(X, Y) -> mod(X-Y, 5).
133137

134-
inc() -> ok.
135138
idle() -> ok.
139+
inc() -> ok.
136140
dec() -> ok.
137141
insert(_) -> ok.
138142
delete(_) -> ok.

0 commit comments

Comments
 (0)