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.

46 lines
2.3 KiB

  1. %%% Most locking tests are implicit in other test suites handling
  2. %%% dependencies.
  3. %%% This suite is to test the compatibility layers between various
  4. %%% versions of lockfiles.
  5. -module(rebar_lock_SUITE).
  6. -compile(export_all).
  7. -include_lib("common_test/include/ct.hrl").
  8. -include_lib("eunit/include/eunit.hrl").
  9. all() -> [current_version, future_versions_no_attrs, future_versions_attrs].
  10. current_version(Config) ->
  11. %% Current version just dumps the locks as is on disk.
  12. LockFile = filename:join(?config(priv_dir, Config), "current_version"),
  13. Locks = [{<<"app1">>, {git,"some_url", {ref,"some_ref"}}, 2},
  14. {<<"app2">>, {git,"some_url", {ref,"some_ref"}}, 0},
  15. {<<"app3">>, {hg,"some_url", {ref,"some_ref"}}, 1},
  16. {<<"pkg1">>,{pkg,<<"name">>,<<"0.1.6">>},3}],
  17. file:write_file(LockFile, io_lib:format("~p.~n", [Locks])),
  18. ?assertEqual(Locks, rebar_config:consult_lock_file(LockFile)).
  19. future_versions_no_attrs(Config) ->
  20. %% Future versions will keep the same core attribute in there, but
  21. %% will do so under a new format bundled with a version and potentially
  22. %% some trailing attributes
  23. LockFile = filename:join(?config(priv_dir, Config), "future_versions"),
  24. Locks = [{<<"app1">>, {git,"some_url", {ref,"some_ref"}}, 2},
  25. {<<"app2">>, {git,"some_url", {ref,"some_ref"}}, 0},
  26. {<<"app3">>, {hg,"some_url", {ref,"some_ref"}}, 1},
  27. {<<"pkg1">>,{pkg,<<"name">>,<<"0.1.6">>},3}],
  28. LockData = {"3.5.2", Locks},
  29. file:write_file(LockFile, io_lib:format("~p.~n", [LockData])),
  30. ?assertEqual(Locks, rebar_config:consult_lock_file(LockFile)).
  31. future_versions_attrs(Config) ->
  32. %% Future versions will keep the same core attribute in there, but
  33. %% will do so under a new format bundled with a version and potentially
  34. %% some trailing attributes
  35. LockFile = filename:join(?config(priv_dir, Config), "future_versions"),
  36. Locks = [{<<"app1">>, {git,"some_url", {ref,"some_ref"}}, 2},
  37. {<<"app2">>, {git,"some_url", {ref,"some_ref"}}, 0},
  38. {<<"app3">>, {hg,"some_url", {ref,"some_ref"}}, 1},
  39. {<<"pkg1">>,{pkg,<<"name">>,<<"0.1.6">>},3}],
  40. LockData = {"3.5.2", Locks},
  41. file:write_file(LockFile, io_lib:format("~p.~na.~n{b,c}.~n[d,e,f].~n", [LockData])),
  42. ?assertEqual(Locks, rebar_config:consult_lock_file(LockFile)).