1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2016-10-13 02:31:43 +00:00
parent 43112104df
commit 7e9112a441
5 changed files with 17 additions and 4 deletions

View file

@ -1,3 +1,10 @@
Thu Oct 13 11:31:40 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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.
Thu Oct 13 10:37:31 2016 Eric Wong <e@80x24.org> Thu Oct 13 10:37:31 2016 Eric Wong <e@80x24.org>
* doc/extension.rdoc: wording fix * doc/extension.rdoc: wording fix

View file

@ -69,7 +69,9 @@ module REXMLTests
assert_equal(1, nodes.size, "<b> has one element ancestor") assert_equal(1, nodes.size, "<b> has one element ancestor")
nodes = @doc.get_elements('//b/ancestor::node()') nodes = @doc.get_elements('//b/ancestor::node()')
assert_equal(2, nodes.size, "<b> has two node ancestors") assert_equal(2, nodes.size, "<b> has two node ancestors")
assert_kind_of REXML::Document, nodes[1] nodes.sort_by!(&:name)
assert_kind_of REXML::Document, nodes[0]
assert_kind_of REXML::Element, nodes[1]
end end
end end
end end

View file

@ -315,6 +315,7 @@ module RSS
assert_equal(link, item.link) assert_equal(link, item.link)
assert_nil(item.description) assert_nil(item.description)
pubDate = Time.now
item_size = 5 item_size = 5
rss = RSS::Maker.make("0.91") do |maker| rss = RSS::Maker.make("0.91") do |maker|
@ -325,6 +326,7 @@ module RSS
_item.title = "#{title}#{i}" _item.title = "#{title}#{i}"
_item.link = "#{link}#{i}" _item.link = "#{link}#{i}"
_item.description = "#{description}#{i}" _item.description = "#{description}#{i}"
_item.date = pubDate - i
end end
end end
maker.items.do_sort = true maker.items.do_sort = true

View file

@ -269,6 +269,7 @@ module RSS
assert_equal(link, item.link) assert_equal(link, item.link)
assert_nil(item.description) assert_nil(item.description)
pubDate = Time.now
item_size = 5 item_size = 5
rss = RSS::Maker.make("1.0") do |maker| rss = RSS::Maker.make("1.0") do |maker|
@ -279,6 +280,7 @@ module RSS
_item.title = "#{title}#{i}" _item.title = "#{title}#{i}"
_item.link = "#{link}#{i}" _item.link = "#{link}#{i}"
_item.description = "#{description}#{i}" _item.description = "#{description}#{i}"
_item.date = pubDate - i
end end
end end
maker.items.do_sort = true maker.items.do_sort = true

View file

@ -390,7 +390,7 @@ module RSS
item.description = "#{description}#{i}" item.description = "#{description}#{i}"
item.author = "#{author}#{i}" item.author = "#{author}#{i}"
item.comments = "#{comments}#{i}" item.comments = "#{comments}#{i}"
item.date = pubDate item.date = pubDate - i
end end
end end
maker.items.do_sort = true maker.items.do_sort = true
@ -402,8 +402,8 @@ module RSS
assert_equal("#{description}#{i}", item.description) assert_equal("#{description}#{i}", item.description)
assert_equal("#{author}#{i}", item.author) assert_equal("#{author}#{i}", item.author)
assert_equal("#{comments}#{i}", item.comments) assert_equal("#{comments}#{i}", item.comments)
assert_equal(pubDate, item.pubDate) assert_equal(pubDate - i, item.pubDate)
assert_equal(pubDate, item.date) assert_equal(pubDate - i, item.date)
end end
rss = RSS::Maker.make("2.0") do |maker| rss = RSS::Maker.make("2.0") do |maker|