Revert "fix: escape injected code in Common.replace_code/2 (#70)" (#72)

This reverts commit bba8d5238e.
This commit is contained in:
Zach Daniel 2024-08-04 22:43:27 -04:00 committed by GitHub
parent bba8d5238e
commit 79ae2d653b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1 additions and 23 deletions

View file

@ -272,7 +272,7 @@ defmodule Igniter.Code.Common do
def replace_code(zipper, code) do
# code = use_aliases(code, zipper)
Zipper.replace(zipper, code |> Macro.to_string() |> Sourceror.parse_string!())
Zipper.replace(zipper, code)
end
def extendable_block?({:__block__, meta, contents}) when is_list(contents) do

View file

@ -234,28 +234,6 @@ defmodule Igniter.Project.ConfigTest do
"""
end
@tag :regression
test "arbitrary data structures can be used as values" do
%{rewrite: rewrite} =
Igniter.new()
|> Igniter.create_new_elixir_file("config/fake.exs", """
import Config
config :level1, :level2, level3: [{"hello", "world"}]
""")
|> Igniter.Project.Config.configure("fake.exs", :level1, [:level2, :level3], [
{"hello1", "world1"}
])
config_file = Rewrite.source!(rewrite, "config/fake.exs")
assert Source.get(config_file, :content) == """
import Config
config :level1, :level2, level3: [{"hello1", "world1"}]
"""
end
test "present values can be updated by updating map keys" do
%{rewrite: rewrite} =
Igniter.new()