Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: de5821e87473
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: badd94b6e3e4
Choose a head ref
  • 2 commits
  • 81 files changed
  • 1 contributor

Commits on Jan 12, 2016

  1. Squashed 'spec/ruby/' changes from cfdf72f..70b1140

    70b1140 Spec the default values of IO#sync for standard streams.
    7753d2f Reorder Zlib deflate specs
    76488f6 Fix warning in Zlib deflate spec
    763d9ea Add specs for streaming in inflate processing
    f484f34 Solaris 10 on x86 wrongly returns ai_pprotocol as 0
    a5c0605 Remove bad spec
    8b118fd Specify new behavior for Enumerable{chunk,slice_before}
    5885e2b Initial spec for Queue#close and Queue#closed?
    ba17b3d Spec for the new behavior of Kernel#loop
    f59a862 No silent rescue in Comparable#<=> is now released behavior in 2.3
    9a20b87 Treat paths with unicode characters as binary to avoid depending on the locale.
    5ab735b Merge pull request #180 from ruby/string-split
    0d2c110 Add more String#split examples
    68159c3 Skip filesystem encoding dependent spec
    fe83324 Remove old guarded spec, implementations should be allowed to do either.
    0db9d4a  Fix IO#write_nonblock spec under 2.0
    40957a3 Fix IO#read_nonblock spec under 2.0
    fc0d729 Add a spec covering calling #instance_eval with a proc from a method
    e32825a Added specs for RARRAY_AREF.
    997fc93 Added spec for IO#write_nonblock raising
    45dcbd1 Test IO#read_nonblock raising EAGAINWaitReadable
    400a56f Fix a typo s/refering/referring/
    c76d706 Fixed Dir.pwd spec with unicode characters.
    0512054 Add spec about -> lambda scoping.
    f0b6cf6 Accomodate for Thread#backtrace being nil when thread is not started yet.
    7462ac9 BigDecimal.new raises ArgumentError when Float is used without precision
    79f43c0 do not raise when precision is passed to BigDecimal#round
    26ac864 Fix line in Exception#backtrace spec.
    2269430 Move the fixture class to fixtures.
    d799042 Merge pull request #178 from yuki24/add-spec-for-name-error-receiver
    abee55f Merge pull request #177 from yuki24/add-specs-for-name-error-name
    fc420f3 Add specs for NameError#name
    c127124 Add more examples for NameError#receiver
    b09e8fd Simplify a spec for NameError#receiver
    674b32f Speficy that hidden metaclasses stay hidden.
    7b99cfc Merge pull request #179 from yuki24/use-latest-rubies
    0d96eb5 Use the latest rubies on Travis
    2617339 Add spec for Symbol#to_proc plus Proc#parameters => [[:rest]]
    bbcb689 Mask out specs+fixtures for keyreq added in 2.1.
    df59b1f Add some simple specs for Method#parameters with keyword args.
    bac69ca wait for the parent to read
    4960e98 Revert "wait for the parent to read" because of stall on Solaris
    822aac3 NetHTTPSpecs.start_server should not use hardcoded port number.
    379401f Fix and complete Thread#name spec.
    9912132 [ruby-2.3 core/thread] - Add specs for Thread#name and Thread#name=
    ae8ef6a Explicitly state the relation between classes since this spec is meta-meta
    1a31f57 Merge pull request #173 from nobu/bug/fd-passing-tests
    652d332 wait for the parent to read
    f60ee1e Merge pull request #172 from nobu/feature/dig_change
    e34b1a4 separate TypeError cases on dig
    7526c4e Merge pull request #171 from nobu/feature/dig_change
    4d25005 dig method update
    2f8577d Ruby 2.3 doesn't raise error
    72b2688 Specify the behavior of Date#<< with respect to the version
    f8358bd Merge pull request #170 from nobu/bug/Date-minus_month-exception
    1fdd93d do not mind excepction class
    53f535b Merge pull request #168 from cthulhua/chunk_while
    f4ae8fc [ruby-2.3 core/enumerable] - Add specs for enumerable#chunk_while
    1b726f7 Merge pull request #167 from nobu/bug/fix-infection-from-range
    2a8f30a Fix version to ruby_bug
    67fb1f7 Merge pull request #166 from nobu/bug/fix-infection-from-range
    7198825 Fix infection from Range
    e1b1ba6 Use the container infrastructure on Travis CI
    5cec3a3 Fix UTF-8 Encoding constant name in StringIO specs
    c330bfd Fix StringIO specs file structure
    e148e90 Fix StringIO#isatty describe title
    1f358a4 Fix location of ObjectSpace fixtures.
    
    git-subtree-dir: spec/ruby
    git-subtree-split: 70b11404aa1f44e18b560d3d0de78ef827c1434e
    headius committed Jan 12, 2016
    Copy the full SHA
    2cfe47b View commit details
  2. Copy the full SHA
    badd94b View commit details
