Skip to content

Commit 6ed0011

Browse files
committed
Merge pull request #102 from matthiaskr/matthiaskr/bugfix/non-proper-lists
try to fix non-proper lists in state
2 parents c16e6d1 + 5d02e92 commit 6ed0011

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

src/proper_statem.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,8 @@ arg_defined({var,I} = V, SymbEnv) when is_integer(I) ->
769769
lists:member(V, SymbEnv);
770770
arg_defined(Tuple, SymbEnv) when is_tuple(Tuple) ->
771771
args_defined(tuple_to_list(Tuple), SymbEnv);
772-
arg_defined(List, SymbEnv) when is_list(List) ->
773-
args_defined(List, SymbEnv);
772+
arg_defined([Head|Tail], SymbEnv) ->
773+
arg_defined(Head, SymbEnv) andalso arg_defined(Tail, SymbEnv);
774774
arg_defined(_, _) ->
775775
true.
776776

test/lists_statem.erl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
-module(lists_statem).
2+
-compile(export_all).
3+
4+
-include_lib("proper/include/proper.hrl").
5+
6+
initial_state() ->
7+
state.
8+
9+
command(_State) ->
10+
return({call, ?MODULE, foo, [[a|b]]}).
11+
12+
precondition(_, _) ->
13+
true.
14+
15+
next_state(State, _, _) ->
16+
State.
17+
18+
postcondition(_, _, _) ->
19+
true.
20+
21+
foo(_Something) ->
22+
ok.
23+
24+
prop_simple() ->
25+
?FORALL(Cmds, commands(?MODULE),
26+
begin
27+
{_H,_S,Res} = run_commands(?MODULE, Cmds),
28+
equals(Res, ok)
29+
end).

test/proper_tests.erl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,8 @@ true_props_test_() ->
890890
{timeout, 20, ?_passes(symb_statem:prop_parallel_simple())},
891891
{timeout, 10, ?_passes(ets_statem:prop_ets())},
892892
{timeout, 20, ?_passes(ets_statem:prop_parallel_ets())},
893-
{timeout, 20, ?_passes(pdict_fsm:prop_pdict())}].
893+
{timeout, 20, ?_passes(pdict_fsm:prop_pdict())},
894+
?_passes(lists_statem:prop_simple())].
894895

895896
false_props_test_() ->
896897
[?_failsWith([[_Same,_Same]],

0 commit comments

Comments
 (0)