PageRenderTime 59ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 0ms

/patches/ruby/2.0.0/p481/railsexpress/01-zero-broken-tests.patch

http://github.com/skaes/rvm-patchsets
Patch | 181 lines | 167 code | 14 blank | 0 comment | 0 complexity | e39b70b5fbbe1ededb9165337c5ff167 MD5 | raw file
  1. diff --git a/test/etc/test_etc.rb b/test/etc/test_etc.rb
  2. index c105122..a67b397 100644
  3. --- a/test/etc/test_etc.rb
  4. +++ b/test/etc/test_etc.rb
  5. @@ -76,6 +76,7 @@ class TestEtc < Test::Unit::TestCase
  6. end
  7. def test_getgrgid
  8. + skip "Broken Etc.getgrgid on this machine" if ENV['RUBY_TEST_OPTIONS_BROKEN_GETGRGID']=='1'
  9. # group database is not unique on GID, and which entry will be
  10. # returned by getgrgid() is not specified.
  11. groups = Hash.new {[]}
  12. @@ -92,6 +93,7 @@ class TestEtc < Test::Unit::TestCase
  13. end
  14. def test_getgrnam
  15. + skip "Broken Etc.getgrnam on this machine" if ENV['RUBY_TEST_OPTIONS_BROKEN_GETGRNAM']=='1'
  16. groups = {}
  17. Etc.group do |s|
  18. groups[s.name] ||= s unless /\A\+/ =~ s.name
  19. diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
  20. index c760e8e..f0ae216 100644
  21. --- a/test/ruby/test_process.rb
  22. +++ b/test/ruby/test_process.rb
  23. @@ -1554,6 +1554,7 @@ class TestProcess < Test::Unit::TestCase
  24. def test_execopts_gid
  25. skip "Process.groups not implemented on Windows platform" if windows?
  26. + skip "Broken Etc.getgrgid on this machine" if ENV['RUBY_TEST_OPTIONS_BROKEN_GETGRGID']=='1'
  27. feature6975 = '[ruby-core:47414]'
  28. [30000, *Process.groups.map {|g| g = Etc.getgrgid(g); [g.name, g.gid]}].each do |group, gid|
  29. diff --git a/test/webrick/test_filehandler.rb b/test/webrick/test_filehandler.rb
  30. index cc27b34..f40d6f7 100644
  31. --- a/test/webrick/test_filehandler.rb
  32. +++ b/test/webrick/test_filehandler.rb
  33. @@ -21,6 +21,10 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase
  34. end
  35. end
  36. + def webrick_config_http
  37. + WEBrick::Config::HTTP.merge(:ServerName => "localhost")
  38. + end
  39. +
  40. def make_range_request(range_spec)
  41. msg = <<-END_OF_REQUEST
  42. GET / HTTP/1.0
  43. @@ -31,9 +35,9 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase
  44. end
  45. def make_range_response(file, range_spec)
  46. - req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
  47. + req = WEBrick::HTTPRequest.new(webrick_config_http)
  48. req.parse(make_range_request(range_spec))
  49. - res = WEBrick::HTTPResponse.new(WEBrick::Config::HTTP)
  50. + res = WEBrick::HTTPResponse.new(webrick_config_http)
  51. size = File.size(file)
  52. handler = default_file_handler(file)
  53. handler.make_partial_content(req, res, file, size)
  54. diff --git a/test/webrick/test_httprequest.rb b/test/webrick/test_httprequest.rb
  55. index 0ce6b4f..b34cddd 100644
  56. --- a/test/webrick/test_httprequest.rb
  57. +++ b/test/webrick/test_httprequest.rb
  58. @@ -3,11 +3,15 @@ require "stringio"
  59. require "test/unit"
  60. class TestWEBrickHTTPRequest < Test::Unit::TestCase
  61. + def webrick_config_http
  62. + WEBrick::Config::HTTP.merge(:ServerName => "localhost")
  63. + end
  64. +
  65. def test_simple_request
  66. msg = <<-_end_of_message_
  67. GET /
  68. _end_of_message_
  69. - req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
  70. + req = WEBrick::HTTPRequest.new(webrick_config_http)
  71. req.parse(StringIO.new(msg))
  72. assert(req.meta_vars) # fails if @header was not initialized and iteration is attempted on the nil reference
  73. end
  74. @@ -17,12 +21,12 @@ GET /
  75. GET /
  76. foobar # HTTP/0.9 request don't have header nor entity body.
  77. _end_of_message_
  78. - req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
  79. + req = WEBrick::HTTPRequest.new(webrick_config_http)
  80. req.parse(StringIO.new(msg.gsub(/^ {6}/, "")))
  81. assert_equal("GET", req.request_method)
  82. assert_equal("/", req.unparsed_uri)
  83. assert_equal(WEBrick::HTTPVersion.new("0.9"), req.http_version)
  84. - assert_equal(WEBrick::Config::HTTP[:ServerName], req.host)
  85. + assert_equal(webrick_config_http[:ServerName], req.host)
  86. assert_equal(80, req.port)
  87. assert_equal(false, req.keep_alive?)
  88. assert_equal(nil, req.body)
  89. @@ -34,12 +38,12 @@ GET /
  90. GET / HTTP/1.0
  91. _end_of_message_
  92. - req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
  93. + req = WEBrick::HTTPRequest.new(webrick_config_http)
  94. req.parse(StringIO.new(msg.gsub(/^ {6}/, "")))
  95. assert_equal("GET", req.request_method)
  96. assert_equal("/", req.unparsed_uri)
  97. assert_equal(WEBrick::HTTPVersion.new("1.0"), req.http_version)
  98. - assert_equal(WEBrick::Config::HTTP[:ServerName], req.host)
  99. + assert_equal(webrick_config_http[:ServerName], req.host)
  100. assert_equal(80, req.port)
  101. assert_equal(false, req.keep_alive?)
  102. assert_equal(nil, req.body)
  103. @@ -51,14 +55,14 @@ GET /
  104. GET /path HTTP/1.1
  105. _end_of_message_
  106. - req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
  107. + req = WEBrick::HTTPRequest.new(webrick_config_http)
  108. req.parse(StringIO.new(msg.gsub(/^ {6}/, "")))
  109. assert_equal("GET", req.request_method)
  110. assert_equal("/path", req.unparsed_uri)
  111. assert_equal("", req.script_name)
  112. assert_equal("/path", req.path_info)
  113. assert_equal(WEBrick::HTTPVersion.new("1.1"), req.http_version)
  114. - assert_equal(WEBrick::Config::HTTP[:ServerName], req.host)
  115. + assert_equal(webrick_config_http[:ServerName], req.host)
  116. assert_equal(80, req.port)
  117. assert_equal(true, req.keep_alive?)
  118. assert_equal(nil, req.body)
  119. @@ -69,7 +73,7 @@ GET /
  120. msg = <<-_end_of_message_
  121. GET /#{"a"*2084} HTTP/1.1
  122. _end_of_message_
  123. - req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
  124. + req = WEBrick::HTTPRequest.new(webrick_config_http)
  125. assert_raise(WEBrick::HTTPStatus::RequestURITooLarge){
  126. req.parse(StringIO.new(msg.gsub(/^ {6}/, "")))
  127. }
  128. @@ -122,7 +126,7 @@ GET /
  129. hogehoge
  130. _end_of_message_
  131. - req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
  132. + req = WEBrick::HTTPRequest.new(webrick_config_http)
  133. req.parse(StringIO.new(msg.gsub(/^ {6}/, "")))
  134. assert_equal("POST", req.request_method)
  135. assert_equal("/foo/baz", req.path)
  136. @@ -139,7 +143,7 @@ GET /
  137. Host: test.ruby-lang.org
  138. _end_of_message_
  139. - req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
  140. + req = WEBrick::HTTPRequest.new(webrick_config_http)
  141. req.parse(StringIO.new(msg.gsub(/^ {6}/, "")))
  142. assert_equal(URI.parse("http://test.ruby-lang.org/path"), req.request_uri)
  143. assert_equal("test.ruby-lang.org", req.host)
  144. @@ -150,7 +154,7 @@ GET /
  145. Host: 192.168.1.1
  146. _end_of_message_
  147. - req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
  148. + req = WEBrick::HTTPRequest.new(webrick_config_http)
  149. req.parse(StringIO.new(msg.gsub(/^ {6}/, "")))
  150. assert_equal(URI.parse("http://192.168.1.1/path"), req.request_uri)
  151. assert_equal("192.168.1.1", req.host)
  152. @@ -343,7 +347,7 @@ GET /
  153. _end_of_message_
  154. msg.gsub!(/^ {6}/, "")
  155. - req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
  156. + req = WEBrick::HTTPRequest.new(webrick_config_http)
  157. req.parse(StringIO.new(msg))
  158. assert req['expect']
  159. l = msg.size
  160. @@ -359,7 +363,7 @@ GET /
  161. _end_of_message_
  162. msg.gsub!(/^ {6}/, "")
  163. - req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
  164. + req = WEBrick::HTTPRequest.new(webrick_config_http)
  165. req.parse(StringIO.new(msg))
  166. assert !req['expect']
  167. l = msg.size