 
   """
   defmacro test(message) do
+    %{module: mod, file: file, line: line} = __CALLER__
+
     quote bind_quoted: binding() do
-      name = ExUnit.Case.register_test(__ENV__, :test, message, [:not_implemented])
+      name = ExUnit.Case.register_test(mod, file, line, :test, message, [:not_implemented])
       def unquote(name)(_), do: flunk("Not implemented")
     end
   end

  display. You can use `ExUnit.plural_rule/2` to set a custom
  pluralization.
  """
  def register_test(%{module: mod, file: file, line: line}, test_type, name, tags) do
    unless Module.has_attribute?(mod, :ex_unit_tests) do
      raise "cannot define #{test_type}. Please make sure you have invoked " <>
              "\"use ExUnit.Case\" in the current module"


    var = Macro.escape(var)
    contents = Macro.escape(contents, unquote: true)
    %{module: mod, file: file, line: line} = __CALLER__

    quote bind_quoted: [
            var: var,
            contents: contents,
            message: message,
            mod: mod,
            file: file,
            line: line
          ] do
      name = ExUnit.Case.register_test(mod, file, line, :test, message, [])
      def unquote(name)(unquote(var)), do: unquote(contents)
    end
  end
