@@ -26,7 +26,7 @@ class TestComment < Nokogiri::TestCase
2626 if Nokogiri . libxml2_patches . include? ( "0008-htmlParseComment-handle-abruptly-closed-comments.patch" )
2727 it "behaves as if the comment is closed correctly" do # COMPLIANT
2828 assert_equal 1 , subject . children . length
29- assert subject . children . first . comment?
29+ assert_predicate subject . children . first , : comment?
3030 assert_equal "" , subject . children . first . content
3131 assert other_div
3232 end
@@ -43,7 +43,7 @@ class TestComment < Nokogiri::TestCase
4343 if Nokogiri . jruby?
4444 it "behaves as if the comment is closed correctly" do # COMPLIANT
4545 assert_equal 1 , subject . children . length
46- assert subject . children . first . comment?
46+ assert_predicate subject . children . first , : comment?
4747 assert_equal "" , subject . children . first . content
4848 assert other_div
4949 end
@@ -57,7 +57,7 @@ class TestComment < Nokogiri::TestCase
5757 if Nokogiri . libxml2_patches . include? ( "0008-htmlParseComment-handle-abruptly-closed-comments.patch" )
5858 it "behaves as if the comment is closed correctly" do # COMPLIANT
5959 assert_equal 1 , subject . children . length
60- assert subject . children . first . comment?
60+ assert_predicate subject . children . first , : comment?
6161 assert_equal "" , subject . children . first . content
6262 assert other_div
6363 end
@@ -74,7 +74,7 @@ class TestComment < Nokogiri::TestCase
7474 if Nokogiri . jruby?
7575 it "behaves as if the comment is closed correctly" do # COMPLIANT
7676 assert_equal 1 , subject . children . length
77- assert subject . children . first . comment?
77+ assert_predicate subject . children . first , : comment?
7878 assert_equal "-" , subject . children . first . content # curious, potentially non-compliant?
7979 assert other_div
8080 end
@@ -86,7 +86,7 @@ class TestComment < Nokogiri::TestCase
8686
8787 it "behaves as if the comment is closed correctly" do # COMPLIANT
8888 assert_equal 1 , subject . children . length
89- assert subject . children . first . comment?
89+ assert_predicate subject . children . first , : comment?
9090 assert_equal "" , subject . children . first . content
9191 assert other_div
9292 end
@@ -115,7 +115,7 @@ class TestComment < Nokogiri::TestCase
115115 if Nokogiri . jruby?
116116 it "behaves as if the comment is closed immediately before the end of the input stream" do # COMPLIANT
117117 assert_equal 1 , subject . children . length
118- assert subject . children . first . comment?
118+ assert_predicate subject . children . first , : comment?
119119 assert_equal "start of unterminated comment" , subject . children . first . content
120120 end
121121 end
@@ -136,11 +136,11 @@ class TestComment < Nokogiri::TestCase
136136 if Nokogiri ::VersionInfo . instance . libxml2_using_packaged? || ( Nokogiri ::VersionInfo . instance . libxml2_using_system? && Nokogiri . uses_libxml? ( ">=2.9.11" ) )
137137 it "behaves as if the comment is normally closed" do # COMPLIANT
138138 assert_equal 3 , subject . children . length
139- assert subject . children [ 0 ] . comment?
139+ assert_predicate subject . children [ 0 ] , : comment?
140140 assert_equal "foo" , subject . children [ 0 ] . content
141141 assert inner_div
142142 assert_equal inner_div , subject . children [ 1 ]
143- assert subject . children [ 2 ] . comment?
143+ assert_predicate subject . children [ 2 ] , : comment?
144144 assert_equal "bar" , subject . children [ 2 ] . content
145145 assert_equal 1 , doc . errors . length
146146 assert_match ( /Comment incorrectly closed/ , doc . errors . first . to_s )
@@ -150,7 +150,7 @@ class TestComment < Nokogiri::TestCase
150150 if Nokogiri . jruby? || ( Nokogiri ::VersionInfo . instance . libxml2_using_system? && Nokogiri . uses_libxml? ( "<2.9.11" ) )
151151 it "behaves as if the comment encompasses the inner div" do # NON-COMPLIANT
152152 assert_equal 1 , subject . children . length
153- assert subject . children . first . comment?
153+ assert_predicate subject . children . first , : comment?
154154 refute inner_div
155155 assert_match ( /id=do-i-exist/ , subject . children . first . content )
156156 assert_equal 0 , doc . errors . length
@@ -178,17 +178,17 @@ class TestComment < Nokogiri::TestCase
178178 assert_equal 2 , body . children . length
179179 assert_equal body . children [ 0 ] , subject
180180 assert_equal 1 , subject . children . length
181- assert subject . children [ 0 ] . text?
181+ assert_predicate subject . children [ 0 ] , : text?
182182 assert_equal "inner content" , subject . children [ 0 ] . content
183- assert body . children [ 1 ] . text?
183+ assert_predicate body . children [ 1 ] , : text?
184184 assert_equal "-->hello" , body . children [ 1 ] . content
185185 end
186186 end
187187
188188 if Nokogiri . jruby?
189189 it "ignores up to the next '-->'" do # NON-COMPLIANT
190190 assert_equal 1 , subject . children . length
191- assert subject . children [ 0 ] . text?
191+ assert_predicate subject . children [ 0 ] , : text?
192192 assert_equal "hello" , subject . children [ 0 ] . content
193193 end
194194 end
@@ -208,11 +208,11 @@ class TestComment < Nokogiri::TestCase
208208
209209 it "ignores to the next '-->'" do # COMPLIANT
210210 assert_equal 3 , subject . children . length
211- assert subject . children [ 0 ] . comment?
211+ assert_predicate subject . children [ 0 ] , : comment?
212212 assert_equal " outer <!-- inner " , subject . children [ 0 ] . content
213213 assert inner_div
214214 assert_equal inner_div , subject . children [ 1 ]
215- assert subject . children [ 2 ] . text?
215+ assert_predicate subject . children [ 2 ] , : text?
216216 assert_equal "-->" , subject . children [ 2 ] . content
217217 end
218218 end
0 commit comments