Skip to content

Commit

Permalink
Rearrange tests for list comprehension generators being none()
Browse files Browse the repository at this point in the history
  • Loading branch information
erszcz committed Jan 26, 2023
1 parent c54be03 commit 893f361
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 46 deletions.

This file was deleted.

18 changes: 18 additions & 0 deletions test/should_fail/lc_generator_not_none_fail.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-module(lc_generator_not_none_fail).

%% Compare with test/should_pass/lc_generator_not_none.erl

-export([g/2]).

-type t() :: {a, d}
| {a, [t()]}.

-spec g(integer(), t()) -> [t()].
g(1, {a, d} = T) ->
[T];
g(_, {a, Ts}) ->
[ T || T <- Ts ];
g(_, _) ->
%% This clause is redundant, as the previous two exhaust g/2 parameters.
%% It's correctly reported as such.
[].
20 changes: 0 additions & 20 deletions test/should_fail/lc_generator_should_fail.erl

This file was deleted.

11 changes: 7 additions & 4 deletions test/should_pass/lc_generator_not_none.erl
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
-module(lc_generator_not_none).

%% Compare with:
%% - test/known_problems/should_pass/lc_cannot_glb_different_variants.erl
%% - test/should_fail/lc_generator_should_fail.erl
%% Compare with test/should_fail/lc_generator_not_none_fail.erl

-export([g/1]).
-export([g/1,
h/1]).

-type t() :: {a, d}
| {a, [t()]}.
Expand All @@ -14,3 +13,7 @@ g({a, d} = T) ->
[T];
g({a, Ts}) ->
[ T || T <- Ts ].

-spec h(t()) -> [t()].
h({a, Ts}) ->
[ T || T <- Ts ].

0 comments on commit 893f361

Please sign in to comment.