 
   describe "normalize" do
     test "wrap custom Erlang error" do
-      result = try do
-        :erlang.error(:sample)
-      rescue
-        x in [ErlangError] -> Exception.message(x)
-      end
+      result =
+        try do
+          :erlang.error(:sample)
+        rescue
+          x in [ErlangError] -> Exception.message(x)
+        end
 
       assert result == "Erlang error: :sample"
     end
 
     test "undefined function error" do
-      result = try do
-        DoNotExist.for_sure()
-      rescue
-        x in [UndefinedFunctionError] -> Exception.message(x)
-      end
-
-      assert result == "function DoNotExist.for_sure/0 is undefined (module DoNotExist is not available)"
+      result =
+        try do
+          DoNotExist.for_sure()
+        rescue
+          x in [UndefinedFunctionError] -> Exception.message(x)
+        end
+
+      assert result ==
+               "function DoNotExist.for_sure/0 is undefined (module DoNotExist is not available)"
     end
 
     test "function clause error" do
-      result = try do
-        zero(1)
-      rescue
-        x in [FunctionClauseError] -> Exception.message(x)
-      end
+      result =
+        try do
+          zero(1)
+        rescue
+          x in [FunctionClauseError] -> Exception.message(x)
+        end
 
       assert result == "no function clause matching in Kernel.RaiseTest.zero/1"
     end
 
     test "badarg error" do
-      result = try do
-        :erlang.error(:badarg)
-      rescue
-        x in [ArgumentError] -> Exception.message(x)
-      end
+      result =
+        try do
+          :erlang.error(:badarg)
+        rescue
+          x in [ArgumentError] -> Exception.message(x)
+        end
 
       assert result == "argument error"
     end
 
     test "tuple badarg error" do
-      result = try do
-        :erlang.error({:badarg, [1, 2, 3]})
-      rescue
-        x in [ArgumentError] -> Exception.message(x)
-      end
+      result =
+        try do
+          :erlang.error({:badarg, [1, 2, 3]})
+        rescue
+          x in [ArgumentError] -> Exception.message(x)
+        end
 
       assert result == "argument error: [1, 2, 3]"
     end
 
     test "badarith error" do
-      result = try do
-        :erlang.error(:badarith)
-      rescue
-        x in [ArithmeticError] -> Exception.message(x)
-      end
+      result =
+        try do
+          :erlang.error(:badarith)
+        rescue
+          x in [ArithmeticError] -> Exception.message(x)
+        end
 
       assert result == "bad argument in arithmetic expression"
     end
 
     test "badarity error" do
-      fun    = fn(x) -> x end
+      fun = fn x -> x end
       string = "#{inspect(fun)} with arity 1 called with 2 arguments (1, 2)"
 
-      result = try do
-        fun.(1, 2)
-      rescue
-        x in [BadArityError] -> Exception.message(x)
-      end
+      result =
+        try do
+          fun.(1, 2)
+        rescue
+          x in [BadArityError] -> Exception.message(x)
+        end
 
       assert result == string
     end

  test "reraise with no arguments" do
    try do
      reraise RuntimeError, @trace
      flunk "should not reach"
    rescue
      RuntimeError ->
        assert @trace == :erlang.get_stacktrace()


  describe "rescue" do
    test "runtime error" do
      result =
        try do
          raise "an exception"
        rescue
          RuntimeError -> true
        catch
          :error, _ -> false
        end

      assert result

      result =
        try do
          raise "an exception"
        rescue
          AnotherError -> true
        catch
          :error, _ -> false
        end

      refute result
    end

    test "named runtime error" do
      result =
        try do
          raise "an exception"
        rescue
          x in [RuntimeError] -> Exception.message(x)
        catch
          :error, _ -> false
        end

      assert result == "an exception"
    end

    test "with higher precedence than catch" do
      result =
        try do
          raise "an exception"
        rescue
          _ -> true
        catch
          _, _ -> false
        end

      assert result
    end

    test "argument error from erlang" do
      result =
        try do
          :erlang.error(:badarg)
        rescue
          ArgumentError -> true
        end

      assert result
    end

    test "argument error from elixir" do
      result =
        try do
          raise ArgumentError, ""
        rescue
          ArgumentError -> true
        end

      assert result
    end

    test "catch-all variable" do
      result =
        try do
          raise "an exception"
        rescue
          x -> Exception.message(x)
        end

      assert result == "an exception"
    end

    test "catch-all underscore" do
      result =
        try do
          raise "an exception"
        rescue
          _ -> true
        end

      assert result
    end

    test "catch-all unused variable" do
      result =
        try do
          raise "an exception"
        rescue
          _any -> true
        end

      assert result
    end

    test "catch-all with \"x in _\" syntax" do
      result =
        try do
          raise "an exception"
        rescue
          exception in _ ->
            Exception.message(exception)
        end

      assert result == "an exception"
    end