Showing with 818 additions and 240 deletions.
  1. +4 −3 spec/ruby/.travis.yml
  2. +15 −4 spec/ruby/core/array/shared/inspect.rb
  3. +9 −0 spec/ruby/core/basicobject/instance_eval_spec.rb
  4. +6 −8 spec/ruby/core/comparable/equal_value_spec.rb
  5. +17 −10 spec/ruby/core/dir/pwd_spec.rb
  6. +9 −0 spec/ruby/core/enumerable/chunk_spec.rb
  7. +38 −0 spec/ruby/core/enumerable/chunk_while_spec.rb
  8. +7 −10 spec/ruby/core/enumerable/slice_before_spec.rb
  9. +1 −1 spec/ruby/core/exception/backtrace_spec.rb
  10. +24 −16 spec/ruby/core/exception/fixtures/common.rb
  11. +55 −1 spec/ruby/core/exception/name_spec.rb
  12. +47 −5 spec/ruby/core/exception/receiver_spec.rb
  13. +0 −23 spec/ruby/core/fiber/resume_spec.rb
  14. +7 −2 spec/ruby/core/hash/dig_spec.rb
  15. +8 −2 spec/ruby/core/io/read_nonblock_spec.rb
  16. +14 −0 spec/ruby/core/io/sync_spec.rb
  17. +31 −0 spec/ruby/core/io/write_nonblock_spec.rb
  18. +11 −0 spec/ruby/core/kernel/loop_spec.rb
  19. +3 −0 spec/ruby/core/method/fixtures/classes.rb
  20. +5 −0 spec/ruby/core/method/fixtures/classes21.rb
  21. +19 −0 spec/ruby/core/method/parameters_spec.rb
  22. +2 −2 spec/ruby/core/module/autoload_spec.rb
  23. +1 −1 spec/ruby/core/objectspace/define_finalizer_spec.rb
  24. +9 −1 spec/ruby/core/objectspace/each_object_spec.rb
  25. 0 spec/ruby/core/objectspace/{fixtures.rb → fixtures/classes.rb}
  26. +6 −8 spec/ruby/core/range/inspect_spec.rb
  27. +6 −8 spec/ruby/core/range/to_s_spec.rb
  28. +14 −0 spec/ruby/core/string/split_spec.rb
  29. +5 −0 spec/ruby/core/symbol/to_proc_spec.rb
  30. +40 −0 spec/ruby/core/thread/name_spec.rb
  31. +16 −5 spec/ruby/library/date/minus_month_spec.rb
  32. +1 −1 spec/ruby/library/net/http/http/copy_spec.rb
  33. +1 −1 spec/ruby/library/net/http/http/delete_spec.rb
  34. +1 −1 spec/ruby/library/net/http/http/finish_spec.rb
  35. +5 −1 spec/ruby/library/net/http/http/fixtures/http_server.rb
  36. +3 −2 spec/ruby/library/net/http/http/get_print_spec.rb
  37. +3 −2 spec/ruby/library/net/http/http/get_response_spec.rb
  38. +3 −2 spec/ruby/library/net/http/http/get_spec.rb
  39. +1 −1 spec/ruby/library/net/http/http/head_spec.rb
  40. +4 −3 spec/ruby/library/net/http/http/inspect_spec.rb
  41. +1 −1 spec/ruby/library/net/http/http/lock_spec.rb
  42. +1 −1 spec/ruby/library/net/http/http/mkcol_spec.rb
  43. +1 −1 spec/ruby/library/net/http/http/move_spec.rb
  44. +1 −1 spec/ruby/library/net/http/http/options_spec.rb
  45. +2 −1 spec/ruby/library/net/http/http/post_form_spec.rb
  46. +1 −1 spec/ruby/library/net/http/http/post_spec.rb
  47. +1 −1 spec/ruby/library/net/http/http/propfind_spec.rb
  48. +1 −1 spec/ruby/library/net/http/http/proppatch_spec.rb
  49. +1 −1 spec/ruby/library/net/http/http/put_spec.rb
  50. +1 −1 spec/ruby/library/net/http/http/request_spec.rb
  51. +1 −1 spec/ruby/library/net/http/http/send_request_spec.rb
  52. +1 −1 spec/ruby/library/net/http/http/set_debug_output_spec.rb
  53. +1 −1 spec/ruby/library/net/http/http/shared/request_get.rb
  54. +1 −1 spec/ruby/library/net/http/http/shared/request_head.rb
  55. +1 −1 spec/ruby/library/net/http/http/shared/request_post.rb
  56. +1 −1 spec/ruby/library/net/http/http/shared/request_put.rb
  57. +1 −1 spec/ruby/library/net/http/http/shared/started.rb
  58. +8 −7 spec/ruby/library/net/http/http/start_spec.rb
  59. +1 −1 spec/ruby/library/net/http/http/trace_spec.rb
  60. +1 −1 spec/ruby/library/net/http/http/unlock_spec.rb
  61. +63 −61 spec/ruby/library/socket/socket/getaddrinfo_spec.rb
  62. 0 spec/ruby/library/stringio/{codepoints.rb → codepoints_spec.rb}
  63. 0 spec/ruby/library/stringio/{each_codepoint.rb → each_codepoint_spec.rb}
  64. +2 −2 spec/ruby/library/stringio/{external_encoding.rb → external_encoding_spec.rb}
  65. +1 −1 spec/ruby/library/stringio/{internal_encoding.rb → internal_encoding_spec.rb}
  66. +1 −1 spec/ruby/library/stringio/isatty_spec.rb
  67. +2 −2 spec/ruby/library/stringio/{set_encoding.rb → set_encoding_spec.rb}
  68. +6 −0 spec/ruby/library/stringio/ungetbyte_spec.rb
  69. +9 −0 spec/ruby/library/thread/queue/close_spec.rb
  70. +9 −0 spec/ruby/library/thread/queue/closed_spec.rb
  71. +26 −0 spec/ruby/library/thread/shared/queue/close.rb
  72. +12 −0 spec/ruby/library/thread/shared/queue/closed.rb
  73. +9 −0 spec/ruby/library/thread/sizedqueue/close_spec.rb
  74. +9 −0 spec/ruby/library/thread/sizedqueue/closed_spec.rb
  75. +87 −14 spec/ruby/library/zlib/deflate/deflate_spec.rb
  76. +29 −0 spec/ruby/library/zlib/inflate/finish_spec.rb
  77. +43 −0 spec/ruby/library/zlib/inflate/inflate_spec.rb
  78. +9 −0 spec/ruby/optional/capi/array_spec.rb
  79. +10 −0 spec/ruby/optional/capi/ext/array_spec.c
  80. +3 −0 spec/ruby/optional/capi/ext/rubyspec.h
  81. +9 −9 spec/ruby/shared/process/spawn.rb
