You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 line
1.6 KiB

  1. %%% @doc Plugin handling test
  2. %%%
  3. %%% This test checks if plugins are loaded correctly.
  4. %%%
  5. %%% It has three applications:
  6. %%% <ol>
  7. %%% <li>fish. top-level module, has one dependency: `dependsonplugin'.</li>
  8. %%% <li>dependsonplugin. This depends on some pre-compile actions by the
  9. %%% plugin. In the test the plugin creates a file `pre.compile' in the
  10. %%% top-level folder of this application.</li>
  11. %%% <li>testplugin. This is a plugin application which creates the file.</li>
  12. %%% </ol>
  13. -module(depplugins_rt).
  14. -compile(export_all).
  15. -include_lib("eunit/include/eunit.hrl").
  16. files() ->
  17. [
  18. {copy, "../../rebar", "rebar"},
  19. {copy, "rebar.config", "rebar.config"},
  20. {create, "ebin/fish.app", app(fish, [])},
  21. {create, "deps/dependsonplugin/ebin/dependsonplugin.app",
  22. app(dependsonplugin, [])},
  23. {copy, "rebar_dependsonplugin.config",
  24. "deps/dependsonplugin/rebar.config"},
  25. {copy, "testplugin_mod.erl",
  26. "deps/testplugin/plugins/testplugin_mod.erl"},
  27. {create, "deps/testplugin/ebin/testplugin.app",
  28. app(testplugin, [])}
  29. ].
  30. run(_Dir) ->
  31. ?assertMatch({ok, _}, retest_sh:run("./rebar compile", [])),
  32. ?assertEqual(true, filelib:is_regular("deps/dependsonplugin/pre.compile")),
  33. ok.
  34. %%
  35. %% Generate the contents of a simple .app file
  36. %%
  37. app(Name, Modules) ->
  38. App = {application, Name,
  39. [{description, atom_to_list(Name)},
  40. {vsn, "1"},
  41. {modules, Modules},
  42. {registered, []},
  43. {applications, [kernel, stdlib]}]},
  44. io_lib:format("~p.\n", [App]).