nokogiri 1.4.1-java → 1.4.2-java

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of nokogiri might be problematic. Click here for more details.

Files changed (115) hide show
  1. data/CHANGELOG.ja.rdoc +45 -0
  2. data/CHANGELOG.rdoc +53 -1
  3. data/Manifest.txt +3 -3
  4. data/README.ja.rdoc +1 -1
  5. data/README.rdoc +11 -5
  6. data/Rakefile +13 -79
  7. data/ext/nokogiri/extconf.rb +22 -74
  8. data/ext/nokogiri/html_document.c +17 -8
  9. data/ext/nokogiri/html_element_description.c +20 -16
  10. data/ext/nokogiri/html_entity_lookup.c +2 -2
  11. data/ext/nokogiri/html_sax_parser_context.c +10 -8
  12. data/ext/nokogiri/libcharset-1.dll +0 -0
  13. data/ext/nokogiri/libexslt.dll +0 -0
  14. data/ext/nokogiri/libiconv-2.dll +0 -0
  15. data/ext/nokogiri/libxml2.dll +0 -0
  16. data/ext/nokogiri/libxslt.dll +0 -0
  17. data/ext/nokogiri/nokogiri.c +0 -1
  18. data/ext/nokogiri/nokogiri.h +33 -28
  19. data/ext/nokogiri/xml_attr.c +7 -5
  20. data/ext/nokogiri/xml_attribute_decl.c +5 -2
  21. data/ext/nokogiri/xml_cdata.c +4 -2
  22. data/ext/nokogiri/xml_comment.c +4 -2
  23. data/ext/nokogiri/xml_document.c +93 -15
  24. data/ext/nokogiri/xml_document.h +0 -1
  25. data/ext/nokogiri/xml_document_fragment.c +4 -2
  26. data/ext/nokogiri/xml_dtd.c +18 -8
  27. data/ext/nokogiri/xml_element_content.c +2 -2
  28. data/ext/nokogiri/xml_entity_decl.c +15 -2
  29. data/ext/nokogiri/xml_entity_reference.c +4 -2
  30. data/ext/nokogiri/xml_io.c +1 -1
  31. data/ext/nokogiri/xml_namespace.c +5 -3
  32. data/ext/nokogiri/xml_node.c +353 -114
  33. data/ext/nokogiri/xml_node_set.c +35 -22
  34. data/ext/nokogiri/xml_node_set.h +1 -1
  35. data/ext/nokogiri/xml_processing_instruction.c +4 -2
  36. data/ext/nokogiri/xml_reader.c +119 -47
  37. data/ext/nokogiri/xml_relax_ng.c +21 -12
  38. data/ext/nokogiri/xml_sax_parser.c +6 -3
  39. data/ext/nokogiri/xml_sax_parser.h +13 -17
  40. data/ext/nokogiri/xml_sax_parser_context.c +8 -6
  41. data/ext/nokogiri/xml_sax_push_parser.c +7 -6
  42. data/ext/nokogiri/xml_schema.c +62 -13
  43. data/ext/nokogiri/xml_syntax_error.c +18 -12
  44. data/ext/nokogiri/xml_syntax_error.h +1 -1
  45. data/ext/nokogiri/xml_text.c +4 -2
  46. data/ext/nokogiri/xml_xpath_context.c +60 -23
  47. data/ext/nokogiri/xslt_stylesheet.c +14 -3
  48. data/ext/nokogiri/zlib1.dll +0 -0
  49. data/lib/nokogiri.rb +17 -0
  50. data/lib/nokogiri/css/generated_parser.rb +72 -62
  51. data/lib/nokogiri/css/generated_tokenizer.rb +23 -24
  52. data/lib/nokogiri/css/parser.y +3 -1
  53. data/lib/nokogiri/css/tokenizer.rex +3 -3
  54. data/lib/nokogiri/css/xpath_visitor.rb +8 -3
  55. data/lib/nokogiri/ffi/html/sax/parser_context.rb +3 -3
  56. data/lib/nokogiri/ffi/libxml.rb +16 -2
  57. data/lib/nokogiri/ffi/structs/common_node.rb +15 -3
  58. data/lib/nokogiri/ffi/structs/xml_document.rb +13 -4
  59. data/lib/nokogiri/ffi/structs/xml_xpath_context.rb +3 -2
  60. data/lib/nokogiri/ffi/weak_bucket.rb +40 -0
  61. data/lib/nokogiri/ffi/xml/document.rb +27 -0
  62. data/lib/nokogiri/ffi/xml/entity_decl.rb +9 -0
  63. data/lib/nokogiri/ffi/xml/node.rb +142 -61
  64. data/lib/nokogiri/ffi/xml/node_set.rb +15 -12
  65. data/lib/nokogiri/ffi/xml/reader.rb +5 -0
  66. data/lib/nokogiri/ffi/xml/schema.rb +17 -0
  67. data/lib/nokogiri/ffi/xml/syntax_error.rb +4 -4
  68. data/lib/nokogiri/ffi/xml/xpath.rb +0 -10
  69. data/lib/nokogiri/ffi/xml/xpath_context.rb +22 -9
  70. data/lib/nokogiri/ffi/xslt/stylesheet.rb +3 -0
  71. data/lib/nokogiri/html/document.rb +5 -3
  72. data/lib/nokogiri/html/document_fragment.rb +28 -7
  73. data/lib/nokogiri/nokogiri.rb +1 -0
  74. data/lib/nokogiri/version.rb +6 -2
  75. data/lib/nokogiri/version_warning.rb +6 -3
  76. data/lib/nokogiri/xml.rb +1 -1
  77. data/lib/nokogiri/xml/builder.rb +35 -22
  78. data/lib/nokogiri/xml/document.rb +44 -12
  79. data/lib/nokogiri/xml/document_fragment.rb +16 -12
  80. data/lib/nokogiri/xml/entity_decl.rb +4 -0
  81. data/lib/nokogiri/xml/node.rb +152 -95
  82. data/lib/nokogiri/xml/node_set.rb +2 -1
  83. data/lib/nokogiri/xml/sax/push_parser.rb +1 -1
  84. data/lib/nokogiri/xml/schema.rb +1 -5
  85. data/lib/nokogiri/xml/syntax_error.rb +4 -0
  86. data/lib/nokogiri/xml/text.rb +9 -0
  87. data/lib/nokogiri/xml/xpath/syntax_error.rb +3 -0
  88. data/tasks/cross_compile.rb +157 -0
  89. data/tasks/test.rb +0 -6
  90. data/test/css/test_xpath_visitor.rb +9 -0
  91. data/test/helper.rb +49 -11
  92. data/test/html/sax/test_parser.rb +11 -1
  93. data/test/html/test_document.rb +8 -0
  94. data/test/html/test_document_fragment.rb +14 -2
  95. data/test/html/test_element_description.rb +5 -1
  96. data/test/html/test_node.rb +5 -66
  97. data/test/test_reader.rb +28 -0
  98. data/test/test_xslt_transforms.rb +14 -0
  99. data/test/xml/test_builder.rb +43 -0
  100. data/test/xml/test_cdata.rb +12 -0
  101. data/test/xml/test_document.rb +74 -39
  102. data/test/xml/test_document_fragment.rb +36 -0
  103. data/test/xml/test_entity_decl.rb +37 -0
  104. data/test/xml/test_node.rb +192 -65
  105. data/test/xml/test_node_reparenting.rb +253 -236
  106. data/test/xml/test_node_set.rb +67 -0
  107. data/test/xml/test_text.rb +8 -0
  108. data/test/xml/test_xpath.rb +32 -0
  109. metadata +119 -48
  110. data.tar.gz.sig +0 -0
  111. data/ext/nokogiri/iconv.dll +0 -0
  112. data/ext/nokogiri/xml_xpath.c +0 -53
  113. data/ext/nokogiri/xml_xpath.h +0 -11
  114. data/lib/nokogiri/xml/fragment_handler.rb +0 -79
  115. metadata.gz.sig +0 -0
