-Code.require_file "../test_helper.exs", __DIR__
+Code.require_file("../test_helper.exs", __DIR__)
 
 defmodule Mix.CLITest do
   use MixTest.Case
 
   test "default task" do
     in_fixture "no_mixfile", fn ->
-      File.write! "mix.exs", """
+      File.write!("mix.exs", """
       defmodule P do
         use Mix.Project
         def project, do: [app: :p, version: "0.1.0"]
       end
-      """
-      mix ~w[]
+      """)
+
+      mix(~w[])
       assert File.regular?("_build/dev/lib/p/ebin/Elixir.A.beam")
     end
   end


  test "--version smoke test", context do
    in_tmp context.test, fn ->
      output = mix ~w[--version]
      assert output =~ ~r/Erlang.+\n\nMix [0-9\.a-z]+/
    end
  end

  test "env config", context do
    in_tmp context.test, fn ->
      File.write! "custom.exs", """
      defmodule P do
        use Mix.Project
        def project, do: [app: :p, version: "0.1.0"]
      end
      """

      System.put_env("MIX_ENV", "prod")
      System.put_env("MIX_EXS", "custom.exs")

      output = mix ["run", "-e", "IO.inspect {Mix.env, System.argv}",
                    "--", "1", "2", "3"]
      assert output =~ ~s({:prod, ["1", "2", "3"]})
    end
  after

          Mix.raise("oops")
        end
      end
      """)

      contents = mix(~w[my_hello], [{"MIX_QUIET", "1"}])
      assert contents =~ "Hello from MyProject!\n"
      refute contents =~ "This won't appear"

      contents = mix(~w[my_hello], [{"MIX_QUIET", "0"}])
      assert contents =~ "Hello from MyProject!\n"
      assert contents =~ "This won't appear"

      contents = mix(~w[my_hello], [{"MIX_DEBUG", "1"}])
      assert contents =~ "** Running mix my_hello (inside MyProject)"
      assert contents =~ "** (Mix.Error) oops"

      contents = mix(~w[my_hello], [{"MIX_DEBUG", "0"}])
      refute contents =~ "** Running mix my_hello (inside MyProject)"
      refute contents =~ "** (Mix.Error) oops"
    end
