1Code.require_file("../../test_helper.exs", __DIR__)
2
3defmodule Mix.Tasks.LocalTest do
4  use MixTest.Case
5
6  test "MIX_PATH" do
7    File.rm_rf!(tmp_path("mixpath"))
8    System.put_env("MIX_PATH", tmp_path("mixpath/ebin"))
9
10    File.mkdir_p!(tmp_path("mixpath/ebin"))
11    Mix.Local.append_paths()
12
13    # Install on MIX_PATH manually
14    File.copy!(
15      fixture_path("archive/ebin/Elixir.Mix.Tasks.Local.Sample.beam"),
16      tmp_path("mixpath/ebin/Elixir.Mix.Tasks.Local.Sample.beam")
17    )
18
19    # Run it
20    Mix.Task.run("local.sample")
21    assert_received {:mix_shell, :info, ["sample"]}
22  after
23    purge([Mix.Tasks.Local.Sample])
24  end
25end
26