Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

40 рядки
1.2 KiB

  1. -module(thooks_rt).
  2. -include_lib("eunit/include/eunit.hrl").
  3. -compile(export_all).
  4. files() ->
  5. [
  6. %% dummy lfe files
  7. {copy, "../../rebar", "rebar"},
  8. {copy, "rebar.config", "rebar.config"},
  9. {copy, "fish.erl", "src/fish.erl"},
  10. {create, "ebin/fish.app", app(fish, [fish])}
  11. ].
  12. run(_Dir) ->
  13. ?assertMatch({ok, _}, retest_sh:run("./rebar -v clean compile", [])),
  14. ensure_command_ran_only_once("preclean"),
  15. ensure_command_ran_only_once("precompile"),
  16. ensure_command_ran_only_once("postclean"),
  17. ensure_command_ran_only_once("postcompile"),
  18. ok.
  19. ensure_command_ran_only_once(Command) ->
  20. File = Command ++ ".out",
  21. ?assert(filelib:is_regular(File)),
  22. %% ensure that this command only ran once (not for each module)
  23. {ok, Content} = file:read_file(File),
  24. ?assertEqual(Command ++ "\n", binary_to_list(Content)).
  25. %%
  26. %% Generate the contents of a simple .app file
  27. %%
  28. app(Name, Modules) ->
  29. App = {application, Name,
  30. [{description, atom_to_list(Name)},
  31. {vsn, "1"},
  32. {modules, Modules},
  33. {registered, []},
  34. {applications, [kernel, stdlib]}]},
  35. io_lib:format("~p.\n", [App]).