From 595107f22e6a26e20860d0023478437a51daa5c6 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Sat, 23 May 2009 02:20:28 +0200 Subject: Move html-scanner tests one dir up --- actionpack/test/html-scanner/tokenizer_test.rb | 131 +++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 actionpack/test/html-scanner/tokenizer_test.rb (limited to 'actionpack/test/html-scanner/tokenizer_test.rb') diff --git a/actionpack/test/html-scanner/tokenizer_test.rb b/actionpack/test/html-scanner/tokenizer_test.rb new file mode 100644 index 0000000000..a001bcbbad --- /dev/null +++ b/actionpack/test/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