Permalink
Browse files

fixup! Add two tests for unused multiple values in effect context

  • Loading branch information...
bjorng committed Feb 4, 2013
1 parent 3070a78 commit 4e21e16ebc1c012ac52b89ba1b38d6f98cfbac2c
Showing with 26 additions and 21 deletions.
  1. +0 −1 lib/compiler/test/Makefile
  2. +26 −6 lib/compiler/test/core_fold_SUITE.erl
  3. +0 −14 lib/compiler/test/unused_multiple_values.erl
@@ -33,7 +33,6 @@ MODULES= \
record_SUITE \
trycatch_SUITE \
warnings_SUITE \
- unused_multiple_values \
test_lib
NO_OPT= \
@@ -37,7 +37,8 @@ all() ->
groups() ->
[{p,test_lib:parallel(),
[t_element,setelement,t_length,append,t_apply,bifs,
- eq,nested_call_in_case,guard_try_catch,coverage,unused_values]}].
+ eq,nested_call_in_case,guard_try_catch,coverage,
+ unused_multiple_values_error,unused_multiple_values]}].
init_per_suite(Config) ->
@@ -297,9 +298,28 @@ unused_multiple_values_error(Config) when is_list(Config) ->
ok.
unused_multiple_values(Config) when is_list(Config) ->
- PrivDir = ?config(priv_dir, Config),
- Dir = filename:dirname(code:which(?MODULE)),
- File = filename:join(Dir, "unused_multiple_values"),
- Opts = [return,{outdir,PrivDir}|test_lib:opt_opts(?MODULE)],
- {ok,unused_multiple_values} = c:c(File, Opts),
+ put(unused_multiple_values, []),
+ [false] = test_unused_multiple_values(false),
+ [b,a,{a,b},false] = test_unused_multiple_values({a,b}),
+ ok.
+
+test_unused_multiple_values(X) ->
+ ok = do_unused_multiple_values(X),
+ get(unused_multiple_values).
+
+do_unused_multiple_values(X) ->
+ case do_something(X) of
+ false ->
+ A = false;
+ Res ->
+ {A,B} = Res,
+ do_something(A),
+ do_something(B)
+ end,
+ _ThisShouldNotFail = A,
ok.
+
+do_something(I) ->
+ put(unused_multiple_values,
+ [I|get(unused_multiple_values)]),
+ I.
@@ -1,14 +0,0 @@
--module(unused_multiple_values).
--export([hello/1]).
-
-hello(X) ->
- case external:do_something(X) of
- false ->
- A = false;
- Res ->
- {A,B} = Res,
- external:do_something(A),
- external:do_something(B)
- end,
- _ThisShouldNotFail = A,
- ok.

0 comments on commit 4e21e16

Please sign in to comment.