Skip to content

Commit

Permalink
Simplify test cases, make them as realistic as possible
Browse files Browse the repository at this point in the history
  • Loading branch information
belltoy committed Aug 19, 2024
1 parent 0cdccb6 commit f7d4119
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 142 deletions.
17 changes: 1 addition & 16 deletions test/examples/fail_state_record_and_type.erl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
-export([
init/1,
handle_call/3,
handle_cast/2,
handle_info/2,
code_change/3,
terminate/2
handle_cast/2
]).

-spec init(term()) -> ok.
Expand All @@ -24,15 +21,3 @@ handle_call(_Request, _From, _State) ->
-spec handle_cast(term(), term()) -> ok.
handle_cast(_Request, _State) ->
ok.

-spec handle_info(term(), term()) -> ok.
handle_info(_Info, _State) ->
ok.

-spec code_change(term(), term(), term()) -> term().
code_change(_OldVsn, State, _Extra) ->
{ok, State}.

-spec terminate(term(), term()) -> ok.
terminate(_Reason, _State) ->
ok.
17 changes: 1 addition & 16 deletions test/examples/fail_state_record_and_type_behaviour.erl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
-export([
init/1,
handle_call/3,
handle_cast/2,
handle_info/2,
code_change/3,
terminate/2
handle_cast/2
]).

-spec init(term()) -> ok.
Expand All @@ -24,15 +21,3 @@ handle_call(_Request, _From, _State) ->
-spec handle_cast(term(), term()) -> ok.
handle_cast(_Request, _State) ->
ok.

-spec handle_info(term(), term()) -> ok.
handle_info(_Info, _State) ->
ok.

-spec code_change(term(), term(), term()) -> term().
code_change(_OldVsn, State, _Extra) ->
{ok, State}.

-spec terminate(term(), term()) -> ok.
terminate(_Reason, _State) ->
ok.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
-export([
init/1,
handle_call/3,
handle_cast/2,
handle_info/2,
code_change/3,
terminate/2
handle_cast/2
]).

-record(state, {}).
Expand All @@ -21,22 +18,10 @@
init(_Args) ->
#state{}.

-spec handle_call(term(), term(), term()) -> ok.
handle_call(_Request, _From, _State) ->
ok.
-spec handle_call(term(), term(), state()) -> {noreply, state()}.
handle_call(_Request, _From, State) ->
{noreply, State}.

-spec handle_cast(term(), term()) -> ok.
handle_cast(_Request, _State) ->
ok.

-spec handle_info(term(), term()) -> ok.
handle_info(_Info, _State) ->
ok.

-spec code_change(term(), term(), term()) -> term().
code_change(_OldVsn, State, _Extra) ->
{ok, State}.

-spec terminate(term(), term()) -> ok.
terminate(_Reason, _State) ->
ok.
-spec handle_cast(term(), state()) -> {noreply, state()}.
handle_cast(_Request, State) ->
{noreply, State}.
29 changes: 7 additions & 22 deletions test/examples/pass_state_record_and_type.erl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
-export([
init/1,
handle_call/3,
handle_cast/2,
handle_info/2,
code_change/3,
terminate/2
handle_cast/2
]).

-record(state, {}).
Expand All @@ -21,22 +18,10 @@
init(_Args) ->
#state{}.

-spec handle_call(term(), term(), term()) -> ok.
handle_call(_Request, _From, _State) ->
ok.
-spec handle_call(term(), term(), state()) -> {noreply, state()}.
handle_call(_Request, _From, State) ->
{noreply, State}.

-spec handle_cast(term(), term()) -> ok.
handle_cast(_Request, _State) ->
ok.

-spec handle_info(term(), term()) -> ok.
handle_info(_Info, _State) ->
ok.

-spec code_change(term(), term(), term()) -> term().
code_change(_OldVsn, State, _Extra) ->
{ok, State}.

-spec terminate(term(), term()) -> ok.
terminate(_Reason, _State) ->
ok.
-spec handle_cast(term(), state()) -> {noreply, state()}.
handle_cast(_Request, State) ->
{noreply, State}.
29 changes: 7 additions & 22 deletions test/examples/pass_state_record_and_type_elvis_attr.erl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
-export([
init/1,
handle_call/3,
handle_cast/2,
handle_info/2,
code_change/3,
terminate/2
handle_cast/2
]).

-elvis([{elvis_style, state_record_and_type, disable}]).
Expand All @@ -19,22 +16,10 @@
init(_Args) ->
ok.

-spec handle_call(term(), term(), term()) -> ok.
handle_call(_Request, _From, _State) ->
ok.

-spec handle_cast(term(), term()) -> ok.
handle_cast(_Request, _State) ->
ok.
-spec handle_call(term(), term(), term()) -> {noreply, term()}.
handle_call(_Request, _From, State) ->
{noreply, State}.

-spec handle_info(term(), term()) -> ok.
handle_info(_Info, _State) ->
ok.

-spec code_change(term(), term(), term()) -> term().
code_change(_OldVsn, State, _Extra) ->
{ok, State}.

-spec terminate(term(), term()) -> ok.
terminate(_Reason, _State) ->
ok.
-spec handle_cast(term(), term()) -> {noreply, term()}.
handle_cast(_Request, State) ->
{noreply, State}.
29 changes: 7 additions & 22 deletions test/examples/pass_state_record_and_type_opaque.erl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
-export([
init/1,
handle_call/3,
handle_cast/2,
handle_info/2,
code_change/3,
terminate/2
handle_cast/2
]).

-export_type([state/0]).
Expand All @@ -23,22 +20,10 @@
init(_Args) ->
#state{}.

-spec handle_call(term(), term(), term()) -> ok.
handle_call(_Request, _From, _State) ->
ok.
-spec handle_call(term(), term(), state()) -> {noreply, state()}.
handle_call(_Request, _From, State) ->
{noreply, State}.

-spec handle_cast(term(), term()) -> ok.
handle_cast(_Request, _State) ->
ok.

-spec handle_info(term(), term()) -> ok.
handle_info(_Info, _State) ->
ok.

-spec code_change(term(), term(), term()) -> term().
code_change(_OldVsn, State, _Extra) ->
{ok, State}.

-spec terminate(term(), term()) -> ok.
terminate(_Reason, _State) ->
ok.
-spec handle_cast(term(), state()) -> {noreply, state()}.
handle_cast(_Request, State) ->
{noreply, State}.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
-export([
init/1,
handle_call/3,
handle_cast/2,
handle_info/2,
code_change/3,
terminate/2
handle_cast/2
]).

-export_type([state/0]).
Expand All @@ -23,22 +20,10 @@
init(_Args) ->
#state{}.

-spec handle_call(term(), term(), term()) -> ok.
handle_call(_Request, _From, _State) ->
ok.
-spec handle_call(term(), term(), state()) -> {noreply, state()}.
handle_call(_Request, _From, State) ->
{noreply, State}.

-spec handle_cast(term(), term()) -> ok.
handle_cast(_Request, _State) ->
ok.

-spec handle_info(term(), term()) -> ok.
handle_info(_Info, _State) ->
ok.

-spec code_change(term(), term(), term()) -> term().
code_change(_OldVsn, State, _Extra) ->
{ok, State}.

-spec terminate(term(), term()) -> ok.
terminate(_Reason, _State) ->
ok.
-spec handle_cast(term(), state()) -> {noreply, state()}.
handle_cast(_Request, State) ->
{noreply, State}.

0 comments on commit f7d4119

Please sign in to comment.