     assert expand('%IEx.AutocompleteTest.MyStr') == {:yes, 'uct', []}
   end
 
-  @tag previous_line: "struct = %IEx.AutocompleteTest.MyStruct{}"
   test "completion for struct keys" do
+    eval("struct = %IEx.AutocompleteTest.MyStruct{}")
     assert expand('struct.my') == {:yes, '_val', []}
   end
 end

defmodule IEx.AutocompleteTest do
  use ExUnit.Case, async: true

  setup context do
    ExUnit.CaptureIO.capture_io(fn ->
      evaluator = IEx.Server.start_evaluator([])
      Process.put(:evaluator, evaluator)

      previous_line = context[:previous_line]
      if previous_line do
        send evaluator, {:eval, self(), previous_line <> "\n", %IEx.State{}}
        assert_receive {:evaled, _, _}
      end
    end)

    :ok
  end


    assert expand('map.foo') == {:no, '', []}
  end

  test "nested map atom key completion is supported" do
    eval("map = %{nested: %{deeply: %{foo: 1, bar_1: 23, bar_2: 14, mod: String, num: 1}}}")
    assert expand('map.nested.deeply.f') == {:yes, 'oo', []}
    assert expand('map.nested.deeply.b') == {:yes, 'ar_', []}
    assert expand('map.nested.deeply.bar_') == {:yes, '', ['bar_1', 'bar_2']}
