I get errors when running "rake1.9 test" (using Ruby 1.9.1p243):
/usr/src/ruby/nokogiri1.9# rake1.9
(in /usr/src/ruby/nokogiri1.9)
warning: couldn't activate the debugging plugin, skipping
cp tmp/x86_64-linux/nokogiri/1.9.1/nokogiri.so lib/nokogiri/nokogiri.so
/usr/local/bin/ruby1.9 -w -Ilib:ext:bin:test -e 'require "rubygems";
require "test/unit"; require "test/css/test_nthiness.rb"; require
"test/css/test_parser.rb"; require "test/css/test_tokenizer.rb";
require "test/css/test_xpath_visitor.rb"; require
"test/ffi/test_document.rb"; require "test/html/sax/test_parser.rb";
require "test/html/sax/test_parser_context.rb"; require
"test/html/test_builder.rb"; require "test/html/test_document.rb";
require "test/html/test_document_encoding.rb"; require
"test/html/test_document_fragment.rb"; require
"test/html/test_element_description.rb"; require
"test/html/test_named_characters.rb"; require
"test/html/test_node.rb"; require "test/html/test_node_encoding.rb";
require "test/test_convert_xpath.rb"; require
"test/test_css_cache.rb"; require "test/test_gc.rb"; require
"test/test_memory_leak.rb"; require "test/test_nokogiri.rb"; require
"test/test_reader.rb"; require "test/test_xslt_transforms.rb"; require
"test/xml/node/test_save_options.rb"; require
"test/xml/node/test_subclass.rb"; require
"test/xml/sax/test_parser.rb"; require
"test/xml/sax/test_parser_context.rb"; require
"test/xml/sax/test_push_parser.rb"; require "test/xml/test_attr.rb";
require "test/xml/test_attribute_decl.rb"; require
"test/xml/test_builder.rb"; require "test/xml/test_cdata.rb"; require
"test/xml/test_comment.rb"; require "test/xml/test_document.rb";
require "test/xml/test_document_encoding.rb"; require
"test/xml/test_document_fragment.rb"; require "test/xml/test_dtd.rb";
require "test/xml/test_dtd_encoding.rb"; require
"test/xml/test_element_content.rb"; require
"test/xml/test_element_decl.rb"; require
"test/xml/test_entity_decl.rb"; require
"test/xml/test_entity_reference.rb"; require
"test/xml/test_namespace.rb"; require "test/xml/test_node.rb"; require
"test/xml/test_node_attributes.rb"; require
"test/xml/test_node_encoding.rb"; require "test/xml/test_node_set.rb";
require "test/xml/test_parse_options.rb"; require
"test/xml/test_processing_instruction.rb"; require
"test/xml/test_reader_encoding.rb"; require
"test/xml/test_relax_ng.rb"; require "test/xml/test_schema.rb";
require "test/xml/test_syntax_error.rb"; require
"test/xml/test_text.rb"; require "test/xml/test_unparented_node.rb";
require "test/xml/test_xpath.rb"'
/usr/local/lib/ruby1.9/1.9.1/test/unit/assertions.rb:31: warning:
shadowing outer local variable - line
/usr/src/ruby/nokogiri1.9/lib/nokogiri/xml/fragment_handler.rb:33:
warning: shadowing outer local variable - ns
/usr/src/ruby/nokogiri1.9/lib/nokogiri/css/generated_parser.rb:645:
warning: mismatched indentations at 'end' with 'module' at 11
/usr/src/ruby/nokogiri1.9/lib/nokogiri/css/generated_parser.rb:646:
warning: mismatched indentations at 'end' with 'module' at 10
/usr/src/ruby/nokogiri1.9/test/helper.rb:14: libxml version info:
{"warnings"=>[], "nokogiri"=>"1.3.3",
"libxml"=>{"binding"=>"extension", "compiled"=>"2.6.32",
"loaded"=>"2.6.32"}}
/usr/src/ruby/nokogiri1.9/test/xml/test_document_fragment.rb:120:
warning: shadowing outer local variable - ns
/usr/src/ruby/nokogiri1.9/test/xml/test_node.rb:358: warning:
shadowing outer local variable - ns
Loaded suite -e
Started
....................................................................................................................................................FE...............................................................F.............................................................................................................F..................................................................EF..................................................................................................................................................................FF.F..................................................................................................................................................................................................................................................
Finished in 4.146061 seconds.
1) Failure:
test_default_to_encoding_from_string(Nokogiri::HTML::TestDocumentEncoding)
[/usr/src/ruby/nokogiri1.9/test/html/test_document_encoding.rb:35]:
<"UTF-8"> expected but was
<"charset=UTF-8">.
2) Error:
test_encoding(Nokogiri::HTML::TestDocumentEncoding):
Encoding::CompatibilityError: incompatible encoding regexp match
(Shift_JIS regexp with UTF-8 string)
/usr/src/ruby/nokogiri1.9/test/html/test_document_encoding.rb:14:in
`test_encoding'
3) Failure:
test_inner_html(Nokogiri::HTML::TestNodeEncoding)
[/usr/src/ruby/nokogiri1.9/test/html/test_node_encoding.rb:14]:
<"Shift_JIS"> expected but was
<"UTF-8">.
4) Failure:
test_entities(Nokogiri::XML::TestDTDEncoding)
[/usr/src/ruby/nokogiri1.9/test/xml/test_dtd_encoding.rb:17]:
<nil> expected but was
<"UTF-8">.
5) Error:
test_encoding(Nokogiri::XML::TestDocumentEncoding):
NoMethodError: undefined method `encoding' for nil:NilClass
/usr/src/ruby/nokogiri1.9/test/xml/test_document_encoding.rb:17:in
`test_encoding'
6) Failure:
test_url(Nokogiri::XML::TestDocumentEncoding)
[/usr/src/ruby/nokogiri1.9/test/xml/test_document_encoding.rb:13]:
<nil> expected but was
<"UTF-8">.
7) Failure:
test_namespace(Nokogiri::XML::TestNodeEncoding)
[/usr/src/ruby/nokogiri1.9/test/xml/test_node_encoding.rb:72]:
<"UTF-8"> expected but was
<nil>.
8) Failure:
test_namespace_as_hash(Nokogiri::XML::TestNodeEncoding)
[/usr/src/ruby/nokogiri1.9/test/xml/test_node_encoding.rb:91]:
<"UTF-8"> expected but was
<nil>.
9) Failure:
test_serialize_encoding_html(Nokogiri::XML::TestNodeEncoding)
[/usr/src/ruby/nokogiri1.9/test/xml/test_node_encoding.rb:28]:
<"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html
xmlns=\"http://www.w3.org/1999/xhtml\"
xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <meta
http-equiv=\"Content-Type\" content=\"text/html; charset=Shift_JIS\"
/>\n <meta http-equiv=\"Content-Script-Type\"
content=\"text/javascript\" />\n <meta
http-equiv=\"Content-Style-Type\" content=\"text/css\" />\n <meta
name=\"Description\" content=\"「ハッキング」から�\x80�今晩のおかず�\x80�ま
でを手広くカバーする巨大掲示板群『2ちゃんねる�\x80�へようこそ��\x81\" />\n <meta
name=\"KeyWords\" content=\"2ちゃんね��\x8B, 掲示板, 2ch, BBS\" />\n <meta
name=\"Author\" content=\"2ちゃんね��\x8B\" />\n <meta
name=\"verify-v1\"
content=\"hMevVuWJIPYrUj9ItfRJByoLNIpyhnrWaywiH+IFocU=\" />\n
<title>2ちゃんねる掲示板へようこそ</title>\n
<style type=\"text/css\" media=\"all\">\n<![CDATA[\n@import
url(2ch_top.css);\n]]>\n </style>\n
<script>\n<![CDATA[\n<!--\nfunction
fcs(){document.f.STR.focus();}\n-->\n]]>\n </script>\n </head>\n
<body onload=\"document.f.STR.focus()\">\n\n<div id=\"wrapper\">\n<div
id=\"header\">\n<div id=\"header_inside\">\n<div
class=\"header_left\">\n<a href=\"http://www2.2ch.net/2ch.html\"><img
src=\"images/2ch_logo.gif\" width=\"151\" height=\"40\"
alt=\"2ちゃんね��\x8B\" align=\"middle\" border=\"0\" /></a><a
href=\"http://www2.2ch.net/2ch.html\">掲示板</a>|\n<a
href=\"http://c.2ch.net/\">imode</a>|<a
href=\"http://orz.2ch.io/top.html\">携帯orz</a>|<a
href=\"http://p2.2ch.net/\">ビューアp2</a>\n</div>\n\n<div
class=\"senna_banner\">\n\n<a
href=\"http://razil.jp/product/senna/\"><img
src=\"images/senna88x31.gif\" width=\"88\" height=\"31\" alt=\"Senna\"
align=\"middle\" border=\"0\" /></a>\n</div>\n<div
class=\"header_right\">\n<!---find 2ch form --->\n<form method=\"GET\"
name=\"f\" action=\"http://find.2ch.net/\" style=\"margin:0px\"
id=\"f\">\n<input size=\"25\" name=\"STR\" value=\"\"
class=\"form_input\" /><select name=\"TYPE\"
class=\"form_select\"><option
value=\"BODY\">本文</option><option value=\"TITLE\"
selected=\"selected\">スレッドタイトル</option><option
value=\"POSTERS\">投稿者</option></select><input
type=\"image\" src=\"images/search_button.gif\" alt=\"検索\"
class=\"form_button\" /><br /><input type=\"hidden\" name=\"BBS\"
value=\"ALL\" /><input type=\"hidden\" name=\"ENCODING\"
value=\"SJIS\" /><input type=\"hidden\" name=\"COUNT\" value=\"50\"
/><div class=\"caption\">本文検索や検索設定は<a
href=\"http://find.2ch.net/moritapo/notlogin.php\">ログイン</a><a
href=\"http://find.2ch.net/moritapo/welcome/\">»詳細</a></div>\n\n</form>\n</div>\n</div><!---
header_inside --->\n</div><!--- end of header--->\n\n<div
id=\"under_header\">\n<a
href=\"http://newsnavi.2ch.net/\">ニュース</a>|<a
href=\"http://headline.2ch.net/bbynews/\">ヘッドライン</a>|<a
href=\"http://epg.2ch.net/\">テレビ欄</a>|<a
href=\"http://www.2ch.net/kakolog.html\">過去ログ倉庫</a>\n\n</div><!---
end of under header--->\n\n<div id=\"main\">\n<iframe
src=\"http://cast.texpo.jp/2chtop/main_frame.html\" width=\"100%\"
height=\"550\" scrolling=\"no\" border=\"0\"
frameborder=\"0\"></iframe>\n</div><!--- end of main--->\n\n<div
id=\"footer_menu\">\n<div class=\"guide\">\n<a
href=\"http://info.2ch.net/guide/\">使い方&注意</a>|<a
href=\"http://info.2ch.net/guide/adv.html#saku_guide\">削除ガイドライン</a>|<a
href=\"http://www2.2ch.net/2ch2.html\">拡張版メニュー</a>|<a
href=\"http://info.2ch.net/blog.html\">ひろゆき日記</a>|<a
href=\"http://www.2ch.net/ad.html\">広告のご案内</a>\n\n</div>\n\n<div
class=\"service\">\n<iframe
src=\"http://cast.texpo.jp/2chtop/moritapo_frame.html\" width=\"100%\"
height=\"50\" scrolling=\"no\" border=\"0\"
frameborder=\"0\"></iframe>\n</div>\n\n<div class=\"banner\">\n<a
href=\"http://livede55.com/\" target=\"_blank\"><img
src=\"http://www2.livede55.com/2ch_468_60_13.gif\" width=\"468\"
height=\"60\" border=\"0\" alt=\"ライブチャット\" /></a><br /><br /><a
href=\"http://www.bb-chat.tv/\" target=\"_blank\"><img height=\"60\"
src=\"http://img.bbchat.tv/images/bannar/46860-3.gif\" width=\"468\"
border=\"0\" /></a><br /></div>\n\n<div
class=\"condition\">\n2ちゃんねるのご利用は利用者各位のご判断にお任せしています|<a
href=\"precautions.html\">2chのデータ利用について</a>\n\n</div>\n</div><!---
end of footer_menu--->\n\n\n<div id=\"footer\">\n<div
class=\"footer_left\">\n<a href=\"http://www.bunka.go.jp/jiyuriyo/\"
target=\"_blank\">\n<img
src=\"http://www.dd.iij4u.or.jp/‾cap/y_3copyok.jpg\" width=\"184\"
height=\"31\" border=\"0\" alt=\"自由利用マーク\" /></a>\n</div>\n\n<div
class=\"footer_right\">\n<a href=\"http://count.2ch.net/?index\"
target=\"_blank\">\n<img src=\"http://count.2ch.net/ct.php/index\"
width=\"88\" height=\"31\" border=\"0\" alt=\"ちゃっかりカウンター\"
/></a>\n\n\n</div>\n</div><!---end of footer--->\n\n</div><!--- end of
wrapper--->\n</body>\n</html>\n"> expected but was
<"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html
xmlns=\"http://www.w3.org/1999/xhtml\"
xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <meta
http-equiv=\"Content-Type\" content=\"text/html; charset=Shift_JIS\"
/>\n <meta http-equiv=\"Content-Script-Type\"
content=\"text/javascript\" />\n <meta
http-equiv=\"Content-Style-Type\" content=\"text/css\" />\n <meta
name=\"Description\" content=\"縲後ワ繝く繝ウ繧ー縲阪°繧峨\" />\n
</head>\n</html>\n">.
790 tests, 2357 assertions, 7 failures, 2 errors, 0 skips
rake aborted!
Command failed with status (1): [/usr/local/bin/ruby1.9 -w -Ilib:ext:bin:te...]
--
Iñaki Baz Castillo
<i...@aliax.net>
I don't. :-)
You might need to upgrade libxml2. Encoding handling was a little
broken in older versions of libxml2.
--
Aaron Patterson
http://tenderlovemaking.com/
I've the following version of libxml2 (Debian Lenny 64 bits):
libxml2 2.6.32.dfsg-5+lenny1
libxml2-dev 2.6.32.dfsg-5+lenny1
Could you please tell me the required version? Thanks.
I've installed right now libxml2 2.7.6.dfsg-1 (Debian Sid version) and
it still fails but gets less errors:
1) Error:
test_encoding(Nokogiri::HTML::TestDocumentEncoding):
Encoding::CompatibilityError: incompatible encoding regexp match
(Shift_JIS regexp with UTF-8 string)
/usr/src/ruby/nokogiri1.9/test/html/test_document_encoding.rb:14:in
`test_encoding'
2) Failure:
test_to_xhtml(Nokogiri::HTML::TestDocumentFragment)
[/usr/src/ruby/nokogiri1.9/test/html/test_document_fragment.rb:95]:
<"<span>foo<br /></span><span>bar</span>"> expected but was
<"<span>foo<br></span><span>bar</span>">.
3) Failure:
test_inner_html(Nokogiri::HTML::TestNodeEncoding)
[/usr/src/ruby/nokogiri1.9/test/html/test_node_encoding.rb:14]:
<"Shift_JIS"> expected but was
<"UTF-8">.
790 tests, 2371 assertions, 2 failures, 1 errors, 0 skips
However, how is possible that the available gem version passes all the
tests on my system?
Ops, after doing "rake1.9 clean" then "rake1.9 test" passes all the tests :)
I forgot to re-compile :)
Ya, try with libxml2 2.7.6. That's the version I'm using.
It could be that you need to upgrade libiconv as well. I'm running:
libiconv @1.13 textproc/libiconv
I have no such package installed. In fact, in Debian Lenny there is a
dummy package called "libiconv-ruby" and installs nothing since it's
already included in libruby package.
You must have libiconv somewhere. libxml2 needs to link against it.
I'm not familiar with debian packages, so it might be named something
different.