@@ -2,6 +2,9 @@ module Nokogiri
2
2
  module XML
3
3
  class XPath
4
4
  class SyntaxError < XML::SyntaxError
5
+ def to_s
6
+ [super.chomp, str1].compact.join(': ')
7
+ end
5
8
  end
6
9
  end
7
10
  end
@@ -0,0 +1,157 @@
1
+ require 'rake/extensioncompiler'
2
+ HOST = Rake::ExtensionCompiler.mingw_host
3
+ TARGET = 'i386-pc-mingw32'
4
+
5
+ ZLIB = 'zlib-1.2.5'
6
+ ICONV = 'libiconv-1.13.1'
7
+ LIBXML = 'libxml2-2.7.7'
8
+ LIBXSLT = 'libxslt-1.1.26'
9
+
10
+ ### Build zlib ###
11
+ file "tmp/cross/download/#{ZLIB}" do |t|
12
+ FileUtils.mkdir_p('tmp/cross/download')
13
+
14
+ file = ZLIB
15
+ url = "http://zlib.net/#{file}.tar.gz"
16
+
17
+ Dir.chdir('tmp/cross/download') do
18
+ sh "wget #{url} || curl -O #{url}"
19
+ sh "tar zxvf #{file}.tar.gz"
20
+ end
21
+
22
+ Dir.chdir t.name do
23
+ mk = File.read('win32/Makefile.gcc')
24
+ File.open('win32/Makefile.gcc', 'wb') do |f|
25
+ f.puts "BINARY_PATH = #{CROSS_DIR}/bin"
26
+ f.puts "LIBRARY_PATH = #{CROSS_DIR}/lib"
27
+ f.puts "INCLUDE_PATH = #{CROSS_DIR}/include"
28
+
29
+ f.puts mk.sub(/^PREFIX\s*=\s*$/, "PREFIX = #{HOST}-").
30
+ sub(/^SHARED_MODE=0$/, 'SHARED_MODE=1').
31
+ sub(/^IMPLIB\s*=.*$/, 'IMPLIB=libz.dll.a')
32
+ end
33
+ end
34
+ end
35
+
36
+ file 'tmp/cross/lib/libz.a' => "tmp/cross/download/#{ZLIB}" do |t|
37
+ Dir.chdir t.prerequisites.first do
38
+ sh 'make -f win32/Makefile.gcc'
39
+ sh 'make -f win32/Makefile.gcc install'
40
+ end
41
+ end
42
+ ### End build zlib ###
43
+
44
+ ### Build iconv ###
45
+ file "tmp/cross/download/#{ICONV}" do |t|
46
+ FileUtils.mkdir_p('tmp/cross/download')
47
+
48
+ file = ICONV
49
+ url = "http://ftp.gnu.org/pub/gnu/libiconv/#{file}.tar.gz"
50
+
51
+ Dir.chdir('tmp/cross/download') do
52
+ sh "wget #{url} || curl -O #{url}"
53
+ sh "tar zxvf #{file}.tar.gz"
54
+ end
55
+
56
+ Dir.chdir t.name do
57
+ # FIXME: need to make the host dynamic
58
+ sh "./configure --enable-shared --enable-static --host=#{HOST} --target=#{TARGET} --prefix=#{CROSS_DIR} CPPFLAGS='-mno-cygwin -Wall' CFLAGS='-mno-cygwin -O2 -g' CXXFLAGS='-mno-cygwin -O2 -g' LDFLAGS=-mno-cygwin"
59
+ end
60
+ end
61
+
62
+ file 'tmp/cross/bin/iconv.exe' => "tmp/cross/download/#{ICONV}" do |t|
63
+ Dir.chdir t.prerequisites.first do
64
+ sh 'make'
65
+ sh 'make install'
66
+ end
67
+ end
68
+ ### End build iconv ###
69
+
70
+ ### Build libxml2 ###
71
+ file "tmp/cross/download/#{LIBXML}" do |t|
72
+ FileUtils.mkdir_p('tmp/cross/download')
73
+
74
+ file = LIBXML
75
+ url = "ftp://ftp.xmlsoft.org/libxml2/#{file}.tar.gz"
76
+
77
+ Dir.chdir('tmp/cross/download') do
78
+ sh "wget #{url} || curl -O #{url}"
79
+ sh "tar zxvf #{file}.tar.gz"
80
+ end
81
+
82
+ Dir.chdir t.name do
83
+ # FIXME: need to make the host dynamic
84
+ sh "CFLAGS='-DIN_LIBXML' ./configure --host=#{HOST} --target=#{TARGET} --enable-static --enable-shared --prefix=#{CROSS_DIR} --with-zlib=#{CROSS_DIR} --with-iconv=#{CROSS_DIR} --without-python --without-readline"
85
+ end
86
+ end
87
+
88
+ file 'tmp/cross/bin/xml2-config' => "tmp/cross/download/#{LIBXML}" do |t|
89
+ Dir.chdir t.prerequisites.first do
90
+ sh 'make LDFLAGS="-avoid-version"'
91
+ sh 'make install'
92
+ end
93
+ end
94
+ ### End build libxml2 ###
95
+
96
+ ### Build libxslt ###
97
+ file "tmp/cross/download/#{LIBXSLT}" do |t|
98
+ FileUtils.mkdir_p('tmp/cross/download')
99
+
100
+ file = LIBXSLT
101
+ url = "ftp://ftp.xmlsoft.org/libxml2/#{file}.tar.gz"
102
+
103
+ Dir.chdir('tmp/cross/download') do
104
+ sh "wget #{url} || curl -O #{url}"
105
+ sh "tar zxvf #{file}.tar.gz"
106
+ end
107
+
108
+ Dir.chdir t.name do
109
+ # FIXME: need to make the host dynamic
110
+ sh "CFLAGS='-DIN_LIBXML' ./configure --host=#{HOST} --target=#{TARGET} --enable-static --enable-shared --prefix=#{CROSS_DIR} --with-libxml-prefix=#{CROSS_DIR} --without-python"
111
+ end
112
+ end
113
+
114
+ file 'tmp/cross/bin/xslt-config' => "tmp/cross/download/#{LIBXSLT}" do |t|
115
+ Dir.chdir t.prerequisites.first do
116
+ sh 'make LDFLAGS="-avoid-version"'
117
+ sh 'make install'
118
+ end
119
+ end
120
+ ### End build libxslt ###
121
+
122
+ file 'lib/nokogiri/nokogiri.rb' => 'cross:libxslt' do
123
+ File.open("lib/#{HOE.name}/#{HOE.name}.rb", 'wb') do |f|
124
+ f.write <<-eoruby
125
+ require "#{HOE.name}/\#{RUBY_VERSION.sub(/\\.\\d+$/, '')}/#{HOE.name}"
126
+ eoruby
127
+ end
128
+ end
129
+
130
+ namespace :cross do
131
+ task :iconv => 'tmp/cross/bin/iconv.exe'
132
+ task :zlib => 'tmp/cross/lib/libz.a'
133
+ task :libxml2 => ['cross:zlib', 'cross:iconv', 'tmp/cross/bin/xml2-config']
134
+ task :libxslt => ['cross:libxml2', 'tmp/cross/bin/xslt-config']
135
+
136
+ task :copy_dlls do
137
+ Dir['tmp/cross/bin/*.dll'].each do |file|
138
+ cp file, "ext/nokogiri"
139
+ end
140
+ end
141
+
142
+ task :file_list => 'cross:copy_dlls' do
143
+ HOE.spec.extensions = []
144
+ HOE.spec.files += Dir["lib/#{HOE.name}/#{HOE.name}.rb"]
145
+ HOE.spec.files += Dir["lib/#{HOE.name}/1.{8,9}/#{HOE.name}.so"]
146
+ HOE.spec.files += Dir["ext/nokogiri/*.dll"]
147
+ end
148
+ end
149
+
150
+ CLOBBER.include("lib/nokogiri/nokogiri.{so,dylib,rb,bundle}")
151
+ CLOBBER.include("lib/nokogiri/1.{8,9}")
152
+ CLOBBER.include("ext/nokogiri/*.dll")
153
+
154
+ if Rake::Task.task_defined?(:cross)
155
+ Rake::Task[:cross].prerequisites << "lib/nokogiri/nokogiri.rb"
156
+ Rake::Task[:cross].prerequisites << "cross:file_list"
157
+ end
@@ -1,9 +1,3 @@
1
- def run_with_env(cmd)
2
- cmd = "LD_LIBRARY_PATH='#{ENV['LD_LIBRARY_PATH']}' #{cmd}"
3
- puts "=> #{cmd}"
4
- system cmd
5
- end
6
-
7
1
  namespace :test do