7 changes: 4 additions & 3 deletions spec/ruby/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
sudo: false
language: ruby
rvm:
- 2.0.0-p647
- 2.1.7
- 2.2.3
- 2.0.0-p648
- 2.1.8
- 2.2.4
- ruby-head
install:
- git clone https://github.com/ruby/mspec.git ../mspec
19 changes: 15 additions & 4 deletions spec/ruby/core/array/shared/inspect.rb
Original file line number Diff line number Diff line change
@@ -81,11 +81,22 @@
array.send(@method).encoding.name.should == "US-ASCII"
end

it "raises if inspected result is not default external encoding" do
utf_16be = mock("utf_16be")
utf_16be.should_receive(:inspect).and_return("utf_16be".encode!(Encoding::UTF_16BE))
ruby_version_is ''...'2.3' do
it "raises if inspected result is not default external encoding" do
utf_16be = mock("utf_16be")
utf_16be.should_receive(:inspect).and_return(%<"utf_16be \u3042">.encode!(Encoding::UTF_16BE))

lambda { [utf_16be].send(@method) }.should raise_error(Encoding::CompatibilityError)
lambda { [utf_16be].send(@method) }.should raise_error(Encoding::CompatibilityError)
end
end

ruby_version_is '2.3' do
it "raises if inspected result is not default external encoding" do
utf_16be = mock("utf_16be")
utf_16be.should_receive(:inspect).and_return(%<"utf_16be \u3042">.encode!(Encoding::UTF_16BE))

