     group_leader = Process.group_leader()
 
     test = self()
+
     assert_raise ArgumentError, fn ->
       capture_io(fn ->
         send(test, {:string_io, Process.group_leader()})

    end

    def until_new_line(this_far, chars, stop_char) do
      case Enum.split_while(chars, fn(c) -> c != stop_char end) do
        {l, []} ->
          {:more, this_far ++ l}
        {l, [stop_char | rest]} ->
          {:done, this_far ++ l ++ [stop_char], rest}
      end
    end

    def get_line(device \\ Process.group_leader) do
      send device, {:io_request, self(), device, {:get_until, :unicode, "", __MODULE__, :until_new_line, [?\n]}}
      receive do
        {:io_reply, _, data} -> data
      end


    capture_io(":erl. mof*,,l", fn ->
      assert :io.scan_erl_form('>') == {:ok, [{:":", 1}, {:atom, 1, :erl}, {:dot, 1}], 1}

      expected_tokens = [{:atom, 1, :mof}, {:*, 1}, {:",", 1}, {:",", 1}, {:atom, 1, :l}]
      assert :io.scan_erl_form('>') == {:ok, expected_tokens, 1}

      assert :io.scan_erl_form('>') == {:eof, 1}
    end)

    capture_io("a\nb\nc", fn ->
      assert GetUntil.get_line() == "a\n"
      assert GetUntil.get_line() == "b\n"
      assert GetUntil.get_line() == :eof
    end)
  end

  test "with setopts" do
    assert capture_io(fn ->
             assert :io.setopts({:encoding, :latin1}) == {:error, :enotsup}
           end) == ""
  end

  test "with getopts" do
    assert capture_io(fn ->
             assert :io.getopts() == {:ok, [binary: true, encoding: :unicode]}
           end) == ""
  end

  test "with columns" do
    assert capture_io(fn ->
             :io.columns()
           end) == ""

    capture_io(fn ->
      assert :io.columns() == {:error, :enotsup}
    end)
  end

  test "with rows" do
    assert capture_io(fn ->
             :io.rows()
           end) == ""

    capture_io(fn ->
      assert :io.rows() == {:error, :enotsup}
    end)
  end

  test "with multiple IO requests" do
    requests = [{:put_chars, :unicode, "a"}, {:put_chars, :unicode, "b"}]

    assert capture_io(fn ->
             send_and_receive_io({:requests, requests})
           end) == "ab"

    capture_io(fn ->
      assert send_and_receive_io({:requests, requests}) == :ok
    end)
  end

  test "with unknown IO request" do
    assert capture_io(fn ->
             send_and_receive_io(:unknown)
           end) == ""

    capture_io(fn ->
      assert send_and_receive_io(:unknown) == {:error, :request}