8
2
  desc "run test suite with aggressive GC"
9
3
  task :gc => :build do
@@ -8,6 +8,15 @@ module Nokogiri
8
8
  @parser = Nokogiri::CSS::Parser.new
9
9
  end
10
10
 
11
+ def test_not_simple_selector
12
+ assert_xpath('//ol/*[not(self::li)]', @parser.parse('ol > *:not(li)'))
13
+ end
14
+
15
+ def test_not_last_child
16
+ assert_xpath('//ol/*[not(position() = last())]',
17
+ @parser.parse('ol > *:not(:last-child)'))
18
+ end
19
+
11
20
  def test_function_calls_allow_at_params
12
21
  assert_xpath("//a[foo(., @href)]", @parser.parse('a:foo(@href)'))
13
22
  assert_xpath("//a[foo(., @a, b)]", @parser.parse('a:foo(@a, b)'))
@@ -1,6 +1,6 @@
1
1
  #Process.setrlimit(Process::RLIMIT_CORE, Process::RLIM_INFINITY) unless RUBY_PLATFORM =~ /(java|mswin|mingw)/i
2
2
  $VERBOSE = true
3
- require 'test/unit'
3
+ require 'minitest/autorun'
4
4
  require 'fileutils'
5
5
  require 'tempfile'
