From 06b39f6dfb82f39113e792753d4db91a8b3057f9 Mon Sep 17 00:00:00 2001 From: Marco Roth Date: Sun, 9 Nov 2025 03:38:02 +0100 Subject: [PATCH] Engine: Don't compile `<% # coments %>` --- lib/herb/ast/helpers.rb | 11 +++ lib/herb/engine/compiler.rb | 2 + sig/herb/ast/helpers.rbs | 3 + test/engine/erb_comments_test.rb | 83 +++++++++++++++++++ test/engine/evaluation_test.rb | 36 ++++++++ ..._line_ece56a54ce9835acc67012583c42fc01.txt | 7 ++ ...wline_32dd50121c8e2af22b8a7e5efd92940f.txt | 8 ++ ..._code_987d6e126382f02311aa0c1a0e0007bc.txt | 7 ++ ..._code_d6e28172fd69bf4538744950bffb2848.txt | 7 ++ ...paces_a1f69e41bb63eacbc881533c704e17a4.txt | 7 ++ ...iline_1dc1e842d2fb5a2484c2e2fa0eca3678.txt | 9 ++ ..._line_da1ad954cfb3b204db6e91dd6fa35de7.txt | 4 + ...wline_3519273b500925a720622d82288e0a31.txt | 5 ++ ..._code_2788ca7a784e1295299a8d85ec9e396d.txt | 5 ++ ..._code_13d746f9eef6690df9a609b4349a5189.txt | 5 ++ ...paces_403e802d2a1c4f738b359fc3eee74053.txt | 5 ++ ...iline_c4d3ea038c11a5575430ca4b14abff47.txt | 5 ++ ..._line_ad303bca1e8d22f5b16ec13f3c664241.txt | 4 + ...wline_9abf0cb2099f40dfd7f4dfd3bfe1cc76.txt | 5 ++ ..._code_846a700430f96166237a051e3fca1bed.txt | 5 ++ ..._code_033a23daedac7be2427e58914b665c0f.txt | 5 ++ ...paces_c05d8f81793b59bea0ce93cf959bcfbe.txt | 5 ++ ...iline_d65c4c66f63611e90c0ea96b74af1ce4.txt | 5 ++ ...ation_2b3c4e3c244db77468813a7472298e82.txt | 1 - 24 files changed, 238 insertions(+), 1 deletion(-) create mode 100644 test/engine/erb_comments_test.rb create mode 100644 test/snapshots/engine/erb_comments_test/test_0001_inline_ruby_comment_on_same_line_ece56a54ce9835acc67012583c42fc01.txt create mode 100644 test/snapshots/engine/erb_comments_test/test_0002_inline_ruby_comment_with_newline_32dd50121c8e2af22b8a7e5efd92940f.txt create mode 100644 test/snapshots/engine/erb_comments_test/test_0003_inline_ruby_comment_between_code_987d6e126382f02311aa0c1a0e0007bc.txt create mode 100644 test/snapshots/engine/erb_comments_test/test_0004_inline_ruby_comment_before_and_between_code_d6e28172fd69bf4538744950bffb2848.txt create mode 100644 test/snapshots/engine/erb_comments_test/test_0005_inline_ruby_comment_with_spaces_a1f69e41bb63eacbc881533c704e17a4.txt create mode 100644 test/snapshots/engine/erb_comments_test/test_0006_inline_ruby_comment_multiline_1dc1e842d2fb5a2484c2e2fa0eca3678.txt create mode 100644 test/snapshots/engine/erb_comments_test/test_0007_evaluation_inline_ruby_comment_on_same_line_da1ad954cfb3b204db6e91dd6fa35de7.txt create mode 100644 test/snapshots/engine/erb_comments_test/test_0008_evaluation_inline_ruby_comment_with_newline_3519273b500925a720622d82288e0a31.txt create mode 100644 test/snapshots/engine/erb_comments_test/test_0009_evaluation_inline_ruby_comment_between_code_2788ca7a784e1295299a8d85ec9e396d.txt create mode 100644 test/snapshots/engine/erb_comments_test/test_0010_evaluation_inline_ruby_comment_before_and_between_code_13d746f9eef6690df9a609b4349a5189.txt create mode 100644 test/snapshots/engine/erb_comments_test/test_0011_evaluation_inline_ruby_comment_with_spaces_403e802d2a1c4f738b359fc3eee74053.txt create mode 100644 test/snapshots/engine/erb_comments_test/test_0012_evaluation_inline_ruby_comment_multiline_c4d3ea038c11a5575430ca4b14abff47.txt create mode 100644 test/snapshots/engine/evaluation_test/test_0025_inline_ruby_comment_on_same_line_ad303bca1e8d22f5b16ec13f3c664241.txt create mode 100644 test/snapshots/engine/evaluation_test/test_0026_inline_ruby_comment_with_newline_9abf0cb2099f40dfd7f4dfd3bfe1cc76.txt create mode 100644 test/snapshots/engine/evaluation_test/test_0027_inline_ruby_comment_between_code_846a700430f96166237a051e3fca1bed.txt create mode 100644 test/snapshots/engine/evaluation_test/test_0028_inline_ruby_comment_before_and_between_code_033a23daedac7be2427e58914b665c0f.txt create mode 100644 test/snapshots/engine/evaluation_test/test_0029_inline_ruby_comment_with_spaces_c05d8f81793b59bea0ce93cf959bcfbe.txt create mode 100644 test/snapshots/engine/evaluation_test/test_0030_inline_ruby_comment_multiline_d65c4c66f63611e90c0ea96b74af1ce4.txt diff --git a/lib/herb/ast/helpers.rb b/lib/herb/ast/helpers.rb index 2ddef5355..a24637261 100644 --- a/lib/herb/ast/helpers.rb +++ b/lib/herb/ast/helpers.rb @@ -21,6 +21,17 @@ def erb_comment?(opening) def erb_output?(opening) opening.include?("=") end + + #: (Herb::AST::ERBContentNode) -> bool + def inline_ruby_comment?(node) + return false unless node.is_a?(Herb::AST::ERBContentNode) + return false if erb_comment?(node.tag_opening&.value || "") + + content = node.content&.value || "" + stripped = content.lstrip + + stripped.start_with?("#") && node.location.start.line == node.location.end.line + end end end end diff --git a/lib/herb/engine/compiler.rb b/lib/herb/engine/compiler.rb index 3ed9124a7..e09731e7d 100644 --- a/lib/herb/engine/compiler.rb +++ b/lib/herb/engine/compiler.rb @@ -162,6 +162,8 @@ def visit_cdata_node(node) end def visit_erb_content_node(node) + return if inline_ruby_comment?(node) + process_erb_tag(node) end diff --git a/sig/herb/ast/helpers.rbs b/sig/herb/ast/helpers.rbs index ca4d99ad7..0ee286c34 100644 --- a/sig/herb/ast/helpers.rbs +++ b/sig/herb/ast/helpers.rbs @@ -11,6 +11,9 @@ module Herb # : (String) -> bool def erb_output?: (String) -> bool + + # : (Herb::AST::ERBContentNode) -> bool + def inline_ruby_comment?: (Herb::AST::ERBContentNode) -> bool end end end diff --git a/test/engine/erb_comments_test.rb b/test/engine/erb_comments_test.rb new file mode 100644 index 000000000..9ad291f4f --- /dev/null +++ b/test/engine/erb_comments_test.rb @@ -0,0 +1,83 @@ +# frozen_string_literal: true + +require_relative "../test_helper" +require_relative "../snapshot_utils" +require_relative "../../lib/herb/engine" + +module Engine + class ERBCommentsTest < Minitest::Spec + include SnapshotUtils + + test "inline ruby comment on same line" do + template = %(<% if true %><% # Comment here %><% end %>) + + assert_compiled_snapshot(template) + end + + test "inline ruby comment with newline" do + template = "<% if true %><% # Comment here %>\n<% end %>" + + assert_compiled_snapshot(template) + end + + test "inline ruby comment between code" do + template = %(<% if true %><% # Comment here %><%= "hello" %><% end %>) + + assert_compiled_snapshot(template) + end + + test "inline ruby comment before and between code" do + template = %(<% # Comment here %><% if true %><% # Comment here %><%= "hello" %><% end %>) + + assert_compiled_snapshot(template) + end + + test "inline ruby comment with spaces" do + template = %(<% # Comment %> <% code = "test" %><%= code %>) + + assert_compiled_snapshot(template) + end + + test "inline ruby comment multiline" do + template = "<% # Comment\nmore %> <% code = \"test\" %><%= code %>" + + assert_compiled_snapshot(template) + end + + test "evaluation: inline ruby comment on same line" do + template = %(<% if true %><% # Comment here %><% end %>) + + assert_evaluated_snapshot(template) + end + + test "evaluation: inline ruby comment with newline" do + template = "<% if true %><% # Comment here %>\n<% end %>" + + assert_evaluated_snapshot(template) + end + + test "evaluation: inline ruby comment between code" do + template = %(<% if true %><% # Comment here %><%= "hello" %><% end %>) + + assert_evaluated_snapshot(template) + end + + test "evaluation: inline ruby comment before and between code" do + template = %(<% # Comment here %><% if true %><% # Comment here %><%= "hello" %><% end %>) + + assert_evaluated_snapshot(template) + end + + test "evaluation: inline ruby comment with spaces" do + template = %(<% # Comment %> <% code = "test" %><%= code %>) + + assert_evaluated_snapshot(template) + end + + test "evaluation: inline ruby comment multiline" do + template = "<% # Comment\nmore %> <% code = \"test\" %><%= code %>" + + assert_evaluated_snapshot(template, { more: "ignored" }) + end + end +end diff --git a/test/engine/evaluation_test.rb b/test/engine/evaluation_test.rb index 41a328211..acbb01f45 100644 --- a/test/engine/evaluation_test.rb +++ b/test/engine/evaluation_test.rb @@ -398,5 +398,41 @@ class EvaluationTest < Minitest::Spec assert_evaluated_snapshot(template, {}, { escape: false }) end + + test "inline ruby comment on same line" do + template = %(<% if true %><% # Comment here %><% end %>) + + assert_evaluated_snapshot(template, {}, { escape: false }) + end + + test "inline ruby comment with newline" do + template = "<% if true %><% # Comment here %>\n<% end %>" + + assert_evaluated_snapshot(template, {}, { escape: false }) + end + + test "inline ruby comment between code" do + template = %(<% if true %><% # Comment here %><%= "hello" %><% end %>) + + assert_evaluated_snapshot(template, {}, { escape: false }) + end + + test "inline ruby comment before and between code" do + template = %(<% # Comment here %><% if true %><% # Comment here %><%= "hello" %><% end %>) + + assert_evaluated_snapshot(template, {}, { escape: false }) + end + + test "inline ruby comment with spaces" do + template = %(<% # Comment %> <% code = "test" %><%= code %>) + + assert_evaluated_snapshot(template, {}, { escape: false }) + end + + test "inline ruby comment multiline" do + template = "<% # Comment\nmore %> <% code = \"test\" %><%= code %>" + + assert_evaluated_snapshot(template, { more: "ignored" }, { escape: false }) + end end end diff --git a/test/snapshots/engine/erb_comments_test/test_0001_inline_ruby_comment_on_same_line_ece56a54ce9835acc67012583c42fc01.txt b/test/snapshots/engine/erb_comments_test/test_0001_inline_ruby_comment_on_same_line_ece56a54ce9835acc67012583c42fc01.txt new file mode 100644 index 000000000..edeb1cbbd --- /dev/null +++ b/test/snapshots/engine/erb_comments_test/test_0001_inline_ruby_comment_on_same_line_ece56a54ce9835acc67012583c42fc01.txt @@ -0,0 +1,7 @@ +--- +source: "Engine::ERBCommentsTest#test_0001_inline ruby comment on same line" +input: "{source: \"<% if true %><% # Comment here %><% end %>\", options: {}}" +--- +_buf = ::String.new; + if true; end; +_buf.to_s diff --git a/test/snapshots/engine/erb_comments_test/test_0002_inline_ruby_comment_with_newline_32dd50121c8e2af22b8a7e5efd92940f.txt b/test/snapshots/engine/erb_comments_test/test_0002_inline_ruby_comment_with_newline_32dd50121c8e2af22b8a7e5efd92940f.txt new file mode 100644 index 000000000..a70980646 --- /dev/null +++ b/test/snapshots/engine/erb_comments_test/test_0002_inline_ruby_comment_with_newline_32dd50121c8e2af22b8a7e5efd92940f.txt @@ -0,0 +1,8 @@ +--- +source: "Engine::ERBCommentsTest#test_0002_inline ruby comment with newline" +input: "{source: \"<% if true %><% # Comment here %>\\n<% end %>\", options: {}}" +--- +_buf = ::String.new; + if true; _buf << ' +'.freeze; end; +_buf.to_s diff --git a/test/snapshots/engine/erb_comments_test/test_0003_inline_ruby_comment_between_code_987d6e126382f02311aa0c1a0e0007bc.txt b/test/snapshots/engine/erb_comments_test/test_0003_inline_ruby_comment_between_code_987d6e126382f02311aa0c1a0e0007bc.txt new file mode 100644 index 000000000..567374fbf --- /dev/null +++ b/test/snapshots/engine/erb_comments_test/test_0003_inline_ruby_comment_between_code_987d6e126382f02311aa0c1a0e0007bc.txt @@ -0,0 +1,7 @@ +--- +source: "Engine::ERBCommentsTest#test_0003_inline ruby comment between code" +input: "{source: \"<% if true %><% # Comment here %><%= \\\"hello\\\" %><% end %>\", options: {}}" +--- +_buf = ::String.new; + if true; _buf << ("hello").to_s; end; +_buf.to_s diff --git a/test/snapshots/engine/erb_comments_test/test_0004_inline_ruby_comment_before_and_between_code_d6e28172fd69bf4538744950bffb2848.txt b/test/snapshots/engine/erb_comments_test/test_0004_inline_ruby_comment_before_and_between_code_d6e28172fd69bf4538744950bffb2848.txt new file mode 100644 index 000000000..6cdc50f8e --- /dev/null +++ b/test/snapshots/engine/erb_comments_test/test_0004_inline_ruby_comment_before_and_between_code_d6e28172fd69bf4538744950bffb2848.txt @@ -0,0 +1,7 @@ +--- +source: "Engine::ERBCommentsTest#test_0004_inline ruby comment before and between code" +input: "{source: \"<% # Comment here %><% if true %><% # Comment here %><%= \\\"hello\\\" %><% end %>\", options: {}}" +--- +_buf = ::String.new; + if true; _buf << ("hello").to_s; end; +_buf.to_s diff --git a/test/snapshots/engine/erb_comments_test/test_0005_inline_ruby_comment_with_spaces_a1f69e41bb63eacbc881533c704e17a4.txt b/test/snapshots/engine/erb_comments_test/test_0005_inline_ruby_comment_with_spaces_a1f69e41bb63eacbc881533c704e17a4.txt new file mode 100644 index 000000000..8fbeba86c --- /dev/null +++ b/test/snapshots/engine/erb_comments_test/test_0005_inline_ruby_comment_with_spaces_a1f69e41bb63eacbc881533c704e17a4.txt @@ -0,0 +1,7 @@ +--- +source: "Engine::ERBCommentsTest#test_0005_inline ruby comment with spaces" +input: "{source: \"<% # Comment %> <% code = \\\"test\\\" %><%= code %>\", options: {}}" +--- +_buf = ::String.new; + _buf << ' '.freeze; code = "test"; _buf << (code).to_s; +_buf.to_s diff --git a/test/snapshots/engine/erb_comments_test/test_0006_inline_ruby_comment_multiline_1dc1e842d2fb5a2484c2e2fa0eca3678.txt b/test/snapshots/engine/erb_comments_test/test_0006_inline_ruby_comment_multiline_1dc1e842d2fb5a2484c2e2fa0eca3678.txt new file mode 100644 index 000000000..03b0428a6 --- /dev/null +++ b/test/snapshots/engine/erb_comments_test/test_0006_inline_ruby_comment_multiline_1dc1e842d2fb5a2484c2e2fa0eca3678.txt @@ -0,0 +1,9 @@ +--- +source: "Engine::ERBCommentsTest#test_0006_inline ruby comment multiline" +input: "{source: \"<% # Comment\\nmore %> <% code = \\\"test\\\" %><%= code %>\", options: {}}" +--- +_buf = ::String.new; + # Comment +more + _buf << ' '.freeze; code = "test"; _buf << (code).to_s; +_buf.to_s diff --git a/test/snapshots/engine/erb_comments_test/test_0007_evaluation_inline_ruby_comment_on_same_line_da1ad954cfb3b204db6e91dd6fa35de7.txt b/test/snapshots/engine/erb_comments_test/test_0007_evaluation_inline_ruby_comment_on_same_line_da1ad954cfb3b204db6e91dd6fa35de7.txt new file mode 100644 index 000000000..649597d1a --- /dev/null +++ b/test/snapshots/engine/erb_comments_test/test_0007_evaluation_inline_ruby_comment_on_same_line_da1ad954cfb3b204db6e91dd6fa35de7.txt @@ -0,0 +1,4 @@ +--- +source: "Engine::ERBCommentsTest#test_0007_evaluation: inline ruby comment on same line" +input: "{source: \"<% if true %><% # Comment here %><% end %>\", locals: {}, options: {}}" +--- diff --git a/test/snapshots/engine/erb_comments_test/test_0008_evaluation_inline_ruby_comment_with_newline_3519273b500925a720622d82288e0a31.txt b/test/snapshots/engine/erb_comments_test/test_0008_evaluation_inline_ruby_comment_with_newline_3519273b500925a720622d82288e0a31.txt new file mode 100644 index 000000000..30b3bad99 --- /dev/null +++ b/test/snapshots/engine/erb_comments_test/test_0008_evaluation_inline_ruby_comment_with_newline_3519273b500925a720622d82288e0a31.txt @@ -0,0 +1,5 @@ +--- +source: "Engine::ERBCommentsTest#test_0008_evaluation: inline ruby comment with newline" +input: "{source: \"<% if true %><% # Comment here %>\\n<% end %>\", locals: {}, options: {}}" +--- + diff --git a/test/snapshots/engine/erb_comments_test/test_0009_evaluation_inline_ruby_comment_between_code_2788ca7a784e1295299a8d85ec9e396d.txt b/test/snapshots/engine/erb_comments_test/test_0009_evaluation_inline_ruby_comment_between_code_2788ca7a784e1295299a8d85ec9e396d.txt new file mode 100644 index 000000000..c698dc474 --- /dev/null +++ b/test/snapshots/engine/erb_comments_test/test_0009_evaluation_inline_ruby_comment_between_code_2788ca7a784e1295299a8d85ec9e396d.txt @@ -0,0 +1,5 @@ +--- +source: "Engine::ERBCommentsTest#test_0009_evaluation: inline ruby comment between code" +input: "{source: \"<% if true %><% # Comment here %><%= \\\"hello\\\" %><% end %>\", locals: {}, options: {}}" +--- +hello \ No newline at end of file diff --git a/test/snapshots/engine/erb_comments_test/test_0010_evaluation_inline_ruby_comment_before_and_between_code_13d746f9eef6690df9a609b4349a5189.txt b/test/snapshots/engine/erb_comments_test/test_0010_evaluation_inline_ruby_comment_before_and_between_code_13d746f9eef6690df9a609b4349a5189.txt new file mode 100644 index 000000000..7c064ed31 --- /dev/null +++ b/test/snapshots/engine/erb_comments_test/test_0010_evaluation_inline_ruby_comment_before_and_between_code_13d746f9eef6690df9a609b4349a5189.txt @@ -0,0 +1,5 @@ +--- +source: "Engine::ERBCommentsTest#test_0010_evaluation: inline ruby comment before and between code" +input: "{source: \"<% # Comment here %><% if true %><% # Comment here %><%= \\\"hello\\\" %><% end %>\", locals: {}, options: {}}" +--- +hello \ No newline at end of file diff --git a/test/snapshots/engine/erb_comments_test/test_0011_evaluation_inline_ruby_comment_with_spaces_403e802d2a1c4f738b359fc3eee74053.txt b/test/snapshots/engine/erb_comments_test/test_0011_evaluation_inline_ruby_comment_with_spaces_403e802d2a1c4f738b359fc3eee74053.txt new file mode 100644 index 000000000..b5f111ef4 --- /dev/null +++ b/test/snapshots/engine/erb_comments_test/test_0011_evaluation_inline_ruby_comment_with_spaces_403e802d2a1c4f738b359fc3eee74053.txt @@ -0,0 +1,5 @@ +--- +source: "Engine::ERBCommentsTest#test_0011_evaluation: inline ruby comment with spaces" +input: "{source: \"<% # Comment %> <% code = \\\"test\\\" %><%= code %>\", locals: {}, options: {}}" +--- + test \ No newline at end of file diff --git a/test/snapshots/engine/erb_comments_test/test_0012_evaluation_inline_ruby_comment_multiline_c4d3ea038c11a5575430ca4b14abff47.txt b/test/snapshots/engine/erb_comments_test/test_0012_evaluation_inline_ruby_comment_multiline_c4d3ea038c11a5575430ca4b14abff47.txt new file mode 100644 index 000000000..9340d3c14 --- /dev/null +++ b/test/snapshots/engine/erb_comments_test/test_0012_evaluation_inline_ruby_comment_multiline_c4d3ea038c11a5575430ca4b14abff47.txt @@ -0,0 +1,5 @@ +--- +source: "Engine::ERBCommentsTest#test_0012_evaluation: inline ruby comment multiline" +input: "{source: \"<% # Comment\\nmore %> <% code = \\\"test\\\" %><%= code %>\", locals: {more: \"ignored\"}, options: {}}" +--- + test \ No newline at end of file diff --git a/test/snapshots/engine/evaluation_test/test_0025_inline_ruby_comment_on_same_line_ad303bca1e8d22f5b16ec13f3c664241.txt b/test/snapshots/engine/evaluation_test/test_0025_inline_ruby_comment_on_same_line_ad303bca1e8d22f5b16ec13f3c664241.txt new file mode 100644 index 000000000..f4168e061 --- /dev/null +++ b/test/snapshots/engine/evaluation_test/test_0025_inline_ruby_comment_on_same_line_ad303bca1e8d22f5b16ec13f3c664241.txt @@ -0,0 +1,4 @@ +--- +source: "Engine::EvaluationTest#test_0025_inline ruby comment on same line" +input: "{source: \"<% if true %><% # Comment here %><% end %>\", locals: {}, options: {escape: false}}" +--- diff --git a/test/snapshots/engine/evaluation_test/test_0026_inline_ruby_comment_with_newline_9abf0cb2099f40dfd7f4dfd3bfe1cc76.txt b/test/snapshots/engine/evaluation_test/test_0026_inline_ruby_comment_with_newline_9abf0cb2099f40dfd7f4dfd3bfe1cc76.txt new file mode 100644 index 000000000..cdb098528 --- /dev/null +++ b/test/snapshots/engine/evaluation_test/test_0026_inline_ruby_comment_with_newline_9abf0cb2099f40dfd7f4dfd3bfe1cc76.txt @@ -0,0 +1,5 @@ +--- +source: "Engine::EvaluationTest#test_0026_inline ruby comment with newline" +input: "{source: \"<% if true %><% # Comment here %>\\n<% end %>\", locals: {}, options: {escape: false}}" +--- + diff --git a/test/snapshots/engine/evaluation_test/test_0027_inline_ruby_comment_between_code_846a700430f96166237a051e3fca1bed.txt b/test/snapshots/engine/evaluation_test/test_0027_inline_ruby_comment_between_code_846a700430f96166237a051e3fca1bed.txt new file mode 100644 index 000000000..ad38ad46e --- /dev/null +++ b/test/snapshots/engine/evaluation_test/test_0027_inline_ruby_comment_between_code_846a700430f96166237a051e3fca1bed.txt @@ -0,0 +1,5 @@ +--- +source: "Engine::EvaluationTest#test_0027_inline ruby comment between code" +input: "{source: \"<% if true %><% # Comment here %><%= \\\"hello\\\" %><% end %>\", locals: {}, options: {escape: false}}" +--- +hello \ No newline at end of file diff --git a/test/snapshots/engine/evaluation_test/test_0028_inline_ruby_comment_before_and_between_code_033a23daedac7be2427e58914b665c0f.txt b/test/snapshots/engine/evaluation_test/test_0028_inline_ruby_comment_before_and_between_code_033a23daedac7be2427e58914b665c0f.txt new file mode 100644 index 000000000..f789885fd --- /dev/null +++ b/test/snapshots/engine/evaluation_test/test_0028_inline_ruby_comment_before_and_between_code_033a23daedac7be2427e58914b665c0f.txt @@ -0,0 +1,5 @@ +--- +source: "Engine::EvaluationTest#test_0028_inline ruby comment before and between code" +input: "{source: \"<% # Comment here %><% if true %><% # Comment here %><%= \\\"hello\\\" %><% end %>\", locals: {}, options: {escape: false}}" +--- +hello \ No newline at end of file diff --git a/test/snapshots/engine/evaluation_test/test_0029_inline_ruby_comment_with_spaces_c05d8f81793b59bea0ce93cf959bcfbe.txt b/test/snapshots/engine/evaluation_test/test_0029_inline_ruby_comment_with_spaces_c05d8f81793b59bea0ce93cf959bcfbe.txt new file mode 100644 index 000000000..296828987 --- /dev/null +++ b/test/snapshots/engine/evaluation_test/test_0029_inline_ruby_comment_with_spaces_c05d8f81793b59bea0ce93cf959bcfbe.txt @@ -0,0 +1,5 @@ +--- +source: "Engine::EvaluationTest#test_0029_inline ruby comment with spaces" +input: "{source: \"<% # Comment %> <% code = \\\"test\\\" %><%= code %>\", locals: {}, options: {escape: false}}" +--- + test \ No newline at end of file diff --git a/test/snapshots/engine/evaluation_test/test_0030_inline_ruby_comment_multiline_d65c4c66f63611e90c0ea96b74af1ce4.txt b/test/snapshots/engine/evaluation_test/test_0030_inline_ruby_comment_multiline_d65c4c66f63611e90c0ea96b74af1ce4.txt new file mode 100644 index 000000000..e6a72c5d1 --- /dev/null +++ b/test/snapshots/engine/evaluation_test/test_0030_inline_ruby_comment_multiline_d65c4c66f63611e90c0ea96b74af1ce4.txt @@ -0,0 +1,5 @@ +--- +source: "Engine::EvaluationTest#test_0030_inline ruby comment multiline" +input: "{source: \"<% # Comment\\nmore %> <% code = \\\"test\\\" %><%= code %>\", locals: {more: \"ignored\"}, options: {escape: false}}" +--- + test \ No newline at end of file diff --git a/test/snapshots/engine/examples_compilation_test/test_0009_comment_before_content_compilation_2b3c4e3c244db77468813a7472298e82.txt b/test/snapshots/engine/examples_compilation_test/test_0009_comment_before_content_compilation_2b3c4e3c244db77468813a7472298e82.txt index 4548f3209..3d07109c9 100644 --- a/test/snapshots/engine/examples_compilation_test/test_0009_comment_before_content_compilation_2b3c4e3c244db77468813a7472298e82.txt +++ b/test/snapshots/engine/examples_compilation_test/test_0009_comment_before_content_compilation_2b3c4e3c244db77468813a7472298e82.txt @@ -3,7 +3,6 @@ source: "Engine::ExamplesCompilationTest#test_0009_comment before content compil input: "{source: \"<% # This file contains a comment before other content %>\\n
Hey there
\\n\", options: {escape: false}}" --- _buf = ::String.new; - # This file contains a comment before other content _buf << '
Hey there
'.freeze;