 
 defmodule Mix.ShellTest do
   use MixTest.Case
+  import ExUnit.CaptureIO
 
   test "shell process" do
     Mix.shell.info "abc"

  end

  test "shell io" do
    import ExUnit.CaptureIO

    Mix.shell(Mix.Shell.IO)
    assert Mix.shell == Mix.Shell.IO

    assert capture_io(fn -> Mix.shell.info "abc" end) ==
           "abc\n"


    assert capture_io(fn -> assert Mix.shell.cmd("echo first") == 0 end) ==
           "first\n"
  end

  test "shell cmd supports expressions" do
    Mix.shell Mix.Shell.IO

    assert capture_io(fn ->
      assert Mix.shell.cmd("echo first && echo second") == 0
    end) == "first\nsecond\n"
  end

  teardown do
    Mix.shell(Mix.Shell.Process)
    :ok
  end
end