6
6
  require 'pp'
@@ -10,7 +10,7 @@ require 'nokogiri'
10
10
  warn "#{__FILE__}:#{__LINE__}: libxml version info: #{Nokogiri::VERSION_INFO.inspect}"
11
11
 
12
12
  module Nokogiri
13
- class TestCase < Test::Unit::TestCase
13
+ class TestCase < MiniTest::Spec
14
14
  ASSETS_DIR = File.expand_path File.join(File.dirname(__FILE__), 'files')
15
15
  XML_FILE = File.join(ASSETS_DIR, 'staff.xml')
16
16
  XSLT_FILE = File.join(ASSETS_DIR, 'staff.xslt')
@@ -26,18 +26,15 @@ module Nokogiri
26
26
  ADDRESS_XML_FILE = File.join(ASSETS_DIR, 'address_book.xml')
27
27
  SNUGGLES_FILE = File.join(ASSETS_DIR, 'snuggles.xml')
28
28
 
29
- unless RUBY_VERSION >= '1.9'
30
- undef :default_test
31
- end
32
-
33
- def setup
34
- warn "#{name}" if ENV['TESTOPTS'] == '-v'
35
- end
36
-
37
29
  def teardown
38
30
  if ENV['NOKOGIRI_GC']
39
31
  STDOUT.putc '!'
