     def evaluator do
       Process.get(:evaluator)
     end
+  end
+
+  defp eval(line) do
+    ExUnit.CaptureIO.capture_io(fn ->
+      evaluator = MyServer.evaluator
+      Process.group_leader(evaluator, Process.group_leader)
+      send evaluator, {:eval, self(), line <> "\n", %IEx.State{}}
+      assert_receive {:evaled, _, _}
+    end)
   end
 
   defp expand(expr) do

    quote do: var!(my_var_1, Elixir) = 1
  end

  @tag previous_line: "require #{__MODULE__}; #{__MODULE__}.define_var(); my_var_2 = 2"
  test "ignores quoted variables when performing variable completion" do
    assert expand('my_var') == {:yes, '_2', []}
  end


    assert expand('put_') == {:yes, '', ['put_elem/3', 'put_in/2', 'put_in/3']}
  end

  test "variable name completion" do
    eval("numeral = 3; number = 3; nothing = nil")
    assert expand('numb') == {:yes, 'er', []}
    assert expand('num') == {:yes, '', ['number', 'numeral']}
    assert expand('no') == {:yes, '', ['nothing', 'node/0', 'node/1', 'not/1']}
  end

  test "completion of manually imported functions and macros" do
    eval("import Enum; import Supervisor, only: [count_children: 1]; import Protocol")
    assert expand('take') == {:yes, '', ['take/2', 'take_every/2', 'take_random/2', 'take_while/2']}
    assert expand('count') == {:yes, '', ['count/1', 'count/2', 'count_children/1']}
    assert expand('der') == {:yes, 'ive', []}
