# frozen_string_literal: true require_relative "../test_helper" module Parser class CDATATest < Minitest::Spec include SnapshotUtils test "basic CDATA section" do assert_parsed_snapshot("") end test "CDATA with text content" do assert_parsed_snapshot("") end test "CDATA with XML-like content" do assert_parsed_snapshot("John Smith]]>") end test "CDATA with special characters" do assert_parsed_snapshot("") end test "CDATA with escaped characters that are not interpreted" do assert_parsed_snapshot("& <div>]]>") end test "CDATA with newlines" do assert_parsed_snapshot(<<~XML) XML end test "CDATA in XML document" do assert_parsed_snapshot(<<~XML) XML end test "CDATA with ERB content" do assert_parsed_snapshot("]]>") end test "CDATA with complex ERB" do assert_parsed_snapshot(<<~XML) <%= @content %> <% end %> ]]> XML end test "Multiple CDATA sections" do assert_parsed_snapshot("") end test "CDATA with ]] inside (workaround pattern)" do assert_parsed_snapshot(" inside]]>") end test "CDATA in HTML comment context" do assert_parsed_snapshot("") end test "CDATA with various brackets" do assert_parsed_snapshot("") end test "Empty CDATA with spaces" do assert_parsed_snapshot("") end test "CDATA followed by HTML" do assert_parsed_snapshot("
HTML
") end test "CDATA in complex document structure" do assert_parsed_snapshot(<<~HTML)
]]>
HTML end test "CDATA with ERB loop" do assert_parsed_snapshot(<<~XML) <%= item.name %> <% end %> ]]> XML end test "nested CDATA workaround" do assert_parsed_snapshot(" Outer end]]>") end end end