From 018b79dd36d054d87fdc408d38dc9ac7f1b1500d Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sat, 3 Oct 2009 21:05:51 -0500 Subject: File extra test folders into controller, dispatch, or template --- .../test/template/html-scanner/tokenizer_test.rb | 131 +++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 actionpack/test/template/html-scanner/tokenizer_test.rb (limited to 'actionpack/test/template/html-scanner/tokenizer_test.rb') diff --git a/actionpack/test/template/html-scanner/tokenizer_test.rb b/actionpack/test/template/html-scanner/tokenizer_test.rb new file mode 100644 index 0000000000..a001bcbbad --- /dev/null +++ b/actionpack/test/template/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