require File.dirname(__FILE__) + '/../../abstract_unit'
require 'test/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_less_than_with_space
tokenize %{original < hello > 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