Skip to content

Commit 8a8527e

Browse files
committed
Test cleanup
1 parent 8ce436c commit 8a8527e

5 files changed

Lines changed: 12 additions & 55 deletions

File tree

test/test_canonicalize.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ def test_canonicalize_with_w3c_c14n_3_1
2424
expected_1_1_without_comments = IO.read(self.path('c14n/result/1-1-without-comments/example-1'))
2525
mode = LibXML::XML::Document::XML_C14N_1_1
2626
assert_equal(expected_1_1_without_comments, given_doc.canonicalize(:mode => mode))
27-
end#test_canonicalize_with_w3c_c14n_3_1
28-
27+
end
2928

3029
# (www.w3.org) 3.2 Whitespace in Document Content
3130
# http://www.w3.org/TR/xml-c14n#Example-WhitespaceInContent
@@ -106,15 +105,15 @@ def test_canonicalize_with_w3c_c14n_3_6
106105
# http://www.w3.org/TR/xml-c14n#Example-DocSubsets
107106
def test_canonicalize_with_w3c_c14n_3_7
108107
# Non Canonicalized Document
109-
# given_doc = LibXML::XML::Document.file(self.path('c14n/given/example-7.xml'))
110-
#expected = IO.read(self.path('c14n/result/without-comments/example-7'))
108+
given_doc = LibXML::XML::Document.file(self.path('c14n/given/example-7.xml'))
109+
expected = IO.read(self.path('c14n/result/without-comments/example-7'))
111110

112-
# e1_node = given_doc.find_first('ietf:e1', 'ietf:http://www.ietf.org')
111+
e1_node = given_doc.find_first('ietf:e1', 'ietf:http://www.ietf.org')
113112

114113
# Select current node, all child nodes, all attributes and namespace nodes
115-
#subdoc_nodes = e1_node.find("(.//.|.//@id|namespace::*)")
114+
subdoc_nodes = e1_node.find("(.//.|.//@id|namespace::*)")
116115

117116
# TODO - This fails because the namespace nodes aren't taken into account
118-
# assert_equal(expected, given_doc.canonicalize(:nodes => subdoc_nodes))
117+
assert_equal(expected, given_doc.canonicalize(:nodes => subdoc_nodes))
119118
end
120119
end

test/test_deprecated_require.rb

Lines changed: 0 additions & 12 deletions
This file was deleted.

test/test_document.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ def test_compression
4949
end
5050

5151
-1.downto(-10) do |i|
52-
# assert_equal(0, @doc.compression = i)
53-
assert_equal(i, @doc.compression = i) # FIXME This bug should get fixed ASAP
5452
assert_equal(0, @doc.compression)
5553
end
5654
end

test/test_html_parser.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,14 @@ def test_parse
138138
end
139139

140140
def test_no_implied
141-
skip("NOIMPLIED behavior changed in libxml2 2.14+") if Gem::Version.new(LibXML::XML::LIBXML_VERSION) >= Gem::Version.new("2.14")
142141
html = "hello world"
143142
parser = LibXML::XML::HTMLParser.string(html, :options => LibXML::XML::HTMLParser::Options::NOIMPLIED)
144143
doc = parser.parse
145-
assert_equal("<p>#{html}</p>", doc.root.to_s)
144+
if Gem::Version.new(LibXML::XML::LIBXML_VERSION) >= Gem::Version.new("2.14")
145+
assert_nil(doc.root)
146+
else
147+
assert_equal("<p>#{html}</p>", doc.root.to_s)
148+
end
146149
end
147150

148151
def test_comment

test/test_parser.rb

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -220,38 +220,7 @@ def test_string_encoding
220220
assert_equal(Encoding::UTF_8, node.content.encoding)
221221
assert_equal("m\303\266tley_cr\303\274e", node.content)
222222
end
223-
224-
def test_fd_gc
225-
skip
226-
# Test opening # of documents up to the file limit for the OS.
227-
# Ideally it should run until libxml emits a warning,
228-
# thereby knowing we've done a GC sweep. For the time being,
229-
# re-open the same doc `limit descriptors` times.
230-
# If we make it to the end, then we've succeeded,
231-
# otherwise an exception will be thrown.
232-
LibXML::XML::Error.set_handler {|error|}
233-
234-
max_fd = if RUBY_PLATFORM.match(/mswin32|mswin64|mingw/i)
235-
500
236-
else
237-
Process.getrlimit(Process::RLIMIT_NOFILE)[0] + 1
238-
end
239-
240-
file = File.join(File.dirname(__FILE__), 'model/rubynet.xml')
241-
max_fd.times do
242-
LibXML::XML::Parser.file(file).parse
243-
end
244-
LibXML::XML::Error.reset_handler {|error|}
245-
end
246-
247-
def test_open_many_files
248-
file = File.expand_path(File.join(File.dirname(__FILE__), 'model/atom.xml'))
249-
1000.times do
250-
LibXML::XML::Parser.file(file).parse
251-
end
252-
end
253-
254-
# ----- Errors ------
223+
255224
def test_error
256225
error = assert_raises(LibXML::XML::Error) do
257226
LibXML::XML::Parser.string('<foo><bar/></foz>').parse

0 commit comments

Comments
 (0)