       end
     end
 
+    test "raises if do is missing" do
+      assert_raise CompileError, ~r"missing do keyword in try", fn ->
+        expand(quote do: (try []))
+      end
+    end
+
+    test "raises if do is not accompanied by catch/rescue/after/else" do
+      assert_raise CompileError, ~r"missing catch/rescue/after/else keyword in try", fn ->
+        expand(quote do: (try do x end))
+      end
+    end
+
     test "expects at most one clause" do
       assert_raise CompileError, ~r"duplicated do clauses given for try", fn ->
         expand(quote(do: (try do: e, do: f)))

             quote do: (cond do 1 -> x = 1; 2 -> y = 2 end; :erlang.+(x, y))
    end

    test "expects at most one do" do
      assert_raise CompileError, ~r"duplicated do clauses given for cond", fn ->
        expand(quote(do: (cond do: (x -> x), do: (y -> y))))
      end
    end


    test "expects one or two args for catch clauses" do
      assert_raise CompileError, ~r"expected one or two args for catch clauses \(->\) in try", fn ->
        expand(quote do: (try do x catch _, _, _ -> :ok end))
      end
    end

    test "expects clauses for rescue, else, catch" do
      assert_raise CompileError, ~r"expected -> clauses for rescue in try", fn ->
        expand(quote do: (try do e rescue x end))
      end

      assert_raise CompileError, ~r"expected -> clauses for catch in try", fn ->
        expand(quote do: (try do e catch x end))
      end

      assert_raise CompileError, ~r"expected -> clauses for else in try", fn ->
        expand(quote do: (try do e else x end))
      end
    end
  end