40
- GC.start
32
+ if RUBY_PLATFORM =~ /java/
33
+ require 'java'
34
+ java.lang.System.gc
35
+ else
36
+ GC.start
37
+ end
41
38
  end
42
39
  end
43
40
 
@@ -52,6 +49,47 @@ module Nokogiri
52
49
  assert_equal(0, len % amount, message)
53
50
  end
54
51
  end
52
+
53
+ def util_decorate(document, decorator_module)
54
+ document.decorators(XML::Node) << decorator_module
55
+ document.decorators(XML::NodeSet) << decorator_module
56
+ document.decorate!
57
+ end
58
+
59
+ #
60
+ # Test::Unit backwards compatibility section
61
+ #
62
+ alias :assert_no_match :refute_match
63
+ alias :assert_not_nil :refute_nil
64
+ alias :assert_raise :assert_raises
65
+ alias :assert_not_equal :refute_equal
66
+
67
+ def assert_nothing_raised(*args)
68
+ self._assertions += 1
69
+ if Module === args.last
70
+ msg = nil
71
+ else
72
+ msg = args.pop
73
+ end
74
+ begin
75
+ line = __LINE__; yield
76
+ rescue Exception => e
77
+ bt = e.backtrace
78
+ as = e.instance_of?(MiniTest::Assertion)
79
+ if as
80
+ ans = /\A#{Regexp.quote(__FILE__)}:#{line}:in /o
81
+ bt.reject! {|ln| ans =~ ln}
82
+ end
83
+ if ((args.empty? && !as) ||
84
+ args.any? {|a| a.instance_of?(Module) ? e.is_a?(a) : e.class == a })
85
+ msg = message(msg) { "Exception raised:\n<#{mu_pp(e)}>" }
86
+ raise MiniTest::Assertion, msg.call, bt
87
+ else
88
+ raise
89
+ end
90
+ end
91
+ nil
92
+ end
55
93
  end
