", debug: false)
+
+ assert_equal false, engine.debug
+ end
end
diff --git a/test/engine/engine_test.rb b/test/engine/engine_test.rb
index 03e15ac3b..df94a5bea 100644
--- a/test/engine/engine_test.rb
+++ b/test/engine/engine_test.rb
@@ -277,5 +277,65 @@ class EngineTest < Minitest::Spec
assert_compiled_snapshot("", enforce_erubi_equality: true)
assert_evaluated_snapshot("")
end
+
+ test "compilation with optimize for tag helper" do
+ assert_compiled_snapshot('<%= tag.div class: "container" do %>Content<% end %>', optimize: true)
+ end
+
+ test "compilation with optimize for void element" do
+ assert_compiled_snapshot("<%= tag.br %>", optimize: true)
+ end
+
+ test "compilation with optimize for tag with data attributes" do
+ assert_compiled_snapshot('<%= tag.div data: { controller: "content", count: 42 } %>', optimize: true)
+ end
+
+ test "compilation with optimize for nested tag helpers" do
+ assert_compiled_snapshot(<<~ERB, optimize: true)
+ <%= tag.div class: "outer" do %>
+ <%= tag.span "Inner" %>
+ <% end %>
+ ERB
+ end
+
+ test "compilation with optimize for link_to" do
+ assert_compiled_snapshot('<%= link_to "Home", "/" %>', optimize: true)
+ end
+
+ test "compilation with optimize for image_tag" do
+ assert_compiled_snapshot('<%= image_tag "photo.jpg", alt: "Photo" %>', optimize: true)
+ end
+
+ test "compilation with optimize for content_tag" do
+ assert_compiled_snapshot('<%= content_tag :div, "Content", class: "box" %>', optimize: true)
+ end
+
+ test "compilation with optimize preserves non-helper ERB" do
+ assert_compiled_snapshot(<<~ERB, optimize: true)
+
<%= title %>
+ <%= tag.div class: "content" do %>
+
<%= body %>
+ <% end %>
+ ERB
+ end
+
+ test "compilation with optimize for tag with dynamic attribute" do
+ assert_compiled_snapshot("<%= tag.div class: css_class %>", optimize: true)
+ end
+
+ test "compilation without optimize leaves tag helpers as Ruby calls" do
+ template = '<%= tag.div class: "container" do %>Content<% end %>'
+
+ without_optimize = Herb::Engine.new(template).src
+ with_optimize = Herb::Engine.new(template, optimize: true).src
+
+ refute_equal without_optimize, with_optimize
+ assert_includes without_optimize, "tag.div"
+ refute_includes with_optimize, "tag.div"
+ end
+
+ test "compilation with parser_options strict false" do
+ assert_compiled_snapshot("
Hello
", parser_options: { strict: false })
+ end
end
end
diff --git a/test/engine/evaluation/case_test.rb b/test/engine/evaluation/case_test.rb
index 4986c1483..09b6b5f88 100644
--- a/test/engine/evaluation/case_test.rb
+++ b/test/engine/evaluation/case_test.rb
@@ -20,14 +20,14 @@ class CaseTest < Minitest::Spec
ERB
error = assert_raises(Herb::Engine::CompilationError) do
- Herb::Engine.new(template, strict: true)
+ Herb::Engine.new(template, parser_options: { strict: true })
end
assert_includes error.message, "ERBCaseWithConditions"
- assert_evaluated_snapshot(template, { status: "pending" }, { escape: false, strict: false })
- assert_evaluated_snapshot(template, { status: "approved" }, { escape: false, strict: false })
- assert_evaluated_snapshot(template, { status: "other" }, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, { status: "pending" }, { escape: false, parser_options: { strict: false } })
+ assert_evaluated_snapshot(template, { status: "approved" }, { escape: false, parser_options: { strict: false } })
+ assert_evaluated_snapshot(template, { status: "other" }, { escape: false, parser_options: { strict: false } })
end
test "case in pattern in same ERB tag" do
@@ -42,7 +42,7 @@ class CaseTest < Minitest::Spec
ERB
error = assert_raises(Herb::Engine::CompilationError) do
- Herb::Engine.new(template, strict: true)
+ Herb::Engine.new(template, parser_options: { strict: true })
end
assert_includes error.message, "ERBCaseWithConditions"
@@ -59,13 +59,13 @@ class CaseTest < Minitest::Spec
ERB
error = assert_raises(Herb::Engine::CompilationError) do
- Herb::Engine.new(template, strict: true)
+ Herb::Engine.new(template, parser_options: { strict: true })
end
assert_includes error.message, "ERBCaseWithConditions"
- assert_evaluated_snapshot(template, { status: "pending" }, { escape: false, strict: false })
- assert_evaluated_snapshot(template, { status: "approved" }, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, { status: "pending" }, { escape: false, parser_options: { strict: false } })
+ assert_evaluated_snapshot(template, { status: "approved" }, { escape: false, parser_options: { strict: false } })
end
test "case in on newline in same ERB tag" do
@@ -79,13 +79,13 @@ class CaseTest < Minitest::Spec
ERB
error = assert_raises(Herb::Engine::CompilationError) do
- Herb::Engine.new(template, strict: true)
+ Herb::Engine.new(template, parser_options: { strict: true })
end
assert_includes error.message, "ERBCaseWithConditions"
- assert_evaluated_snapshot(template, { count: 1 }, { escape: false, strict: false })
- assert_evaluated_snapshot(template, { count: 2 }, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, { count: 1 }, { escape: false, parser_options: { strict: false } })
+ assert_evaluated_snapshot(template, { count: 2 }, { escape: false, parser_options: { strict: false } })
end
end
end
diff --git a/test/engine/optional_closing_tags_test.rb b/test/engine/optional_closing_tags_test.rb
index 1abbe7df7..7dae189a9 100644
--- a/test/engine/optional_closing_tags_test.rb
+++ b/test/engine/optional_closing_tags_test.rb
@@ -12,25 +12,25 @@ class OptionalClosingTagsTest < Minitest::Spec
test "p element without closing tag - compilation" do
template = "
Hello World"
- assert_compiled_snapshot(template, strict: false)
+ assert_compiled_snapshot(template, parser_options: { strict: false })
end
test "p element without closing tag - render" do
template = "
Hello World"
- assert_evaluated_snapshot(template, {}, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, {}, { escape: false, parser_options: { strict: false } })
end
test "p element with erb without closing tag - compilation" do
template = "
<%= message %>"
- assert_compiled_snapshot(template, strict: false)
+ assert_compiled_snapshot(template, parser_options: { strict: false })
end
test "p element with erb without closing tag - render" do
template = "
<%= message %>"
- assert_evaluated_snapshot(template, { message: "Hello" }, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, { message: "Hello" }, { escape: false, parser_options: { strict: false } })
end
test "multiple p elements without closing tags - compilation" do
@@ -40,7 +40,7 @@ class OptionalClosingTagsTest < Minitest::Spec
Third paragraph
ERB
- assert_compiled_snapshot(template, strict: false)
+ assert_compiled_snapshot(template, parser_options: { strict: false })
end
test "multiple p elements without closing tags - render" do
@@ -50,7 +50,7 @@ class OptionalClosingTagsTest < Minitest::Spec
Third paragraph
ERB
- assert_evaluated_snapshot(template, {}, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, {}, { escape: false, parser_options: { strict: false } })
end
# LI element tests
@@ -63,7 +63,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_compiled_snapshot(template, strict: false)
+ assert_compiled_snapshot(template, parser_options: { strict: false })
end
test "li elements without closing tags - render" do
@@ -75,7 +75,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_evaluated_snapshot(template, {}, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, {}, { escape: false, parser_options: { strict: false } })
end
test "li elements with erb without closing tags - compilation" do
@@ -87,7 +87,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_compiled_snapshot(template, strict: false)
+ assert_compiled_snapshot(template, parser_options: { strict: false })
end
test "li elements with erb without closing tags - render" do
@@ -99,7 +99,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_evaluated_snapshot(template, { items: ["Apple", "Banana", "Cherry"] }, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, { items: ["Apple", "Banana", "Cherry"] }, { escape: false, parser_options: { strict: false } })
end
# DT/DD element tests
@@ -113,7 +113,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_compiled_snapshot(template, strict: false)
+ assert_compiled_snapshot(template, parser_options: { strict: false })
end
test "dt and dd elements without closing tags - render" do
@@ -126,7 +126,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_evaluated_snapshot(template, {}, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, {}, { escape: false, parser_options: { strict: false } })
end
# Option element tests
@@ -139,7 +139,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_compiled_snapshot(template, strict: false)
+ assert_compiled_snapshot(template, parser_options: { strict: false })
end
test "option elements without closing tags - render" do
@@ -151,7 +151,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_evaluated_snapshot(template, {}, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, {}, { escape: false, parser_options: { strict: false } })
end
test "option elements with erb without closing tags - compilation" do
@@ -163,7 +163,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_compiled_snapshot(template, strict: false)
+ assert_compiled_snapshot(template, parser_options: { strict: false })
end
test "option elements with erb without closing tags - render" do
@@ -181,7 +181,7 @@ class OptionalClosingTagsTest < Minitest::Spec
{ value: "3", label: "Three" }
]
- assert_evaluated_snapshot(template, { select_options: select_options }, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, { select_options: select_options }, { escape: false, parser_options: { strict: false } })
end
# Optgroup element tests
@@ -197,7 +197,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_compiled_snapshot(template, strict: false)
+ assert_compiled_snapshot(template, parser_options: { strict: false })
end
test "optgroup elements without closing tags - render" do
@@ -212,7 +212,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_evaluated_snapshot(template, {}, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, {}, { escape: false, parser_options: { strict: false } })
end
# Table element tests
@@ -228,7 +228,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_compiled_snapshot(template, strict: false)
+ assert_compiled_snapshot(template, parser_options: { strict: false })
end
test "tr elements without closing tags - render" do
@@ -243,7 +243,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_evaluated_snapshot(template, {}, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, {}, { escape: false, parser_options: { strict: false } })
end
test "td and th elements without closing tags - compilation" do
@@ -258,7 +258,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_compiled_snapshot(template, strict: false)
+ assert_compiled_snapshot(template, parser_options: { strict: false })
end
test "td and th elements without closing tags - render" do
@@ -273,7 +273,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_evaluated_snapshot(template, {}, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, {}, { escape: false, parser_options: { strict: false } })
end
test "thead tbody tfoot without closing tags - compilation" do
@@ -288,7 +288,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_compiled_snapshot(template, strict: false)
+ assert_compiled_snapshot(template, parser_options: { strict: false })
end
test "thead tbody tfoot without closing tags - render" do
@@ -303,7 +303,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_evaluated_snapshot(template, {}, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, {}, { escape: false, parser_options: { strict: false } })
end
# Colgroup element tests
@@ -319,7 +319,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_compiled_snapshot(template, strict: false)
+ assert_compiled_snapshot(template, parser_options: { strict: false })
end
test "colgroup element without closing tag - render" do
@@ -334,7 +334,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_evaluated_snapshot(template, {}, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, {}, { escape: false, parser_options: { strict: false } })
end
# RT/RP element tests
@@ -348,7 +348,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_compiled_snapshot(template, strict: false)
+ assert_compiled_snapshot(template, parser_options: { strict: false })
end
test "rt and rp elements without closing tags - render" do
@@ -361,7 +361,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_evaluated_snapshot(template, {}, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, {}, { escape: false, parser_options: { strict: false } })
end
# Complex mixed tests
@@ -385,7 +385,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_compiled_snapshot(template, strict: false)
+ assert_compiled_snapshot(template, parser_options: { strict: false })
end
test "complex form with optional closing tags - render" do
@@ -408,7 +408,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_evaluated_snapshot(template, {}, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, {}, { escape: false, parser_options: { strict: false } })
end
test "erb loop with li elements without closing tags - compilation" do
@@ -423,7 +423,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_compiled_snapshot(template, strict: false)
+ assert_compiled_snapshot(template, parser_options: { strict: false })
end
test "erb loop with li elements without closing tags - render" do
@@ -444,7 +444,7 @@ class OptionalClosingTagsTest < Minitest::Spec
{ name: "Contact", url: "/contact" }
]
- assert_evaluated_snapshot(template, { items: items }, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, { items: items }, { escape: false, parser_options: { strict: false } })
end
test "table with erb and optional closing tags - compilation" do
@@ -465,7 +465,7 @@ class OptionalClosingTagsTest < Minitest::Spec
ERB
- assert_compiled_snapshot(template, strict: false)
+ assert_compiled_snapshot(template, parser_options: { strict: false })
end
test "table with erb and optional closing tags - render" do
@@ -492,7 +492,7 @@ class OptionalClosingTagsTest < Minitest::Spec
{ name: "Charlie", age: 35, city: "Paris" }
]
- assert_evaluated_snapshot(template, { users: users }, { escape: false, strict: false })
+ assert_evaluated_snapshot(template, { users: users }, { escape: false, parser_options: { strict: false } })
end
end
end
diff --git a/test/snapshots/engine/case_test/test_0001_case_when_in_same_ERB_tag_9b671780f0459813359368a1df6afaff.txt b/test/snapshots/engine/case_test/test_0001_case_when_in_same_ERB_tag_0eddb9ef12fb70b805280ec2dd18463d.txt
similarity index 75%
rename from test/snapshots/engine/case_test/test_0001_case_when_in_same_ERB_tag_9b671780f0459813359368a1df6afaff.txt
rename to test/snapshots/engine/case_test/test_0001_case_when_in_same_ERB_tag_0eddb9ef12fb70b805280ec2dd18463d.txt
index 8d21f45c0..421417774 100644
--- a/test/snapshots/engine/case_test/test_0001_case_when_in_same_ERB_tag_9b671780f0459813359368a1df6afaff.txt
+++ b/test/snapshots/engine/case_test/test_0001_case_when_in_same_ERB_tag_0eddb9ef12fb70b805280ec2dd18463d.txt
@@ -1,5 +1,5 @@
---
source: "Engine::CaseTest#test_0001_case when in same ERB tag"
-input: "{source: \"<% case status when \\\"pending\\\" %>\\n Pending\\n<% when \\\"approved\\\" %>\\n Approved\\n<% else %>\\n Unknown\\n<% end %>\\n\", locals: {status: \"other\"}, options: {escape: false, strict: false}}"
+input: "{source: \"<% case status when \\\"pending\\\" %>\\n Pending\\n<% when \\\"approved\\\" %>\\n Approved\\n<% else %>\\n Unknown\\n<% end %>\\n\", locals: {status: \"other\"}, options: {escape: false, parser_options: {strict: false}}}"
---
Unknown
diff --git a/test/snapshots/engine/case_test/test_0001_case_when_in_same_ERB_tag_6ca15c3a9293976c06d3d4e1421980f9.txt b/test/snapshots/engine/case_test/test_0001_case_when_in_same_ERB_tag_2636e2d7a674dab787301172d263d11b.txt
similarity index 75%
rename from test/snapshots/engine/case_test/test_0001_case_when_in_same_ERB_tag_6ca15c3a9293976c06d3d4e1421980f9.txt
rename to test/snapshots/engine/case_test/test_0001_case_when_in_same_ERB_tag_2636e2d7a674dab787301172d263d11b.txt
index 6a98a89c3..33eecfd9d 100644
--- a/test/snapshots/engine/case_test/test_0001_case_when_in_same_ERB_tag_6ca15c3a9293976c06d3d4e1421980f9.txt
+++ b/test/snapshots/engine/case_test/test_0001_case_when_in_same_ERB_tag_2636e2d7a674dab787301172d263d11b.txt
@@ -1,5 +1,5 @@
---
source: "Engine::CaseTest#test_0001_case when in same ERB tag"
-input: "{source: \"<% case status when \\\"pending\\\" %>\\n Pending\\n<% when \\\"approved\\\" %>\\n Approved\\n<% else %>\\n Unknown\\n<% end %>\\n\", locals: {status: \"approved\"}, options: {escape: false, strict: false}}"
+input: "{source: \"<% case status when \\\"pending\\\" %>\\n Pending\\n<% when \\\"approved\\\" %>\\n Approved\\n<% else %>\\n Unknown\\n<% end %>\\n\", locals: {status: \"approved\"}, options: {escape: false, parser_options: {strict: false}}}"
---
Approved
diff --git a/test/snapshots/engine/case_test/test_0001_case_when_in_same_ERB_tag_23aed430da2e0530eba76d6ff44d4f48.txt b/test/snapshots/engine/case_test/test_0001_case_when_in_same_ERB_tag_a8a2e5aa1cc6744b026f5253b85a84ac.txt
similarity index 75%
rename from test/snapshots/engine/case_test/test_0001_case_when_in_same_ERB_tag_23aed430da2e0530eba76d6ff44d4f48.txt
rename to test/snapshots/engine/case_test/test_0001_case_when_in_same_ERB_tag_a8a2e5aa1cc6744b026f5253b85a84ac.txt
index 5b0b0a5a2..eea79a125 100644
--- a/test/snapshots/engine/case_test/test_0001_case_when_in_same_ERB_tag_23aed430da2e0530eba76d6ff44d4f48.txt
+++ b/test/snapshots/engine/case_test/test_0001_case_when_in_same_ERB_tag_a8a2e5aa1cc6744b026f5253b85a84ac.txt
@@ -1,5 +1,5 @@
---
source: "Engine::CaseTest#test_0001_case when in same ERB tag"
-input: "{source: \"<% case status when \\\"pending\\\" %>\\n Pending\\n<% when \\\"approved\\\" %>\\n Approved\\n<% else %>\\n Unknown\\n<% end %>\\n\", locals: {status: \"pending\"}, options: {escape: false, strict: false}}"
+input: "{source: \"<% case status when \\\"pending\\\" %>\\n Pending\\n<% when \\\"approved\\\" %>\\n Approved\\n<% else %>\\n Unknown\\n<% end %>\\n\", locals: {status: \"pending\"}, options: {escape: false, parser_options: {strict: false}}}"
---
Pending
diff --git a/test/snapshots/engine/case_test/test_0003_case_when_on_newline_in_same_ERB_tag_811ef7173169870133e367deaede4fe4.txt b/test/snapshots/engine/case_test/test_0003_case_when_on_newline_in_same_ERB_tag_73caef3dd6a5fc2624302fe19b86aca4.txt
similarity index 82%
rename from test/snapshots/engine/case_test/test_0003_case_when_on_newline_in_same_ERB_tag_811ef7173169870133e367deaede4fe4.txt
rename to test/snapshots/engine/case_test/test_0003_case_when_on_newline_in_same_ERB_tag_73caef3dd6a5fc2624302fe19b86aca4.txt
index 9a3f716dd..6d5c1f63c 100644
--- a/test/snapshots/engine/case_test/test_0003_case_when_on_newline_in_same_ERB_tag_811ef7173169870133e367deaede4fe4.txt
+++ b/test/snapshots/engine/case_test/test_0003_case_when_on_newline_in_same_ERB_tag_73caef3dd6a5fc2624302fe19b86aca4.txt
@@ -1,5 +1,5 @@
---
source: "Engine::CaseTest#test_0003_case when on newline in same ERB tag"
-input: "{source: \"<% case status\\n when \\\"pending\\\" %>\\n Pending\\n<% when \\\"approved\\\" %>\\n Approved\\n<% end %>\\n\", locals: {status: \"approved\"}, options: {escape: false, strict: false}}"
+input: "{source: \"<% case status\\n when \\\"pending\\\" %>\\n Pending\\n<% when \\\"approved\\\" %>\\n Approved\\n<% end %>\\n\", locals: {status: \"approved\"}, options: {escape: false, parser_options: {strict: false}}}"
---
Approved
diff --git a/test/snapshots/engine/case_test/test_0003_case_when_on_newline_in_same_ERB_tag_ab777e9f2c3de2a5939a0bc885c8d74c.txt b/test/snapshots/engine/case_test/test_0003_case_when_on_newline_in_same_ERB_tag_8a652e072831c8a4a5465ef79215983b.txt
similarity index 82%
rename from test/snapshots/engine/case_test/test_0003_case_when_on_newline_in_same_ERB_tag_ab777e9f2c3de2a5939a0bc885c8d74c.txt
rename to test/snapshots/engine/case_test/test_0003_case_when_on_newline_in_same_ERB_tag_8a652e072831c8a4a5465ef79215983b.txt
index 1bbfc8c06..12615612a 100644
--- a/test/snapshots/engine/case_test/test_0003_case_when_on_newline_in_same_ERB_tag_ab777e9f2c3de2a5939a0bc885c8d74c.txt
+++ b/test/snapshots/engine/case_test/test_0003_case_when_on_newline_in_same_ERB_tag_8a652e072831c8a4a5465ef79215983b.txt
@@ -1,5 +1,5 @@
---
source: "Engine::CaseTest#test_0003_case when on newline in same ERB tag"
-input: "{source: \"<% case status\\n when \\\"pending\\\" %>\\n Pending\\n<% when \\\"approved\\\" %>\\n Approved\\n<% end %>\\n\", locals: {status: \"pending\"}, options: {escape: false, strict: false}}"
+input: "{source: \"<% case status\\n when \\\"pending\\\" %>\\n Pending\\n<% when \\\"approved\\\" %>\\n Approved\\n<% end %>\\n\", locals: {status: \"pending\"}, options: {escape: false, parser_options: {strict: false}}}"
---
Pending
diff --git a/test/snapshots/engine/case_test/test_0004_case_in_on_newline_in_same_ERB_tag_0a592ed5a885b7022e49432c323b8991.txt b/test/snapshots/engine/case_test/test_0004_case_in_on_newline_in_same_ERB_tag_c691696af38bbf837d550c1cbc8f2b05.txt
similarity index 76%
rename from test/snapshots/engine/case_test/test_0004_case_in_on_newline_in_same_ERB_tag_0a592ed5a885b7022e49432c323b8991.txt
rename to test/snapshots/engine/case_test/test_0004_case_in_on_newline_in_same_ERB_tag_c691696af38bbf837d550c1cbc8f2b05.txt
index 21efc17c5..d34d2e47a 100644
--- a/test/snapshots/engine/case_test/test_0004_case_in_on_newline_in_same_ERB_tag_0a592ed5a885b7022e49432c323b8991.txt
+++ b/test/snapshots/engine/case_test/test_0004_case_in_on_newline_in_same_ERB_tag_c691696af38bbf837d550c1cbc8f2b05.txt
@@ -1,5 +1,5 @@
---
source: "Engine::CaseTest#test_0004_case in on newline in same ERB tag"
-input: "{source: \"<% case count\\n in 1 %>\\n One\\n<% in 2 %>\\n Two\\n<% end %>\\n\", locals: {count: 1}, options: {escape: false, strict: false}}"
+input: "{source: \"<% case count\\n in 1 %>\\n One\\n<% in 2 %>\\n Two\\n<% end %>\\n\", locals: {count: 1}, options: {escape: false, parser_options: {strict: false}}}"
---
One
diff --git a/test/snapshots/engine/case_test/test_0004_case_in_on_newline_in_same_ERB_tag_efdcbb5c5c9196a57d4695520c828efc.txt b/test/snapshots/engine/case_test/test_0004_case_in_on_newline_in_same_ERB_tag_d3aba77d93a02638edfcd9347131054d.txt
similarity index 76%
rename from test/snapshots/engine/case_test/test_0004_case_in_on_newline_in_same_ERB_tag_efdcbb5c5c9196a57d4695520c828efc.txt
rename to test/snapshots/engine/case_test/test_0004_case_in_on_newline_in_same_ERB_tag_d3aba77d93a02638edfcd9347131054d.txt
index 90ab63bea..15e213891 100644
--- a/test/snapshots/engine/case_test/test_0004_case_in_on_newline_in_same_ERB_tag_efdcbb5c5c9196a57d4695520c828efc.txt
+++ b/test/snapshots/engine/case_test/test_0004_case_in_on_newline_in_same_ERB_tag_d3aba77d93a02638edfcd9347131054d.txt
@@ -1,5 +1,5 @@
---
source: "Engine::CaseTest#test_0004_case in on newline in same ERB tag"
-input: "{source: \"<% case count\\n in 1 %>\\n One\\n<% in 2 %>\\n Two\\n<% end %>\\n\", locals: {count: 2}, options: {escape: false, strict: false}}"
+input: "{source: \"<% case count\\n in 1 %>\\n One\\n<% in 2 %>\\n Two\\n<% end %>\\n\", locals: {count: 2}, options: {escape: false, parser_options: {strict: false}}}"
---
Two
diff --git a/test/snapshots/engine/engine_test/test_0029_compilation_with_optimize_for_tag_helper_55278e8ccf68e47a935e7a41e5c86f88.txt b/test/snapshots/engine/engine_test/test_0029_compilation_with_optimize_for_tag_helper_55278e8ccf68e47a935e7a41e5c86f88.txt
new file mode 100644
index 000000000..d25972bf1
--- /dev/null
+++ b/test/snapshots/engine/engine_test/test_0029_compilation_with_optimize_for_tag_helper_55278e8ccf68e47a935e7a41e5c86f88.txt
@@ -0,0 +1,6 @@
+---
+source: "Engine::EngineTest#test_0029_compilation with optimize for tag helper"
+input: "{source: \"<%= tag.div class: \\\"container\\\" do %>Content<% end %>\", options: {optimize: true}}"
+---
+_buf = ::String.new; _buf << '
Content
'.freeze;
+_buf.to_s
diff --git a/test/snapshots/engine/engine_test/test_0030_compilation_with_optimize_for_void_element_5a77a2ee1a7a3bc29a1bce98b38a23fa.txt b/test/snapshots/engine/engine_test/test_0030_compilation_with_optimize_for_void_element_5a77a2ee1a7a3bc29a1bce98b38a23fa.txt
new file mode 100644
index 000000000..19020ed77
--- /dev/null
+++ b/test/snapshots/engine/engine_test/test_0030_compilation_with_optimize_for_void_element_5a77a2ee1a7a3bc29a1bce98b38a23fa.txt
@@ -0,0 +1,6 @@
+---
+source: "Engine::EngineTest#test_0030_compilation with optimize for void element"
+input: "{source: \"<%= tag.br %>\", options: {optimize: true}}"
+---
+_buf = ::String.new; _buf << ' '.freeze;
+_buf.to_s
diff --git a/test/snapshots/engine/engine_test/test_0031_compilation_with_optimize_for_tag_with_data_attributes_ad93815539b35b7774a6f070205cd2a1.txt b/test/snapshots/engine/engine_test/test_0031_compilation_with_optimize_for_tag_with_data_attributes_ad93815539b35b7774a6f070205cd2a1.txt
new file mode 100644
index 000000000..2891f59a1
--- /dev/null
+++ b/test/snapshots/engine/engine_test/test_0031_compilation_with_optimize_for_tag_with_data_attributes_ad93815539b35b7774a6f070205cd2a1.txt
@@ -0,0 +1,6 @@
+---
+source: "Engine::EngineTest#test_0031_compilation with optimize for tag with data attributes"
+input: "{source: \"<%= tag.div data: { controller: \\\"content\\\", count: 42 } %>\", options: {optimize: true}}"
+---
+_buf = ::String.new; _buf << ''.freeze;
+_buf.to_s
diff --git a/test/snapshots/engine/engine_test/test_0032_compilation_with_optimize_for_nested_tag_helpers_d5b68e2c70db789e5d331c855637d649.txt b/test/snapshots/engine/engine_test/test_0032_compilation_with_optimize_for_nested_tag_helpers_d5b68e2c70db789e5d331c855637d649.txt
new file mode 100644
index 000000000..b91a90e0f
--- /dev/null
+++ b/test/snapshots/engine/engine_test/test_0032_compilation_with_optimize_for_nested_tag_helpers_d5b68e2c70db789e5d331c855637d649.txt
@@ -0,0 +1,8 @@
+---
+source: "Engine::EngineTest#test_0032_compilation with optimize for nested tag helpers"
+input: "{source: \"<%= tag.div class: \\\"outer\\\" do %>\\n <%= tag.span \\\"Inner\\\" %>\\n<% end %>\\n\", options: {optimize: true}}"
+---
+_buf = ::String.new; _buf << '
Hello World
\ No newline at end of file
diff --git a/test/snapshots/engine/optional_closing_tags_test/test_0003_p_element_with_erb_without_closing_tag_-_compilation_b2ceb0139e20d5d1525bd36b5b5737c2.txt b/test/snapshots/engine/optional_closing_tags_test/test_0003_p_element_with_erb_without_closing_tag_-_compilation_cc3fa5cc0184ac4e9c56493736f5d49f.txt
similarity index 69%
rename from test/snapshots/engine/optional_closing_tags_test/test_0003_p_element_with_erb_without_closing_tag_-_compilation_b2ceb0139e20d5d1525bd36b5b5737c2.txt
rename to test/snapshots/engine/optional_closing_tags_test/test_0003_p_element_with_erb_without_closing_tag_-_compilation_cc3fa5cc0184ac4e9c56493736f5d49f.txt
index 60bd24748..8369b6aed 100644
--- a/test/snapshots/engine/optional_closing_tags_test/test_0003_p_element_with_erb_without_closing_tag_-_compilation_b2ceb0139e20d5d1525bd36b5b5737c2.txt
+++ b/test/snapshots/engine/optional_closing_tags_test/test_0003_p_element_with_erb_without_closing_tag_-_compilation_cc3fa5cc0184ac4e9c56493736f5d49f.txt
@@ -1,6 +1,6 @@
---
source: "Engine::OptionalClosingTagsTest#test_0003_p element with erb without closing tag - compilation"
-input: "{source: \"
Hello
\ No newline at end of file
diff --git a/test/snapshots/engine/optional_closing_tags_test/test_0005_multiple_p_elements_without_closing_tags_-_compilation_885d84d2735c11f1c821f10ca72dab83.txt b/test/snapshots/engine/optional_closing_tags_test/test_0005_multiple_p_elements_without_closing_tags_-_compilation_fede73eaad4535d15f9b2261181e9fc6.txt
similarity index 80%
rename from test/snapshots/engine/optional_closing_tags_test/test_0005_multiple_p_elements_without_closing_tags_-_compilation_885d84d2735c11f1c821f10ca72dab83.txt
rename to test/snapshots/engine/optional_closing_tags_test/test_0005_multiple_p_elements_without_closing_tags_-_compilation_fede73eaad4535d15f9b2261181e9fc6.txt
index 0a6c62b43..47399b33c 100644
--- a/test/snapshots/engine/optional_closing_tags_test/test_0005_multiple_p_elements_without_closing_tags_-_compilation_885d84d2735c11f1c821f10ca72dab83.txt
+++ b/test/snapshots/engine/optional_closing_tags_test/test_0005_multiple_p_elements_without_closing_tags_-_compilation_fede73eaad4535d15f9b2261181e9fc6.txt
@@ -1,6 +1,6 @@
---
source: "Engine::OptionalClosingTagsTest#test_0005_multiple p elements without closing tags - compilation"
-input: "{source: \"
First paragraph\\n
Second paragraph\\n
Third paragraph\\n\", options: {strict: false}}"
+input: "{source: \"
Second paragraph
diff --git a/test/snapshots/engine/optional_closing_tags_test/test_0006_multiple_p_elements_without_closing_tags_-_render_1447c4fa5edb2ea19577d8be36339630.txt b/test/snapshots/engine/optional_closing_tags_test/test_0006_multiple_p_elements_without_closing_tags_-_render_bf5334dbabb9ab9dde61638883c4e70c.txt
similarity index 70%
rename from test/snapshots/engine/optional_closing_tags_test/test_0006_multiple_p_elements_without_closing_tags_-_render_1447c4fa5edb2ea19577d8be36339630.txt
rename to test/snapshots/engine/optional_closing_tags_test/test_0006_multiple_p_elements_without_closing_tags_-_render_bf5334dbabb9ab9dde61638883c4e70c.txt
index 73db5d434..171553691 100644
--- a/test/snapshots/engine/optional_closing_tags_test/test_0006_multiple_p_elements_without_closing_tags_-_render_1447c4fa5edb2ea19577d8be36339630.txt
+++ b/test/snapshots/engine/optional_closing_tags_test/test_0006_multiple_p_elements_without_closing_tags_-_render_bf5334dbabb9ab9dde61638883c4e70c.txt
@@ -1,6 +1,6 @@
---
source: "Engine::OptionalClosingTagsTest#test_0006_multiple p elements without closing tags - render"
-input: "{source: \"
Apple
diff --git a/test/snapshots/engine/optional_closing_tags_test/test_0011_dt_and_dd_elements_without_closing_tags_-_compilation_c0035931ff5d7247e8b5c75c0d22be57.txt b/test/snapshots/engine/optional_closing_tags_test/test_0011_dt_and_dd_elements_without_closing_tags_-_compilation_5d925e9dcfbb9a77531abd83484c3198.txt
similarity index 76%
rename from test/snapshots/engine/optional_closing_tags_test/test_0011_dt_and_dd_elements_without_closing_tags_-_compilation_c0035931ff5d7247e8b5c75c0d22be57.txt
rename to test/snapshots/engine/optional_closing_tags_test/test_0011_dt_and_dd_elements_without_closing_tags_-_compilation_5d925e9dcfbb9a77531abd83484c3198.txt
index 5ba016864..961e4b813 100644
--- a/test/snapshots/engine/optional_closing_tags_test/test_0011_dt_and_dd_elements_without_closing_tags_-_compilation_c0035931ff5d7247e8b5c75c0d22be57.txt
+++ b/test/snapshots/engine/optional_closing_tags_test/test_0011_dt_and_dd_elements_without_closing_tags_-_compilation_5d925e9dcfbb9a77531abd83484c3198.txt
@@ -1,6 +1,6 @@
---
source: "Engine::OptionalClosingTagsTest#test_0011_dt and dd elements without closing tags - compilation"
-input: "{source: \"
Term 1
diff --git a/test/snapshots/engine/optional_closing_tags_test/test_0012_dt_and_dd_elements_without_closing_tags_-_render_2fdefd7703bc4eccb752939b768cb613.txt b/test/snapshots/engine/optional_closing_tags_test/test_0012_dt_and_dd_elements_without_closing_tags_-_render_5cbc93ad18f892712f071267b80d36a9.txt
similarity index 85%
rename from test/snapshots/engine/optional_closing_tags_test/test_0012_dt_and_dd_elements_without_closing_tags_-_render_2fdefd7703bc4eccb752939b768cb613.txt
rename to test/snapshots/engine/optional_closing_tags_test/test_0012_dt_and_dd_elements_without_closing_tags_-_render_5cbc93ad18f892712f071267b80d36a9.txt
index b009e98f8..61ac7f609 100644
--- a/test/snapshots/engine/optional_closing_tags_test/test_0012_dt_and_dd_elements_without_closing_tags_-_render_2fdefd7703bc4eccb752939b768cb613.txt
+++ b/test/snapshots/engine/optional_closing_tags_test/test_0012_dt_and_dd_elements_without_closing_tags_-_render_5cbc93ad18f892712f071267b80d36a9.txt
@@ -1,6 +1,6 @@
---
source: "Engine::OptionalClosingTagsTest#test_0012_dt and dd elements without closing tags - render"
-input: "{source: \"