Граф коммитов

153 Коммитов

Автор SHA1 Сообщение Дата
kou 1d67b9de28 rexml: disable XPath 1.0 compatible "#{ELEMENT_NAME}" processing by default
It breaks backward compatibility than I thought. So it's disabled by
default. It means that REXML's XPath processor isn't compatible with
XPath 1.0. But it will be acceptable for users.

We can enable it by specifying "strict: true" to
REXML::XPathParser.new explicitly.

* lib/rexml/xpath.rb,
  lib/rexml/xpath_parser.rb: Accept "strict: true" option.

* test/rexml/test_contrib.rb,
  test/rexml/xpath/test_base.rb: Use not XPath 1.0 compatible behavior.

* test/rexml/test_jaxen.rb: Use XPath 1.0 compatible behavior.

* test/rss/test_1.0.rb,
  test/rss/test_dublincore.rb,
  spec/ruby/library/rexml/element/namespace_spec.rb,
  spec/ruby/library/rexml/element/namespaces_spec.rb,
  spec/ruby/library/rexml/element/prefixes_spec.rb: Enable again.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-28 01:36:18 +00:00
kou 7a6f34103d rexml: Fix XPath bug of //#{ELEMENT_NAME}[#{POSITION}]
The position should be counted for each nodeset but the previous
implementation counts position for union-ed nodeset.

For example, "/a/*/*[1]" should be matched to "<c1/>" and "<c2/>" with
the following XML.

    <a>
      <b>
        <c1/>
      </b>
      <b>
        <c2/>
      </b>
    </a>

But the previous implementation just returns only "<c1/>".

