         case unquote(expr_ast) do
           ^v -> :ok
           instead ->
-            location = [line: unquote(line), file: Path.relative_to(unquote(file), System.cwd!)]
-            stack    = [{ unquote(module), :__MODULE__, 0, location }]
             raise ExUnit.ExpectationError,
               [ prelude: "Expected doctest",
                 expected: unquote(test.expr),
                 actual: inspect(v),
                 reason: "evaluate to",
                 instead: instead ],
-              stack
+              unquote(stack)
         end
       rescue
         e in [ExUnit.ExpectationError] ->
-          location = [line: unquote(line), file: Path.relative_to(unquote(file), System.cwd!)]
-          stack    = [{ unquote(module), :__MODULE__, 0, location }]
-          raise e, [], stack
+          raise e, [], unquote(stack)
         e ->
-          location = [line: unquote(line), file: Path.relative_to(unquote(file), System.cwd!)]
-          stack    = [{ unquote(module), :__MODULE__, 0, location }]
           raise ExUnit.ExpectationError,
             [ prelude: "Expected doctest",
               expected: unquote(test.expr),
               actual: "without an exception",
               reason: "complete",
               instead: e ],
-            stack
+            unquote(stack)
       end
     end
     if do_import do

  defp extract_tests([], _line, "", "", acc), do: Enum.reverse(acc)

  defp extract_tests([], line, expr_acc, expected_acc, acc) do
    test = Test[expr: expr_acc, line: line, expected: { :ok, expected_acc }]
    Enum.reverse([test|acc])
  end

  defp extract_tests([<< "iex>", _ :: binary>>|_] = list, line, expr_acc, expected_acc, acc) when expr_acc != "" and expected_acc != "" do
    test = Test[expr: expr_acc, line: line, expected: { :ok, expected_acc }]
    extract_tests(list, line, "", "", [test|acc])
  end


  end

  defp extract_tests([""|lines], line, expr_acc, expected_acc, acc) do
    test = Test[expr: expr_acc, line: line, expected: { :test, expected_acc }]
    extract_tests(lines, line,  "", "", [test|acc])
  end

