Slight clean up on erlang tests

This commit is contained in:
José Valim
2013-06-20 22:44:22 +02:00
parent 1574f61a8b
commit c4dcaf540d
3 changed files with 15 additions and 24 deletions
@@ -1,4 +1,4 @@
-module(conditionals_test).
-module(control_test).
-include("elixir.hrl").
-include_lib("eunit/include/eunit.hrl").
@@ -6,6 +6,11 @@ eval(Content) ->
{ Value, Binding, _ } = elixir:eval(Content, []),
{ Value, Binding }.
to_erl(String) ->
Forms = elixir_translator:'forms!'(String, 1, "nofile", []),
{ Tree, _ } = elixir_translator:translate(Forms, elixir:scope_for_eval([])),
Tree.
% Booleans
booleans_test() ->
@@ -261,3 +266,11 @@ oror_test() ->
{true, _} = eval("false && false || true")
end,
test_helper:run_and_remove(F, ['Elixir.Bar']).
% Optimized
optimized_if_test() ->
[{ 'case', _, _,
[{clause,_,[{atom,_,false}],[],[{atom,_,else}]},
{clause,_,[{atom,_,true}],[],[{atom,_,do}]} ]
}] = to_erl("if is_list(x), do: :do, else: :else").
@@ -1,21 +0,0 @@
-module(erlang_call_test).
-export([match/0]).
-include_lib("eunit/include/eunit.hrl").
eval(Content) ->
{ Value, Binding, _ } = elixir:eval(Content, []),
{ Value, Binding }.
match() -> abs.
erlang_atoms_test() ->
{abs, []} = eval(":abs").
erlang_tuple_test() ->
{[erlang,1,2], []} = eval("{ :erlang, 1, 2 }.tuple_to_list").
erlang_call_test() ->
{1, []} = eval(":erlang.abs(-1)"),
{_, []} = eval(":dict.new"),
{_, []} = eval(":dict.new()"),
{abs, []} = eval(":erlang_call_test.match()").
+1 -2
View File
@@ -6,8 +6,7 @@ test() ->
application:start(elixir),
eunit:test([
atom_test,
conditionals_test,
erlang_call_test,
control_test,
function_test,
match_test,
module_test,