commit 2d606b3ca1378edf1c42ad58877c9bdaabf79480 Author: Eric Hodel Date: Sun Mar 11 18:00:21 2012 -0700 Fix hash-order-dependent tests diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb index a3ca813..149a808 100644 --- a/lib/rdoc/ri/driver.rb +++ b/lib/rdoc/ri/driver.rb @@ -723,7 +723,7 @@ Options may also be set in the 'RI' environment variable. page do |io| io.puts "#{name} not found, maybe you meant:" io.puts - io.puts matches.join("\n") + io.puts matches.sort.join("\n") end false diff --git a/test/test_rdoc_context.rb b/test/test_rdoc_context.rb index 192a287..52f579c 100644 --- a/test/test_rdoc_context.rb +++ b/test/test_rdoc_context.rb @@ -340,7 +340,7 @@ class TestRDocContext < XrefTestCase def test_classes assert_equal %w[C2::C3], @c2.classes.map { |k| k.full_name } - assert_equal %w[C3::H1 C3::H2], @c3.classes.map { |k| k.full_name } + assert_equal %w[C3::H1 C3::H2], @c3.classes.map { |k| k.full_name }.sort end def test_current_section diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index 1ff6f4d..18964f9 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -701,7 +701,7 @@ end @parser.parse_class @top_level, false, @parser.get_tk, @comment - assert_equal %w[A B], RDoc::TopLevel.classes.map { |c| c.full_name } + assert_equal %w[A B], RDoc::TopLevel.classes.map { |c| c.full_name }.sort end def test_parse_class_single @@ -720,10 +720,12 @@ end @parser.parse_class @top_level, false, @parser.get_tk, @comment - assert_equal %w[A], RDoc::TopLevel.classes.map { |c| c.full_name } - assert_equal %w[A::B A::d], RDoc::TopLevel.modules.map { |c| c.full_name } + assert_equal %w[A], RDoc::TopLevel.classes.map { |c| c.full_name } - b = RDoc::TopLevel.modules.first + modules = RDoc::TopLevel.modules.sort_by { |c| c.full_name } + assert_equal %w[A::B A::d], modules.map { |c| c.full_name } + + b = modules.first assert_equal 10, b.offset assert_equal 2, b.line @@ -1851,10 +1853,10 @@ end @parser.parse_statements @top_level - date, date_time = @top_level.classes + date, date_time = @top_level.classes.sort_by { |c| c.full_name } date_now = date.method_list.first - date_time_now = date_time.method_list.first + date_time_now = date_time.method_list.sort_by { |m| m.full_name }.first assert_equal :private, date_now.visibility assert_equal :public, date_time_now.visibility @@ -1876,10 +1878,11 @@ end @parser.parse_statements @top_level - date, date_time = @top_level.classes + # TODO sort classes by default + date, date_time = @top_level.classes.sort_by { |c| c.full_name } date_now = date.method_list.first - date_time_now = date_time.method_list.first + date_time_now = date_time.method_list.sort_by { |m| m.full_name }.first assert_equal :public, date_now.visibility, date_now.full_name assert_equal :private, date_time_now.visibility, date_time_now.full_name