[utf_16be].send(@method).should == '["utf_16be \u3042"]'
end
end
end
end
9 changes: 9 additions & 0 deletions spec/ruby/core/basicobject/instance_eval_spec.rb
Original file line number Diff line number Diff line change
@@ -150,4 +150,13 @@ class B; end
(1 << 64).instance_eval { def foo; end }
end.should raise_error(TypeError)
end

it "evaluates procs originating from methods" do
def meth(arg); arg; end

m = method(:meth)
obj = Object.new

obj.instance_eval(&m).should == obj
end
end
14 changes: 6 additions & 8 deletions spec/ruby/core/comparable/equal_value_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)

no_silent_rescue = "2.3"

describe "Comparable#==" do
a = b = nil
before :each do
@@ -50,13 +48,13 @@
a.should_receive(:<=>).once.and_return("abc")
end

ruby_version_is ""...no_silent_rescue do
ruby_version_is ""..."2.3" do
it "returns false" do
(a == b).should be_false
end
end

ruby_version_is no_silent_rescue do
ruby_version_is "2.3" do
it "raises an ArgumentError" do
lambda { (a == b) }.should raise_error(ArgumentError)
end
@@ -69,14 +67,14 @@
a.should_receive(:<=>).once.and_raise(StandardError)
end

ruby_version_is ""...no_silent_rescue do
ruby_version_is ""..."2.3" do
# Behaviour confirmed by MRI test suite
it "returns false" do
(a == b).should be_false
end
end

ruby_version_is no_silent_rescue do
ruby_version_is "2.3" do
it "lets it go through" do
lambda { (a == b) }.should raise_error(StandardError)
end
@@ -89,13 +87,13 @@
a.should_receive(:<=>).once.and_raise(TypeError)
end

ruby_version_is ""...no_silent_rescue do
ruby_version_is ""..."2.3" do
it "returns false" do
(a == b).should be_false
end
end

ruby_version_is no_silent_rescue do
ruby_version_is "2.3" do
it "lets it go through" do
lambda { (a == b) }.should raise_error(TypeError)
end
27 changes: 17 additions & 10 deletions spec/ruby/core/dir/pwd_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- encoding: utf-8 -*-
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/common', __FILE__)
require File.expand_path('../shared/pwd', __FILE__)
@@ -12,19 +13,25 @@
end

it_behaves_like :dir_pwd, :pwd
end

it "correctly displays dirs with unicode characters in them" do
DirSpecs.clear_dirs
describe "Dir.pwd" do
before :each do
@name = tmp("あ").force_encoding('binary')
@fs_encoding = Encoding.find('filesystem')
end

begin
str = [0xe9].pack 'U' # Unicode é
Dir.mkdir str
File.exist?(str).should == true
after :each do
rm_r @name
end

old_pwd = Dir.pwd
Dir.chdir(str) { Dir.pwd.force_encoding('UTF-8').should == File.join(old_pwd, str) }
ensure
DirSpecs.clear_dirs
it "correctly handles dirs with unicode characters in them" do
Dir.mkdir @name
Dir.chdir @name do
if @fs_encoding == Encoding::UTF_8
Dir.pwd.encoding.should == Encoding::UTF_8
end
Dir.pwd.force_encoding('binary').should == @name
end
end
end
9 changes: 9 additions & 0 deletions spec/ruby/core/enumerable/chunk_spec.rb
Original file line number Diff line number Diff line change
@@ -72,6 +72,15 @@
end
end

ruby_version_is "2.3" do
it "does not accept arguments" do
e = EnumerableSpecs::Numerous.new(1, 2, 3)
lambda {
e.chunk(1) {}
}.should raise_error(ArgumentError)
end
end

it 'returned Enumerator size returns nil' do
e = EnumerableSpecs::NumerousWithSize.new(1, 2, 3, 2, 1)
enum = e.chunk { |x| true }
38 changes: 38 additions & 0 deletions spec/ruby/core/enumerable/chunk_while_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)

ruby_version_is "2.3" do
describe "Enumerable#chunk_while" do
before :each do
ary = [10, 9, 7, 6, 4, 3, 2, 1]
@enum = EnumerableSpecs::Numerous.new *ary
@result = @enum.chunk_while { |i, j| i - 1 == j }
@enum_length = ary.length
end

context "when given a block" do
it "returns an enumerator" do
@result.should be_an_instance_of(enumerator_class)
end

it "splits chunks between adjacent elements i and j where the block returns false" do
@result.to_a.should == [[10, 9], [7, 6], [4, 3, 2, 1]]
end