56
94
 
57
95
  module SAX
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  require "helper"
2
3
 
3
4
  module Nokogiri
@@ -34,7 +35,7 @@ module Nokogiri
34
35
 
35
36
  def test_parse_file_non_existant
36
37
  assert_raise Errno::ENOENT do
37
- @parser.parse_file('foo')
38
+ @parser.parse_file('there_is_no_reasonable_way_this_file_exists')
38
39
  end
39
40
  end
40
41
 
@@ -50,6 +51,15 @@ module Nokogiri
50
51
  end
51
52
  end
52
53
 
54
+ def test_parse_force_encoding
55
+ @parser.parse_memory(<<-HTML, 'UTF-8')
56
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
57
+ Информация
58
+ HTML
59
+ assert_equal("Информация",
60
+ @parser.document.data.join.strip)
61
+ end
62
+
53
63
  def test_parse_document
54
64
  @parser.parse_memory(<<-eoxml)
55
65
  <p>Paragraph 1</p>
@@ -8,6 +8,14 @@ module Nokogiri
8
8
  @html = Nokogiri::HTML.parse(File.read(HTML_FILE))
9
9
  end
10
10
 
11
+ def test_exceptions_remove_newlines
12
+ errors = @html.errors
13
+ assert errors.length > 0, 'has errors'
14
+ errors.each do |error|
15
+ assert_equal(error.to_s.chomp, error.to_s)
16
+ end
17
+ end
18
+
11
19
  def test_fragment
12
20
  fragment = @html.fragment
13
21
  assert_equal 0, fragment.children.length
@@ -9,6 +9,18 @@ module Nokogiri
9
9
  @html = Nokogiri::HTML.parse(File.read(HTML_FILE), HTML_FILE)
10
10
  end
11
11
 
12
+ def test_no_contextual_parsing_on_unlinked_nodes
13
+ node = @html.css('body').first
14
+ node.unlink
15
+ assert_raises(RuntimeError) do
16
+ node.parse('<br />')
17
+ end
18
+ end
19
+
20
+ def test_parse_in_context
21
+ assert_equal('<br>', @html.root.parse('<br />').to_s)
22
+ end
23
+
12
24
  def test_ancestors_search
