diff options
author | Kouhei Sutou <kou@clear-code.com> | 2019-05-25 17:06:53 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2019-08-04 11:55:31 +0900 |
commit | 6ef82943978ea5816a91c32e9ff822c73d1935f9 (patch) | |
tree | f04b130680d6817b4941e74d212df6faccd02e9a /test/rexml/xpath/test_base.rb | |
parent | c46ba8e9a3b1b6c13232c1af3e9f2efd4a3eec98 (diff) |
[ruby/rexml] xpath: fix a bug for equality or relational expressions
GitHub: fix #17
There is a bug when they are used against node set. They should return
boolean value but they returned node set.
Reported by Mirko Budszuhn. Thanks!!!
https://github.com/ruby/rexml/commit/a02bf38440
Diffstat (limited to 'test/rexml/xpath/test_base.rb')
-rw-r--r-- | test/rexml/xpath/test_base.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/rexml/xpath/test_base.rb b/test/rexml/xpath/test_base.rb index 5a03087ca6..210d6c7c81 100644 --- a/test/rexml/xpath/test_base.rb +++ b/test/rexml/xpath/test_base.rb @@ -369,11 +369,15 @@ module REXMLTests assert_equal 2, c end + def match(xpath) + XPath.match(@@doc, xpath).collect(&:to_s) + end + def test_grouping - t = XPath.first( @@doc, "a/d/*[name()='d' and (name()='f' or name()='q')]" ) - assert_nil t - t = XPath.first( @@doc, "a/d/*[(name()='d' and name()='f') or name()='q']" ) - assert_equal 'q', t.name + assert_equal([], + match("a/d/*[name()='d' and (name()='f' or name()='q')]")) + assert_equal(["<q id='19'/>"], + match("a/d/*[(name()='d' and name()='f') or name()='q']")) end def test_preceding |