 
   @tag apps: [:test, :app_deps_sample, :app_deps2_sample, :app_deps3_sample, :app_deps4_sample]
   test "shows the application tree", context do
-    Mix.Project.push AppDepsSample
+    Mix.Project.push(AppDepsSample)
 
     in_tmp context.test, fn ->
       load_apps()

Code.require_file "../../test_helper.exs", __DIR__

defmodule Mix.Tasks.App.TreeTest do
  use MixTest.Case


  @tag apps: [:test, :app_deps_sample, :app_deps2_sample, :app_deps3_sample, :app_deps4_sample]
  test "shows the application tree in dot form", context do
    Mix.Project.push(AppDepsSample)

    in_tmp context.test, fn ->
      load_apps()
      Mix.Tasks.App.Tree.run(["--format", "dot"])

      assert File.read!("app_tree.dot") == """
             digraph "application tree" {
               "test"
               "test" -> "elixir"
               "test" -> "logger"
               "logger" -> "elixir"
               "test" -> "app_deps_sample"
               "app_deps_sample" -> "app_deps2_sample"
               "app_deps2_sample" -> "app_deps4_sample" [label="(included)"]
               "app_deps_sample" -> "app_deps3_sample"
             }
             """
    end
  end

  def load_apps() do
    :ok = :application.load({:application, :app_deps4_sample, [vsn: '1.0.0', env: []]})
    :ok = :application.load({:application, :app_deps3_sample, [vsn: '1.0.0', env: []]})

    opts = [vsn: '1.0.0', env: [], included_applications: [:app_deps4_sample]]
    :ok = :application.load({:application, :app_deps2_sample, opts})

    opts = [vsn: '1.0.0', env: [], applications: [:app_deps2_sample, :app_deps3_sample]]
    :ok = :application.load({:application, :app_deps_sample, opts})
  end
end
