     end
   end
 
+  test "string_to_quoted!/2 raises with the :existing_atoms_only option" do
+    assert catch_error(Code.string_to_quoted!(":there_is_no_such_atom", existing_atoms_only: true)) == :badarg
+  end
+
   test "compile source" do
     assert __MODULE__.__info__(:compile)[:source] == String.to_charlist(__ENV__.file)
   end

    assert Code.require_file(fixture_path("code_sample.exs")) != nil
  end

  test "string to quoted" do
    assert Code.string_to_quoted("1 + 2")  == {:ok, {:+, [line: 1], [1, 2]}}
    assert Code.string_to_quoted!("1 + 2") == {:+, [line: 1], [1, 2]}

    assert Code.string_to_quoted("a.1") ==
           {:error, {1, "syntax error before: ", "1"}}

    assert_raise SyntaxError, fn ->
      Code.string_to_quoted!("a.1")
    end
  end

  test "string to quoted existing atoms only" do
    assert :badarg = catch_error(Code.string_to_quoted!(":there_is_no_such_atom", existing_atoms_only: true))
  end

  test "string_to_quoted!" do
    assert Code.string_to_quoted!("1 + 2") == {:+, [line: 1], [1, 2]}

    assert_raise SyntaxError, fn ->


  Code.eval_quoted contents, [], file: "sample.ex", line: 13

  describe "eval_string/1-3" do
    test "correctly evaluates a string of code" do
      assert Code.eval_string("1 + 2") == {3, []}
      assert Code.eval_string("two = 1 + 1") == {2, [two: 2]}
    end

    test "supports a %Macro.Env{} struct as the third argument" do
      assert {3, _} = Code.eval_string("a + b", [a: 1, b: 2], __ENV__)
    end

    test "can return bindings from a different context" do
      assert Code.eval_string("var!(a, Sample) = 1") == {1, [{{:a, Sample}, 1}]}
    end

    test "supports unnamed scopes" do
      assert {%RuntimeError{}, [a: %RuntimeError{}]} =
        Code.eval_string("a = (try do (raise \"hello\") rescue e -> e end)")
    end

    test "supports the :requires option" do
      assert Code.eval_string("Kernel.if true, do: :ok", [], requires: [Z, Kernel]) == {:ok, []}
    end

    test "with many options" do
      options = [
        functions: [{Kernel, [is_atom: 1]}],
        macros: [{Kernel, [and: 2]}],
        aliases: [{K, Kernel}],
        requires: [Kernel],
      ]

      code = "is_atom(:foo) and K.is_list([])"

      assert Code.eval_string(code, [], options) == {true, []}
    end

    test "yields the correct stacktrace" do
      try do
        Code.eval_string("<<a::size(b)>>", a: :a, b: :b)
      rescue
        _ ->
          assert System.stacktrace |> Enum.any?(&(elem(&1, 0) == __MODULE__))
      end
    end
  end

  test "eval binary errors" do
