diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-09-17 13:14:14 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-09-17 13:14:14 +0000 |
commit | 91ed484f92040e5c2006a3a00ec77a54d552cf37 (patch) | |
tree | 03fd6677a85aaad516d0c9464b1273ea107231b7 /test/rexml/test_preceding_sibling.rb | |
parent | 045491d5be06b615d66d3f66cca2b5d2bc3c1929 (diff) | |
download | ruby-91ed484f92040e5c2006a3a00ec77a54d552cf37.tar.gz |
* test/rexml/: import REXML tests from
http://www.germane-software.com/repos/rexml/trunk/test/.
Many tests are failed temporary. I'll fix them quickly. Sorry.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rexml/test_preceding_sibling.rb')
-rw-r--r-- | test/rexml/test_preceding_sibling.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/rexml/test_preceding_sibling.rb b/test/rexml/test_preceding_sibling.rb new file mode 100644 index 0000000000..c892b9400e --- /dev/null +++ b/test/rexml/test_preceding_sibling.rb @@ -0,0 +1,40 @@ +# ISSUE 32 +require 'test/unit' +require 'rexml/document' + +p [REXML::VERSION, RUBY_VERSION, RUBY_RELEASE_DATE] + +# daz - for report by Dan Kohn in: +# http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/156328 +class XPathTesterDd < Test::Unit::TestCase + include REXML + + def setup + @@docDd = Document.new(<<-EOS, :ignore_whitespace_nodes => :all) + <a> + <b x='ab01A'> + <c y='abc01A'>Success</c> + </b> + <b x='ab02A' y='ab02B'> + <c>abc02C</c> + </b> + </a> + EOS + end + + def test_Dd_preceding_sibling_children + arr = [] + XPath.each(@@docDd, "//b[@x='ab02A']/preceding-sibling::b/child::*") do |cell| + arr << cell.texts.join + end + assert_equal( 'Success', arr.join ) + end + + def test_Dd_preceding_sibling_all + arr = [] + XPath.each(@@docDd, "//b[@x='ab02A']/preceding-sibling::*") do |cell| + arr << cell.to_s + end + assert_equal( "<b x='ab01A'><c y='abc01A'>Success</c></b>", arr.join ) + end +end |