aboutsummaryrefslogtreecommitdiffstats
path: root/test/rlx_test_utils.erl
diff options
context:
space:
mode:
authorTristan Sloughter <[email protected]>2016-10-02 18:25:25 -0700
committerGitHub <[email protected]>2016-10-02 18:25:25 -0700
commitcf68577c1499c64c7b154160fffe14cd57fbb6ec (patch)
tree360d70f54cd6095bcc94ab5ab1dedad22cd20724 /test/rlx_test_utils.erl
parentb4c4c47afbc677d24e45134530d25f0e687cdca6 (diff)
parent03b8b273e972ad1cb2b4a5e4a68a7c2ca4a29640 (diff)
downloadrelx-cf68577c1499c64c7b154160fffe14cd57fbb6ec.tar.gz
relx-cf68577c1499c64c7b154160fffe14cd57fbb6ec.tar.bz2
relx-cf68577c1499c64c7b154160fffe14cd57fbb6ec.zip
Merge pull request #514 from lrascao/feature/extended_bin_tests
Add test coverage for the extended bin script
Diffstat (limited to 'test/rlx_test_utils.erl')
-rw-r--r--test/rlx_test_utils.erl16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/rlx_test_utils.erl b/test/rlx_test_utils.erl
index 279a887..2e6045f 100644
--- a/test/rlx_test_utils.erl
+++ b/test/rlx_test_utils.erl
@@ -80,6 +80,13 @@ test_template_contents() ->
"{prop1, \"{{prop1}}\"}.\n"
"{prop2, {{prop2}}}.\n".
+escript_contents() ->
+ "#!/usr/bin/env escript\n"
+ "\n"
+ "main(_Args) ->\n"
+ "io:format(\"~s\n\",\n"
+ " [os:getenv(\"RELEASE_ROOT_DIR\")]).\n".
+
-ifdef(rand_module).
random_uniform(N) ->
rand:uniform(N).
@@ -88,3 +95,12 @@ random_uniform(N) ->
random:seed(os:timestamp()),
random:uniform(N).
-endif.
+
+list_to_term(String) ->
+ {ok, T, _} = erl_scan:string(String++"."),
+ case erl_parse:parse_term(T) of
+ {ok, Term} ->
+ Term;
+ {error, Error} ->
+ Error
+ end.