require 'test_helper' require 'rails/deprecated_sanitizer/html-scanner/html/tokenizer' class TokenizerTest < ActiveSupport::TestCase def test_blank tokenize "" assert_end end def test_space tokenize " " assert_next " " assert_end end def test_tag_simple_open tokenize "" assert_next "" assert_end end def test_tag_simple_self_closing tokenize "" assert_next "" assert_end end def test_tag_simple_closing tokenize "" assert_next "" end def test_tag_with_single_quoted_attribute tokenize %{x} assert_next %{} end def test_tag_with_single_quoted_attribute_with_escape tokenize %{x} assert_next %{} end def test_tag_with_double_quoted_attribute tokenize %{x} assert_next %{} end def test_tag_with_double_quoted_attribute_with_escape tokenize %{x} assert_next %{} end def test_tag_with_unquoted_attribute tokenize %{x} assert_next %{} end def test_tag_with_lt_char_in_attribute tokenize %{x} assert_next %{} end def test_tag_with_gt_char_in_attribute tokenize %{x} assert_next %{} end def test_doctype_tag tokenize %{\n } assert_next %{} assert_next %{\n } assert_next %{} end def test_cdata_tag tokenize %{]]>} assert_next %{]]>} assert_end end def test_unterminated_cdata_tag tokenize %{} assert_next %{ world} assert_next %{original } assert_next %{< hello > world} end def test_less_than_without_matching_greater_than tokenize %{hello foo\nbar} assert_next %{hello } assert_next %{} assert_next %{foo} assert_next %{} assert_next %{\nbar} assert_next %{} assert_end end def test_unterminated_comment tokenize %{hello