13
25
  html = %q{
14
26
  <div>
@@ -91,9 +103,9 @@ module Nokogiri
91
103
  end
92
104
 
93
105
  def test_html_fragment_case_insensitivity
94
- doc = "<crazyDiv>b</crazyDiv>"
106
+ doc = "<Div>b</Div>"
95
107
  fragment = Nokogiri::HTML::Document.new.fragment(doc)
96
- assert_equal "<crazydiv>b</crazydiv>", fragment.to_s
108
+ assert_equal "<div>b</div>", fragment.to_s
97
109
  end
98
110
 
99
111
  def test_html_fragment_with_leading_whitespace
@@ -56,7 +56,11 @@ module Nokogiri
56
56
 
57
57
  def test_subelements
58
58
  sub_elements = ElementDescription['body'].sub_elements
59
- assert_equal 61, sub_elements.length
59
+ if Nokogiri::LIBXML_VERSION == '2.7.7'
60
+ assert_equal 65, sub_elements.length
61
+ else
62
+ assert_equal 61, sub_elements.length
63
+ end
60
64
  end
61
65
 
62
66
  def test_default_sub_element
@@ -17,6 +17,10 @@ module Nokogiri
17
17
  eohtml
18
18
  end
19
19
 
20
+ def test_to_a
21
+ assert_equal [['class', 'bar'], ['href', 'foo']],@html.at('a').to_a.sort
22
+ end
23
+
20
24
  def test_attr
21
25
  node = @html.at('div.baz')
22
26
  assert_equal node['class'], node.attr('class')
@@ -64,18 +68,6 @@ module Nokogiri
64
68
  assert_equal 'a', desc.name
65
69
  end
66
70
 
67
- def test_add_next_sibling_with_empty_nodeset
68
- assert_raises(ArgumentError) {
69
- @html.at('a').add_next_sibling(@html.at('head').children)
70
- }
71
- end
72
-
73
- def test_add_next_sibling_with_non_empty_nodeset
74
- assert_raises(ArgumentError) {
75
- @html.at('head').add_next_sibling(@html.at('div').children)
76
- }
77
- end
78
-
79
71
  def test_ancestors_with_selector
80
72
  assert node = @html.at('a.bar').child
81
73
  assert list = node.ancestors('.baz')
@@ -135,35 +127,9 @@ module Nokogiri
135
127
  assert_equal 'foo&bar&baz', node['href']
136
128
  end
137
129
 
138
-
139
- def test_before_will_prepend_text_nodes
140
- assert node = @html.at('//body').children.first
141
- node.before "some text"
142
- assert_equal 'some text', @html.at('//body').children[0].content.strip
143
- end
144
-
145
- def test_before
146
- @html.at('//div').before('<a href="awesome">town</a>')
147
- assert_equal 'awesome', @html.at('//div').previous['href']
148
- end
149
-
150
130
  def test_fragment_handler_does_not_regurge_on_invalid_attributes
151
131
  iframe = %Q{<iframe style="width: 0%; height: 0px" src="http://someurl" allowtransparency></iframe>}
152
- assert_nothing_raised { @html.at('div').before(iframe) }
153
- assert_nothing_raised { @html.at('div').after(iframe) }
154
- assert_nothing_raised { @html.at('div').inner_html=(iframe) }
155
- end
156
-
157
- def test_inner_html=
158
- assert div = @html.at('//div')
159
- div.inner_html = '1<span>2</span>3'
160
- assert_equal '1', div.children[0].to_s
161
- assert_equal 'span', div.children[1].name
162
- assert_equal '2', div.children[1].inner_text
163
- assert_equal '3', div.children[2].to_s
164
-
165
- div.inner_html = 'testing'
166
- assert_equal 'testing', div.content
132
+ assert_nothing_raised { @html.at('div').fragment(iframe) }
167
133
  end
168
134
 
169
135
  def test_fragment
@@ -190,33 +156,6 @@ module Nokogiri
190
156
  assert_equal "<div>foo</div>", fragment.to_s
191
157
  end
192
158
 
193
- def test_after_will_append_text_nodes
194
- assert node = @html.at('//body/div')
195
- node.after "some text"
196
- assert_equal 'some text', node.next.text.strip
197
- end
198
-
199
- def test_after
200
- @html.at('//div').after('<a href="awesome">town</a>')
201
- assert_equal 'awesome', @html.at('//div').next['href']
202
- end
203
-
204
- def test_replace
205
- doc = Nokogiri::HTML(<<-eohtml)
206
- <html>
207
- <head></head>
208
- <body>
209
- <center><img src='logo.gif' /></center>
210
- </body>
211
- </html>
212
- eohtml
213
- center = doc.at("//center")
214
- img = center.search("//img")
215
- assert_raises ArgumentError do
216
- center.replace img
217
- end
218
- end
219
-
220
159
  def test_to_html_does_not_contain_entities
221
160
  return unless defined?(NKF) # NKF is not implemented on Rubinius as of 2009-11-23
222
161
  html = NKF.nkf("-e --msdos", <<-EOH)