From b451de0d6de4df6bc66b274cec73b919f823d5ae Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sat, 14 Aug 2010 02:13:00 -0300 Subject: Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) --- .../test/template/html-scanner/tag_node_test.rb | 46 +++++++++++----------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'actionpack/test/template/html-scanner/tag_node_test.rb') diff --git a/actionpack/test/template/html-scanner/tag_node_test.rb b/actionpack/test/template/html-scanner/tag_node_test.rb index d1d4667378..9c8fcdc8fc 100644 --- a/actionpack/test/template/html-scanner/tag_node_test.rb +++ b/actionpack/test/template/html-scanner/tag_node_test.rb @@ -7,7 +7,7 @@ class TagNodeTest < Test::Unit::TestCase assert_equal Hash.new, node.attributes assert_nil node.closing end - + def test_open_with_attributes node = tag("") assert_equal "tag1", node.name @@ -15,28 +15,28 @@ class TagNodeTest < Test::Unit::TestCase assert_equal "blah blah", node["x:bar"] assert_equal "blah blah blah", node["baz"] end - + def test_self_closing_without_attributes node = tag("") assert_equal "tag", node.name assert_equal Hash.new, node.attributes assert_equal :self, node.closing end - + def test_self_closing_with_attributes node = tag("") assert_equal "tag", node.name assert_equal( { "a" => "b" }, node.attributes ) assert_equal :self, node.closing end - + def test_closing_without_attributes node = tag("") assert_equal "tag", node.name assert_nil node.attributes assert_equal :close, node.closing end - + def test_bracket_op_when_no_attributes node = tag("") assert_nil node["foo"] @@ -46,27 +46,27 @@ class TagNodeTest < Test::Unit::TestCase node = tag("") assert_equal "b", node["a"] end - + def test_attributes_with_escaped_quotes node = tag("") assert_equal "b\\'c", node["a"] assert_equal "bob \\\"float\\\"", node["b"] end - + def test_to_s node = tag("") assert_equal %(), node.to_s end - + def test_tag assert tag("").tag? end - + def test_match_tag_as_string assert tag("").match(:tag => "tag") assert !tag("").match(:tag => "b") end - + def test_match_tag_as_regexp assert tag("").match(:tag => /t.g/) assert !tag("").match(:tag => /t[bqs]g/) @@ -77,45 +77,45 @@ class TagNodeTest < Test::Unit::TestCase assert t.match(:attributes => {"a" => "something"}) assert t.match(:attributes => {"b" => "else"}) end - + def test_match_attributes_as_regexp t = tag("") assert t.match(:attributes => {"a" => /^something$/}) assert t.match(:attributes => {"b" => /e.*e/}) assert t.match(:attributes => {"a" => /me..i/, "b" => /.ls.$/}) end - + def test_match_attributes_as_number t = tag("") assert t.match(:attributes => {"a" => 15}) assert t.match(:attributes => {"b" => 3.1415}) assert t.match(:attributes => {"a" => 15, "b" => 3.1415}) end - + def test_match_attributes_exist t = tag("") assert t.match(:attributes => {"a" => true}) assert t.match(:attributes => {"b" => true}) assert t.match(:attributes => {"a" => true, "b" => true}) end - + def test_match_attributes_not_exist t = tag("") assert t.match(:attributes => {"c" => false}) assert t.match(:attributes => {"c" => nil}) assert t.match(:attributes => {"a" => true, "c" => false}) end - + def test_match_parent_success t = tag("", tag("")) assert t.match(:parent => {:tag => "foo", :attributes => {"k" => /v.l/, "j" => false}}) end - + def test_match_parent_fail t = tag("", tag("")) assert !t.match(:parent => {:tag => /kafka/}) end - + def test_match_child_success t = tag("") tag("", t) @@ -123,7 +123,7 @@ class TagNodeTest < Test::Unit::TestCase assert t.match(:child => { :tag => "sib", :attributes => {"v" => /j/}}) assert t.match(:child => { :attributes => {"a" => "kelly"}}) end - + def test_match_child_fail t = tag("") tag("", t) @@ -131,13 +131,13 @@ class TagNodeTest < Test::Unit::TestCase assert !t.match(:child => { :tag => "sib", :attributes => {"v" => /r/}}) assert !t.match(:child => { :attributes => {"v" => false}}) end - + def test_match_ancestor_success t = tag("", tag("", tag(""))) assert t.match(:ancestor => {:tag => "parent", :attributes => {"a" => /ll/}}) assert t.match(:ancestor => {:attributes => {"m" => "vaughn"}}) end - + def test_match_ancestor_fail t = tag("", tag("", tag(""))) assert !t.match(:ancestor => {:tag => /^parent/, :attributes => {"v" => /m/}}) @@ -149,13 +149,13 @@ class TagNodeTest < Test::Unit::TestCase assert t.match(:descendant => {:tag => "child", :attributes => {"a" => /ll/}}) assert t.match(:descendant => {:attributes => {"m" => "vaughn"}}) end - + def test_match_descendant_fail tag("", tag("", t = tag(""))) assert !t.match(:descendant => {:tag => /^child/, :attributes => {"v" => /m/}}) assert !t.match(:descendant => {:attributes => {"v" => false}}) end - + def test_match_child_count t = tag("") tag("hello", t) @@ -229,7 +229,7 @@ class TagNodeTest < Test::Unit::TestCase end private - + def tag(content, parent=nil) node = HTML::Node.parse(parent,0,0,content) parent.children << node if parent -- cgit v1.2.3