it "calls the block for length of the receiver enumerable minus one times" do
times_called = 0
@enum.chunk_while do |i, j|
times_called += 1
i - 1 == j
end.to_a
times_called.should == (@enum_length - 1)
end
end

context "when not given a block" do
it "raises an ArgumentError" do
lambda { @enum.chunk_while }.should raise_error(ArgumentError)
end
end
end
end
17 changes: 7 additions & 10 deletions spec/ruby/core/enumerable/slice_before_spec.rb
Original file line number Diff line number Diff line change
@@ -58,17 +58,14 @@
end
e.to_a
end
end
end

quarantine! do # need to double-check with ruby-core. Might be wrong or too specific
it "duplicates the argument directly without calling dup" do
arg = EnumerableSpecs::Undupable.new
e = @enum.slice_before(arg) do |i, init|
init.initialize_dup_called.should be_true
false
end
e.to_a.should == [[7, 6, 5, 4, 3, 2, 1]]
end
end
ruby_version_is "2.3" do
it "does not accept arguments" do
lambda {
@enum.slice_before(1) {}
}.should raise_error(ArgumentError)
end
end
end
2 changes: 1 addition & 1 deletion spec/ruby/core/exception/backtrace_spec.rb
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@
end

it "includes the line number of the location where self raised in the first element" do
@backtrace.first.should =~ /:22:in /
@backtrace.first.should =~ /:7:in /
end

it "includes the name of the method from where self raised in the first element" do
40 changes: 24 additions & 16 deletions spec/ruby/core/exception/fixtures/common.rb
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
module NoMethodErrorSpecs
class NoMethodErrorA; end

class NoMethodErrorB; end

class NoMethodErrorC;
protected
def a_protected_method;end
private
def a_private_method; end
end

class NoMethodErrorD; end
end

module ExceptionSpecs
class Exceptional < Exception; end

class Backtrace
def self.backtrace
begin
raise
raise # Do not move this line or update backtrace_spec.rb
rescue RuntimeError => e
e.backtrace
end
@@ -54,3 +39,26 @@ def to_s
end
end
end

module NoMethodErrorSpecs
class NoMethodErrorA; end

class NoMethodErrorB; end

class NoMethodErrorC;
protected
def a_protected_method;end
private
def a_private_method; end
end

class NoMethodErrorD; end
end

class NameErrorSpecs
class ReceiverClass
def call_undefined_class_variable
@@doesnt_exist
end
end
end
56 changes: 55 additions & 1 deletion spec/ruby/core/exception/name_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,59 @@
require File.expand_path('../../../spec_helper', __FILE__)

describe "NameError#name" do
it "needs to be reviewed for spec completeness"
it "returns a method name as a symbol" do
-> {
doesnt_exist
}.should raise_error(NameError) {|e| e.name.should == :doesnt_exist }
end

it "returns a constant name as a symbol" do
-> {
DoesntExist
}.should raise_error(NameError) {|e| e.name.should == :DoesntExist }
end

it "returns a constant name without namespace as a symbol" do
-> {
Object::DoesntExist
}.should raise_error(NameError) {|e| e.name.should == :DoesntExist }
end

it "returns a class variable name as a symbol" do
-> {
@@doesnt_exist
}.should raise_error(NameError) {|e| e.name.should == :@@doesnt_exist }
end

ruby_version_is ""..."2.3" do
it "always returns a symbol when a NameError is raised from #instance_variable_get" do
-> {
Object.new.instance_variable_get("invalid_ivar_name")
}.should raise_error(NameError) { |e| e.name.should == :invalid_ivar_name }
end

it "always returns a symbol when a NameError is raised from #class_variable_get" do
-> {
Object.class_variable_get("invalid_cvar_name")
}.should raise_error(NameError) { |e| e.name.should == :invalid_cvar_name }
end
end

ruby_version_is "2.3" do
it "returns the first argument passed to the method when a NameError is raised from #instance_variable_get" do
invalid_ivar_name = "invalid_ivar_name"

-> {
Object.new.instance_variable_get(invalid_ivar_name)
}.should raise_error(NameError) {|e| e.name.should equal(invalid_ivar_name) }
end

it "returns the first argument passed to the method when a NameError is raised from #class_variable_get" do
invalid_cvar_name = "invalid_cvar_name"

-> {
Object.class_variable_get(invalid_cvar_name)
}.should raise_error(NameError) {|e| e.name.should equal(invalid_cvar_name) }
end
end
end
Loading