Skip to content

Commit

Permalink
compile_SUITE: Correct the forms_2 test case to work on Windows
Browse files Browse the repository at this point in the history
Correct the forms_2 test case introduced in 2d785c0 so
that it will work on Windows. As originally written, the test case
assumed that filename:absname("/foo/bar") would return "/foo/bar",
which is not true on Windows (typically, the result will be
"c:/foo/bar").

While at it, clean up indentation, the overlong line, and comments.
  • Loading branch information
bjorng committed Aug 6, 2012
1 parent 24ad2d1 commit 85a5f71
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions lib/compiler/test/compile_SUITE.erl
Expand Up @@ -106,19 +106,23 @@ file_1(Config) when is_list(Config) ->
ok.

forms_2(Config) when is_list(Config) ->
{ok, simple, Binary} = compile:forms([{attribute,1,module,simple}], [binary, {source,"/foo/bar"}]),
code:load_binary(simple, "/foo/bar", Binary),
Info = simple:module_info(compile),

%% Test proper source is returned.
"/foo/bar" = proplists:get_value(source, Info),
%% Ensure options is not polluted with the source.
[] = proplists:get_value(options, Info),

%% Cleanup.
true = code:delete(simple),
false = code:purge(simple),
ok.
Src = "/foo/bar",
AbsSrc = filename:absname(Src),
{ok,simple,Binary} = compile:forms([{attribute,1,module,simple}],
[binary,{source,Src}]),
code:load_binary(simple, Src, Binary),
Info = simple:module_info(compile),

%% Test that the proper source is returned.
AbsSrc = proplists:get_value(source, Info),

%% Ensure that the options are not polluted with 'source'.
[] = proplists:get_value(options, Info),

%% Cleanup.
true = code:delete(simple),
false = code:purge(simple),
ok.

module_mismatch(Config) when is_list(Config) ->
?line DataDir = ?config(data_dir, Config),
Expand Down

0 comments on commit 85a5f71

Please sign in to comment.