X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=vendor%2Frails%2Factionpack%2Ftest%2Fcontroller%2Fhtml-scanner%2Ftokenizer_test.rb;fp=vendor%2Frails%2Factionpack%2Ftest%2Fcontroller%2Fhtml-scanner%2Ftokenizer_test.rb;h=a001bcbbad290dcc275a8b71a37ea2170bdd00ee;hb=d115f2e23823271635bad69229a42cd8ac68debe;hp=0000000000000000000000000000000000000000;hpb=37cb670bf3ddde90b214e591f100ed4446469484;p=depot.git diff --git a/vendor/rails/actionpack/test/controller/html-scanner/tokenizer_test.rb b/vendor/rails/actionpack/test/controller/html-scanner/tokenizer_test.rb new file mode 100644 index 0000000..a001bcb --- /dev/null +++ b/vendor/rails/actionpack/test/controller/html-scanner/tokenizer_test.rb @@ -0,0 +1,131 @@ +require 'abstract_unit' + +class TokenizerTest < Test::Unit::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