* lib/rexml/element.rb (REXML::Attributes#each_attribute):
  Support Enumerator for no block use.

* lib/rexml/element.rb (REXML::Attributes#each):
  Support Enumerator for no block use.

* lib/rexml/functions.rb (REXML::Functions.string):
  Support NaN again.

* lib/rexml/xpath_parser.rb: Re-implement "Step" evaluator.
  It should evaluate "AxisSpecifier", "NodeTest" and "Predicate" in one
  step to respect position for each nodeset.

* test/rexml/test_jaxen.rb: Enable more tests. Remained tests should
  be also enabled but it'll not be near future.

* test/rexml/xpath/test_base.rb: Fix expected value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-22 09:38:06 +00:00
kou 4d15e619eb rexml: Fix XPath bug of /#{ELEMENT_NAME}
It doesn't mean that all elements which name "ELEMENT_NAME" with any
namespace URI including null namespace URI. It means that all elements
which name "ELEMENT_NAME" with null namespace URI.

https://www.w3.org/TR/1999/REC-xpath-19991116/#NT-NodeTest

> if the QName does not have a prefix, then the namespace URI is null
> (this is the same way attribute names are expanded).

We need to use "*[local-name()='#{ELEMENT_NAME}']" for all elements
which name "ELEMENT_NAME" with any namespace URI including null
namespace URI in XPath 1.0. But it's inconvenient. So this change
includes "*:#{LOCAL_NAME}" syntax support that is introduced since
XPath 2.0.

* lib/rexml/parsers/xpathparser.rb: Support "*:#{LOCAL_NAME}" syntax that
  is introduced since XPath 2.0.

* lib/rexml/xpath_parser.rb:
  * Fix namespace URI processing for "#{ELEMENT_NAME}". Now,
    "#{ELEMENT_NAME}" doesn't accept elements with null namespace URI.
  * Add "*:#{LOCAL_NAME}" support.

* test/rexml/test_contrib.rb,
  test/rexml/test_core.rb,
  test/rexml/xpath/test_base.rb: Follow this change.

* test/rexml/test_jaxen.rb: Fix namespace processing.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-22 08:09:04 +00:00
kou ee29985ded rexml: Enable more tests
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 06:45:42 +00:00
kou da89931dcc rexml: Fix XPath concat() implementation
* lib/rexml/functions.rb (REXML::Functions.concat): Implement.

* test/rexml/test_jaxen.rb: Enable one more test.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 06:43:58 +00:00
kou 6793c0a227 rexml: Fix XPath string() implementation
* lib/rexml/functions.rb( REXML::Functions.string):
  * Support context node.
  * Fix implementation for document node to remove out of root nodes.
  * Support processing instruction node.
  * Improve implementation for integer to omit decimals.

* test/rexml/test_jaxen.rb: Enable processing instruction test.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 06:39:43 +00:00
kou e044924ee5 rexml: Make more readable
test/rexml/test_jaxen.rb: Use more meaningful name.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 06:21:41 +00:00
kou 1992cec52d rexml: Fix a test bug
test/rexml/test_jaxen.rb: Fix wrong assert_raise usage. Note that this code
isn't used yet.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 06:21:02 +00:00
kou daec80fe98 rexml: Make more readable
test/rexml/xpath/test_base.rb: Use here document for readability.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21 06:18:08 +00:00
kou 9090241e61 rexml: Fix a XPath bug that white spaces aren't ignored
lib/rexml/parsers/xpathparser.rb: Ignore white spaces in relative
location path.

test/rexml/xpath/test_base.rb: Add more test patterns and use more
debug friendly assertion style.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 21:34:40 +00:00
kou 632e10cad3 rexml: Fix wrong assertion
test/rexml/xpath/test_base.rb: Use constant value for the expected value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 20:51:07 +00:00
kou 8257fcb1db rexml: Use more debug friendly assertion style
test/rexml/xpath/test_base.rb: Expand loop assertion and stop to checking
just the first value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 20:49:53 +00:00
kou b5321ba446 rexml: Use more debug friendly assertion style
test/rexml/xpath/test_base.rb: Stop to use separated assertions for
checking array value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 20:48:28 +00:00
kou be000dcc15 rexml: Make more readable
test/rexml/xpath/test_base.rb: Use here document for XML.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19 20:45:16 +00:00
kou e440bfaed1 rexml: Fix a XPath bug of /child::node()
[Bug #14600]
    
* lib/rexml/xpath_parser.rb: Fix a bug that "/child::node()" returns
  XML declaration and text nodes out of root element.

* test/rexml/test_jaxen.rb: Enable more tests.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-04 06:53:57 +00:00
kou b537823f3d rexml: Fix a XPath bug of @attribute/parent
[Bug #14600]
    
* lib/rexml/functions.rb: Fix a bug that "@attribute/parent" doesn't
  return element of its attribute.

* test/rexml/test_jaxen.rb: Enable more tests.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-04 03:27:20 +00:00
kou c592ce4023 rexml: Fix a XPath bug of name(node-set)
[Bug #14600]
    
* lib/rexml/functions.rb: Fix a bug that "name(node-set)" returns
  element instead of element name.
  
* test/rexml/test_jaxen.rb: Enable more tests.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-03 15:51:08 +00:00
kou f0c734660f Start re-enabling Jaxen tests
[Bug #14600]
Reported by MSP-Greg. Thanks!!!

* lib/rexml/xpath_parser.rb: Fix a bug that "following_siblings::*[N]"
  doesn't work.

* test/rexml/test_jaxen.rb: Enable only axis test for now.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-01 16:17:52 +00:00
nobu dd3851d278 Rename test classes to allow stable test count when running test-all -j
[Fix GH-1763]

From: MSP-Greg <MSP-Greg@users.noreply.github.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-13 06:29:02 +00:00
kou 2bbc30520f REXML: Fix a bug that unexpected methods can be called as a XPath function
[HackerOne:249295]

Reported by Andrea Jegher. Thanks!!!


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-13 12:14:24 +00:00
kou d311921d31 rexml: add close tag check on end of document to StreamParser
[ruby-core:81593] [Bug #13636]

Reported by Anton Sivakov. Thanks!!!


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-07 13:01:28 +00:00
kou b23eac6958 rexml: REXML::Element#[] accepts String or Symbol as attribute name
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-06 13:57:56 +00:00
nobu 7e9112a441 Fix tests depending on sort stability
* test/rexml/xpath/test_text.rb (test_ancestors): Array#sort may
  not be stable.  [ruby-core:76088] [Bug #12509]
* test/rss/test_maker_{0.9,1.0,2.0}.rb (test_items): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-13 02:31:43 +00:00
nobu 9d8f62d55e better assertion
* test/rexml/xpath/test_text.rb (test_ancestors): use
  assert_kind_of for better assertion message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-12 15:29:06 +00:00
akr 449fbfd4d4 Use Integer instead of Fixnum and Bignum.
* object.c, numeric.c, enum.c, ext/-test-/bignum/mul.c,
  lib/rexml/quickpath.rb, lib/rexml/text.rb, lib/rexml/xpath_parser.rb,
  lib/rubygems/specification.rb, lib/uri/generic.rb,
  bootstraptest/test_eval.rb, basictest/test.rb,
  test/-ext-/bignum/test_big2str.rb, test/-ext-/bignum/test_div.rb,
  test/-ext-/bignum/test_mul.rb, test/-ext-/bignum/test_str2big.rb,
  test/csv/test_data_converters.rb, test/date/test_date.rb,
  test/json/test_json_generate.rb, test/minitest/test_minitest_mock.rb,
  test/openssl/test_cipher.rb, test/rexml/test_jaxen.rb,
  test/ruby/test_array.rb, test/ruby/test_basicinstructions.rb,
  test/ruby/test_bignum.rb, test/ruby/test_case.rb,
  test/ruby/test_class.rb, test/ruby/test_complex.rb,
  test/ruby/test_enum.rb, test/ruby/test_eval.rb,
  test/ruby/test_iseq.rb, test/ruby/test_literal.rb,
  test/ruby/test_math.rb, test/ruby/test_module.rb,
  test/ruby/test_numeric.rb, test/ruby/test_range.rb,
  test/ruby/test_rational.rb, test/ruby/test_refinement.rb,
  test/ruby/test_rubyvm.rb, test/ruby/test_struct.rb,
  test/ruby/test_variable.rb, test/rubygems/test_gem_specification.rb,
  test/thread/test_queue.rb: Use Integer instead of Fixnum and Bignum.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17 13:15:57 +00:00
nobu 22d8481f08 fix common misspelling [ci skip]
* compile.c, cont.c, doc, man: fix common misspelling.
  [ruby-core:72466] [Bug #11870]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-24 23:23:46 +00:00
naruse 3e92b635fb Add frozen_string_literal: false for all files
When you change this to true, you may need to add more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
nobu ae042f21fb use assert_raise
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-02 02:18:44 +00:00
kou 9f4ab1c69d * test/rexml/test_document.rb: Indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 12:29:21 +00:00
kou 64f9f1ba58 * test/rexml/test_document.rb
(REXMLTests::TestDocument::EntityExpansionLimitTest):
  Group tests by general entity and parameter entity.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:47:34 +00:00
kou a38971c595 * test/rexml/test_document.rb
(REXMLTests::TestDocument::EntityExpansionLimitTest): Define
  test XML in each test method because (1) each XML in used only
  one test and (2) related data and code should be close.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:45:27 +00:00
kou a5406b873c * test/rexml/test_document.rb
(REXMLTests::TestDocument::EntityExpansionLimitTest):
  Use one test method for one test.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:40:47 +00:00
kou a4a2fbdf64 * test/rexml/test_document.rb
(REXMLTests::TestDocument::EntityExpansionLimitTest): Use
  setup and teardown instead of ensure in test.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:17:33 +00:00
kou 9fb2d21d7d * test/rexml/test_document.rb
(REXMLTests::TestDocument::EntityExpansionLimitTest): Indent.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:13:31 +00:00
kou f2588e1c8e * test/rexml/test_document.rb (REXMLTests::TestDocument): Group
entity expansion limit related tests.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:12:20 +00:00
kou 1e326bb0e5 * test/rexml/test_document.rb (REXMLTests::TestDocument::BomTest):
Fix wrong parent class. It doesn't need inherit tests in
  TestDocument class.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:09:57 +00:00
nagachika 2e8f953d68 * lib/rexml/document.rb: add REXML::Document#document.
reported by Tomas Hoger <thoger@redhat.com> and patched by nahi.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13 13:29:50 +00:00
usa 9cdd297a29 * lib/rexml/entity.rb: keep the entity size within the limitation.
reported by Willis Vandevanter <will@silentrobots.com> and
  patched by nahi.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-27 11:18:02 +00:00
kou 93647e81a6 * lib/rexml/source.rb (REXML::IOSource#encoding_updated): Fix a
bug that can't parse XML correctly when
  Encoding.default_internal is different with XML
  encoding. REXML::Source converts XML encoding on read. So IO
  should not convert XML encoding.
  Based on patch by NAKAMURA Usaku.
  [ruby-dev:48686] [Bug #10418]

* test/rexml/test_encoding.rb
  (REXMLTests::EncodingTester#test_parse_utf16_with_utf8_default_internal):
  Add the for the above case.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-23 08:23:10 +00:00
kou f6c56982ab * test/rexml/test_encoding.rb
(REXMLTests::EncodingTester#test_parse_utf16): Use meaningful
  test name. "ticket" in the old test name means the ticket in
  REXML's issue tracker. The REXML's issue tracker was gone. So
  "ticket" is meaningless.

* test/rexml/data/ticket_110_utf16.xml: Rename to ...
* test/rexml/data/utf16.xml: ... this.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-23 07:31:31 +00:00
kou 7a608ada8f * test/rexml/test_encoding.rb
(REXMLTests::EncodingTester#test_ticket_110): Fix expected and
  actual order.
  Patch by NAKAMURA Usaku. Thanks!!!


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-23 07:26:39 +00:00
akr 36276b6f40 Avoid a shadowing warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27 15:15:54 +00:00
akr 3356c312cd * test/rexml: Avoid fd leaks.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27 13:45:04 +00:00
kou 3c908895ab * test/rexml/test_document.rb: Indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27 13:24:39 +00:00
kou 875f071500 * test/rexml/test_document.rb: Wrap by REXMLTests module.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27 13:15:58 +00:00
kou cb50e15e0d * test/rexml/test_encoding_2.rb: Remove a needless file.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27 13:12:32 +00:00
kou ba3d2f4ac2 * test/rexml/test_contrib.rb: Indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27 13:10:55 +00:00
kou 28e78bf7f2 * test/rexml/: Use REXMLTests as wrapping module for REXML tests.
I avoid using the same module for library in test because
  it provides "include REXML" environment in test. Normally,
  users don't use REXML on "include REXML" environment. So I
  don't want to write tests on "include REXML" environment.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27 12:07:40 +00:00
kou effcb9a712 * test/rexml/test_comment.rb: Remove needless REXML module wrapping.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27 12:01:25 +00:00
akr 13a8d735d9 Wrap REXML test classes by REXML module.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27 10:21:10 +00:00