aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test
diff options
context:
space:
mode:
authorHenrik Nord <[email protected]>2012-07-18 11:00:42 +0200
committerHenrik Nord <[email protected]>2012-07-18 11:00:47 +0200
commit3ad520ad95e79fe5dc63f017f37f043e5a84e3e8 (patch)
tree8877697620eac37c56b2fe33b720901506d226ec /lib/compiler/test
parente10b54d9b94c5deb821a708a5ae7e72d34fd0f14 (diff)
parent2d785c07fbf9f533bf4627a65315a51c3efc2113 (diff)
downloadotp-3ad520ad95e79fe5dc63f017f37f043e5a84e3e8.tar.gz
otp-3ad520ad95e79fe5dc63f017f37f043e5a84e3e8.tar.bz2
otp-3ad520ad95e79fe5dc63f017f37f043e5a84e3e8.zip
Merge branch 'jv/forms-source' into maint
* jv/forms-source: Allow the source to be set when compiling forms OTP-10150
Diffstat (limited to 'lib/compiler/test')
-rw-r--r--lib/compiler/test/compile_SUITE.erl19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/compiler/test/compile_SUITE.erl b/lib/compiler/test/compile_SUITE.erl
index 512fa0e4ac..0dfa18490a 100644
--- a/lib/compiler/test/compile_SUITE.erl
+++ b/lib/compiler/test/compile_SUITE.erl
@@ -25,7 +25,7 @@
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
init_per_group/2,end_per_group/2,
app_test/1,
- file_1/1, module_mismatch/1, big_file/1, outdir/1,
+ file_1/1, forms_2/1, module_mismatch/1, big_file/1, outdir/1,
binary/1, makedep/1, cond_and_ifdef/1, listings/1, listings_big/1,
other_output/1, package_forms/1, encrypted_abstr/1,
bad_record_use1/1, bad_record_use2/1, strict_record/1,
@@ -42,7 +42,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
test_lib:recompile(?MODULE),
- [app_test, file_1, module_mismatch, big_file, outdir,
+ [app_test, file_1, forms_2, module_mismatch, big_file, outdir,
binary, makedep, cond_and_ifdef, listings, listings_big,
other_output, package_forms, encrypted_abstr,
{group, bad_record_use}, strict_record,
@@ -105,6 +105,21 @@ file_1(Config) when is_list(Config) ->
?line test_server:timetrap_cancel(Dog),
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.
+
module_mismatch(Config) when is_list(Config) ->
?line DataDir = ?config(data_dir, Config),
?line File = filename:join(DataDir, "wrong_module_name.erl"),