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: 9bb8e921da09
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 82d58e7e9c31
Choose a head ref
  • 11 commits
  • 54 files changed
  • 1 contributor

Commits on Nov 27, 2016

  1. Copy the full SHA
    1babf16 View commit details
  2. Squashed 'spec/mspec/' changes from 485f467..eb12af0

    eb12af0 Merge pull request #21 from nobu/MockIntObject#to_int
    1b9a7c1 Try to convert the target
    3af1646 Add spec for MockIntObject#to_int
    
    git-subtree-dir: spec/mspec
    git-subtree-split: eb12af095b80baedfc32479af999e3ad36b91d69
    eregon committed Nov 27, 2016
    Copy the full SHA
    6797a7e View commit details
  3. Copy the full SHA
    cc7802b View commit details
  4. Squashed 'spec/ruby/' changes from a2e5952..852254a

    852254a Fixed setting ThreadGroup for signal handler Thread.
    0efde43 Fix flock spec: it only applies on Solaris and needs some setup
    29b472c Split an example to get guards outside the example
    4859bbb [Truffle] Compile c specs with extconf make
    621ce1b spawn.rb: Pass PATH variable to started process.
    7727dac setuid_spec.rb: Set execute bit before setting setuid bit on Solaris.
    78a81b4 Handle no supplementary groups in grpowned? specs
    8901448 Solaris returns -1 on rdev on ordinary files; update test to use /dev/zfs on Solaris.
    30ae2c3 Fix UDPSocket.new spec, Solaris reports a different error on unknown protocol family.
    8b352c3 Move Solaris File#flock specs in a different describe
    9cd374e [Truffle] Show command if compilation fails.
    4fc62b4 Improve Thread::Backtrace::Location#label specs
    6fb234b Add spec for remove_method against cloned singleton.
    9755210 Add spec for replacing singleton method in a cloned singleton.
    327594e Add specs for UNIXSocket#inspect
    5e79514 Add spec for IO#inspect's owner. See #4262
    51f80aa /regexp/.source should not display escape characters
    7bda8e3 Require squiggly_heredoc only in examples so they can easily be tagged and the file be loaded
    389f951 use SEPARATOR and ALT_SEPARATOR in File.basename
    c594305 Fix File.dirname on Windows (including UNC)
    5a15ff7 fix File.dirname with backslashes in unix
    4ba6827 No TypeError on dup (#360)
    3f3b283 Home directory is taken from system (#359)
    913edd4 Merge pull request #357 from eregon/share_delete
    85b1e0e Add spec for File::SHARE_DELETE
    b61fdb5 Make sure all spawn specs with minimal environment have a successful exit status
    71152a1 Always disable rubygems for spawn specs with minimal environment
    b182988 Fix spec to use absolute path in unlink specs
    5c33417 Use paths inside the temp directory for the unlink spec
    3a1b57c Restrict testing with Ruby 2.3 64-bit on AppVeyor
    772254d Add spec for File::TMPFILE
    e1ea963 Add spec for define_method and define_singleton_method requiring an explicit block
    66daf29 Merge pull request #355 from ruby/shugo/fix-unsetenv_others_on_icc
    74b4241 Add --disable-gems if CC is icc.
    be0bf17 Merge pull request #354 from nobu/fix-complex_equal_value
    43b176b The result of `==` should be truthy or falsy
    22ee32d The result of `==` should be truthy or falsy
    2aea831 Try fixing Process.groups by ignoring the primary group id
    97f987f Fix Process#groups spec
    27960d0 Merge pull request #352 from ruby/revert-351-did_you_mean_spec
    dabb1fe Revert "DidYouMean specs for ruby 2.3"
    0c53f4c Fix fixture path on windows
    b6ddea7 Add debug_info.rb fixture
    a0e55db Add spec to test frozen string debug generation
    0391aea Add String#+@ in conjunction  with freeze-magic-comment spec
    a6edbbf Merge pull request #351 from mjago/did_you_mean_spec
    2d79878 Fix Ruby Version
    e075552 DidYouMean specs for ruby 2.3
    3ce9295 Merge pull request #350 from mjago/aix_invalid_syslog_constants
    9757670 As with solaris avoid testing aix unknown syslog constants
    d152cba Fix Ruby version.
    7783c4c Module#include and Module#prepend don't accept no-arguments in 2.4.
    5eb8b40 Require round-to-nearest-even behavior for Ruby 2.4+ (#322)
    39f89d8 Merge pull request #348 from nobu/bug/fork-feature-fix
    45efa58 Check fork feature by respond_to?
    fe4673a Merge pull request #347 from mjago/fix_remaining_encodings
    b53a488 Fix encoding in optional/capi/string_spec.rb
    abfba52 Fix encoding in optional/capi/encoding_spec.rb
    c43ea57 Fix encoding in library/zlib/inflate/set_dictionary_spec.rb
    1c54447 Fix encoding in library/socket/socket/gethostbyname_spec.rb
    8113f43 Fix encoding in library/openssl/shared/constants.rb
    1551379 Fix encoding in language/string_spec.rb
    c5d6ec9 Fix encoding in language/regexp/escapes_spec.rb
    9631f02 Fix encoding in language/regexp/encoding_spec.rb
    8dfae6c Fix encoding in core/time/_load_spec.rb
    c3f1719 Fix encoding in core/time/_dump_spec.rb
    99af163 Fix encoding in core/symbol/casecmp_spec.rb
    854f7b2 Fix encoding in core/string/valid_encoding_spec.rb
    182b382 Fix encoding in core/string/unicode_normalize_spec.rb
    738584e Fix encoding in core/string/squeeze_spec.rb
    b12b094 Fix encoding in core/string/slice_spec.rb
    cd5ced3 Fix encoding in core/string/shared/succ.rb
    bf3d210 Fix encoding in core/string/shared/eql.rb
    1ddfd79 Fix encoding in core/string/shared/encode.rb
    990e4bc Fix encoding in core/string/shared/each_codepoint_without_block.rb
    
    git-subtree-dir: spec/ruby
    git-subtree-split: 852254a3371e3ce3e3007c49d0c23cf615e0409b
    eregon committed Nov 27, 2016
    Copy the full SHA
    d454687 View commit details
  5. Copy the full SHA
    f030c09 View commit details
  6. Add tags for new specs.

    eregon committed Nov 27, 2016
    Copy the full SHA
    5db36c0 View commit details
  7. Copy the full SHA
    64a0ca2 View commit details
  8. Copy the full SHA
    8a9e191 View commit details
  9. Copy the full SHA
    40a90b1 View commit details
  10. Copy the full SHA
    956b2f4 View commit details
  11. Copy the full SHA
    82d58e7 View commit details
Showing with 405 additions and 150 deletions.
  1. +1 −1 spec/mspec/lib/mspec/mocks/proxy.rb
  2. +16 −0 spec/mspec/spec/mocks/proxy_spec.rb
  3. +0 −2 spec/ruby/appveyor.yml
  4. +11 −0 spec/ruby/command_line/fixtures/debug_info.rb
  5. +7 −0 spec/ruby/command_line/frozen_strings_spec.rb
  6. +5 −3 spec/ruby/core/file/basename_spec.rb
  7. +12 −0 spec/ruby/core/file/constants/constants_spec.rb
  8. +9 −7 spec/ruby/core/file/expand_path_spec.rb
  9. +6 −2 spec/ruby/core/file/flock_spec.rb
  10. +18 −9 spec/ruby/core/file/shared/unlink.rb
  11. +14 −2 spec/ruby/core/float/round_spec.rb
  12. +18 −4 spec/ruby/core/integer/round_spec.rb
  13. +20 −0 spec/ruby/core/kernel/define_singleton_method_spec.rb
  14. +20 −18 spec/ruby/core/kernel/shared/dup_clone.rb
  15. +15 −0 spec/ruby/core/module/define_method_spec.rb
  16. +18 −6 spec/ruby/core/module/include_spec.rb
  17. +18 −6 spec/ruby/core/module/prepend_spec.rb
  18. +0 −5 spec/ruby/core/nil/dup_spec.rb
  19. +5 −4 spec/ruby/core/process/groups_spec.rb
  20. +26 −2 spec/ruby/core/signal/trap_spec.rb
  21. +3 −0 spec/ruby/core/string/fixtures/freeze_magic_comment.rb
  22. +1 −1 spec/ruby/core/string/shared/each_codepoint_without_block.rb
  23. +28 −19 spec/ruby/core/string/shared/encode.rb
  24. +1 −0 spec/ruby/core/string/shared/eql.rb
  25. +1 −1 spec/ruby/core/string/shared/succ.rb
  26. +2 −2 spec/ruby/core/string/slice_spec.rb
  27. +1 −1 spec/ruby/core/string/squeeze_spec.rb
  28. +1 −1 spec/ruby/core/string/unicode_normalize_spec.rb
  29. +4 −0 spec/ruby/core/string/uplus_spec.rb
  30. +4 −4 spec/ruby/core/string/valid_encoding_spec.rb
  31. +1 −1 spec/ruby/core/symbol/casecmp_spec.rb
  32. +1 −1 spec/ruby/core/time/_dump_spec.rb
  33. +1 −0 spec/ruby/core/time/_load_spec.rb
  34. +16 −3 spec/ruby/core/time/strftime_spec.rb
  35. +1 −1 spec/ruby/default.mspec
  36. +1 −1 spec/ruby/language/regexp/encoding_spec.rb
  37. +1 −1 spec/ruby/language/regexp/escapes_spec.rb
  38. +4 −4 spec/ruby/language/string_spec.rb
  39. +7 −1 spec/ruby/library/net/http/http/fixtures/http_server.rb
  40. +1 −1 spec/ruby/library/openssl/shared/constants.rb
  41. +1 −1 spec/ruby/library/socket/socket/gethostbyname_spec.rb
  42. +2 −5 spec/ruby/library/syslog/constants_spec.rb
  43. +1 −0 spec/ruby/library/zlib/inflate/set_dictionary_spec.rb
  44. +8 −6 spec/ruby/optional/capi/encoding_spec.rb
  45. +34 −13 spec/ruby/optional/capi/string_spec.rb
  46. +1 −1 spec/ruby/shared/complex/equal_value.rb
  47. +8 −3 spec/ruby/shared/process/spawn.rb
  48. +1 −1 spec/ruby/shared/rational/equal_value.rb
  49. +22 −2 spec/ruby/shared/rational/round.rb
  50. +1 −0 spec/tags/ruby/core/file/constants/constants_tags.txt
  51. +1 −0 spec/tags/ruby/core/signal/trap_tags.txt
  52. +1 −0 spec/truffle/tags/core/file/constants/constants_tags.txt
  53. +1 −0 spec/truffle/tags/core/string/uplus_tags.txt
  54. +4 −4 test/check_versions.sh
2 changes: 1 addition & 1 deletion spec/mspec/lib/mspec/mocks/proxy.rb
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ def initialize(val)

def to_int
@calls += 1
@value
@value.to_int
end

def count
16 changes: 16 additions & 0 deletions spec/mspec/spec/mocks/proxy_spec.rb
Original file line number Diff line number Diff line change
@@ -387,3 +387,19 @@
@proxy.yielding?.should be_true
end
end

describe MockIntObject, "#to_int" do
before :each do
@int = MockIntObject.new(10)
end

it "returns the number if to_int is called" do
@int.to_int.should == 10
@int.count.should == [:at_least, 1]
end

it "tries to convert the target to int if to_int is called" do
MockIntObject.new(@int).to_int.should == 10
@int.count.should == [:at_least, 1]
end
end
2 changes: 0 additions & 2 deletions spec/ruby/appveyor.yml
Original file line number Diff line number Diff line change
@@ -3,8 +3,6 @@ version: "{build}"
clone_depth: 5
environment:
matrix:
- RUBY_VERSION: 22
- RUBY_VERSION: 23
- RUBY_VERSION: 23-x64
install:
- SET PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
11 changes: 11 additions & 0 deletions spec/ruby/command_line/fixtures/debug_info.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true
a = 'string'
b = a
c = b
d = c
e = d
begin
a << 'new part'
rescue Exception => e
print e.message
end
7 changes: 7 additions & 0 deletions spec/ruby/command_line/frozen_strings_spec.rb
Original file line number Diff line number Diff line change
@@ -18,6 +18,13 @@
it "produce different objects for literals with the same content in different files if they have different encodings" do
ruby_exe(fixture(__FILE__, "freeze_flag_across_files_diff_enc.rb"), options: "--enable-frozen-string-literal").chomp.should == "true"
end
end

describe "The --debug flag produces" do
it "debugging info on attempted frozen string modification" do
error_str = ruby_exe(fixture(__FILE__, 'debug_info.rb'), options: '--debug', args: "2>&1")
error_str.should include("can't modify frozen String, created at ")
error_str.should include("command_line/fixtures/debug_info.rb:2")
end
end
end
8 changes: 5 additions & 3 deletions spec/ruby/core/file/basename_spec.rb
Original file line number Diff line number Diff line change
@@ -88,14 +88,16 @@
File.basename("bar.txt.exe", ".txt.exe").should == "bar"
end

it "takes into consideration the platform path separator(s)" do
platform_is_not :windows do
platform_is_not :windows do
it "takes into consideration the platform path separator(s)" do
File.basename("C:\\foo\\bar").should == "C:\\foo\\bar"
File.basename("C:/foo/bar").should == "bar"
File.basename("/foo/bar\\baz").should == "bar\\baz"
end
end

platform_is :windows do
platform_is :windows do
it "takes into consideration the platform path separator(s)" do
File.basename("C:\\foo\\bar").should == "bar"
File.basename("C:/foo/bar").should == "bar"
File.basename("/foo/bar\\baz").should == "baz"
12 changes: 12 additions & 0 deletions spec/ruby/core/file/constants/constants_spec.rb
Original file line number Diff line number Diff line change
@@ -29,3 +29,15 @@
end
end
end

ruby_version_is "2.3" do
platform_is :linux do
describe "File::TMPFILE" do
it "is defined" do
# Since Linux 3.11, does not work Travis (probably because built on a older host).
has_tmpfile = !ENV.key?('TRAVIS') && (`uname -r`.chomp.split('.').map(&:to_i) <=> [3,11]) >= 0
File.const_defined?(:TMPFILE).should == has_tmpfile
end
end
end
end
16 changes: 9 additions & 7 deletions spec/ruby/core/file/expand_path_spec.rb
Original file line number Diff line number Diff line change
@@ -222,14 +222,16 @@
ENV["HOME"] = @home
end

it "raises an ArgumentError when passed '~' if HOME is nil" do
ENV.delete "HOME"
lambda { File.expand_path("~") }.should raise_error(ArgumentError)
end
ruby_version_is ''...'2.4' do
it "raises an ArgumentError when passed '~' if HOME is nil" do
ENV.delete "HOME"
lambda { File.expand_path("~") }.should raise_error(ArgumentError)
end

it "raises an ArgumentError when passed '~/' if HOME is nil" do
ENV.delete "HOME"
lambda { File.expand_path("~/") }.should raise_error(ArgumentError)
it "raises an ArgumentError when passed '~/' if HOME is nil" do
ENV.delete "HOME"
lambda { File.expand_path("~/") }.should raise_error(ArgumentError)
end
end

it "raises an ArgumentError when passed '~' if HOME == ''" do
8 changes: 6 additions & 2 deletions spec/ruby/core/file/flock_spec.rb
Original file line number Diff line number Diff line change
@@ -73,9 +73,12 @@
end
end

platform_is :solaris, :java do
describe "File#flock on Solaris or Java" do
platform_is :solaris do
describe "File#flock on Solaris" do
before :each do
@name = tmp("flock_test")
touch(@name)

@read_file = File.open @name, "r"
@write_file = File.open @name, "w"
end
@@ -85,6 +88,7 @@
@read_file.close
@write_file.flock File::LOCK_UN
@write_file.close
rm_r @name
end

it "fails with EBADF acquiring exclusive lock on read-only File" do
27 changes: 18 additions & 9 deletions spec/ruby/core/file/shared/unlink.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe :file_unlink, shared: true do
before :each do
@file1 = 'test.txt'
@file2 = 'test2.txt'
@file1 = tmp('test.txt')
@file2 = tmp('test2.txt')

touch @file1
touch @file2
@@ -39,16 +39,25 @@
end

it "coerces a given parameter into a string if possible" do
class Coercable
def to_str
"test.txt"
end
end

File.send(@method, Coercable.new).should == 1
mock = mock("to_str")
mock.should_receive(:to_str).and_return(@file1)
File.send(@method, mock).should == 1
end

it "accepts an object that has a #to_path method" do
File.send(@method, mock_to_path(@file1)).should == 1
end

ruby_version_is "2.3" do
platform_is :windows do
it "allows deleting an open file with File::SHARE_DELETE" do
path = tmp("share_delete.txt")
File.open(path, mode: File::CREAT | File::WRONLY | File::BINARY | File::SHARE_DELETE) do |f|
File.exist?(path).should be_true
File.send(@method, path)
end
File.exist?(path).should be_false
end
end
end
end
16 changes: 14 additions & 2 deletions spec/ruby/core/float/round_spec.rb
Original file line number Diff line number Diff line change
@@ -70,11 +70,23 @@
0.42.round(2.0**30).should == 0.42
end

ruby_version_is ""..."2.4" do
it "returns big values rounded to nearest" do
+2.5e20.round(-20).should eql( +3 * 10 ** 20 )
-2.5e20.round(-20).should eql( -3 * 10 ** 20 )
end
end

ruby_version_is "2.4" do
it "returns big values rounded to nearest even" do
+2.5e20.round(-20).should eql( +2 * 10 ** 20 )
-2.5e20.round(-20).should eql( -2 * 10 ** 20 )
end
end

# redmine #5272
it "returns rounded values for big values" do
+2.5e20.round(-20).should eql( +3 * 10 ** 20 )
+2.4e20.round(-20).should eql( +2 * 10 ** 20 )
-2.5e20.round(-20).should eql( -3 * 10 ** 20 )
-2.4e20.round(-20).should eql( -2 * 10 ** 20 )
+2.5e200.round(-200).should eql( +3 * 10 ** 200 )
+2.4e200.round(-200).should eql( +2 * 10 ** 200 )
22 changes: 18 additions & 4 deletions spec/ruby/core/integer/round_spec.rb
Original file line number Diff line number Diff line change
@@ -19,15 +19,29 @@
# redmine:5228
it "returns itself rounded if passed a negative value" do
+249.round(-2).should eql(+200)
+250.round(-2).should eql(+300)
-249.round(-2).should eql(-200)
-250.round(-2).should eql(-300)
(+25 * 10**70).round(-71).should eql(+30 * 10**70)
(-25 * 10**70).round(-71).should eql(-30 * 10**70)
(+25 * 10**70 - 1).round(-71).should eql(+20 * 10**70)
(-25 * 10**70 + 1).round(-71).should eql(-20 * 10**70)
end

ruby_version_is ""..."2.4" do
it "returns itself rounded to nearest if passed a negative value" do
+250.round(-2).should eql(+300)
-250.round(-2).should eql(-300)
(+25 * 10**70).round(-71).should eql(+30 * 10**70)
(-25 * 10**70).round(-71).should eql(-30 * 10**70)
end
end

ruby_version_is "2.4" do
it "returns itself rounded to nearest even if passed a negative value" do
+250.round(-2).should eql(+200)
-250.round(-2).should eql(-200)
(+25 * 10**70).round(-71).should eql(+20 * 10**70)
(-25 * 10**70).round(-71).should eql(-20 * 10**70)
end
end

platform_is_not wordsize: 32 do
it "raises a RangeError when passed a big negative value" do
lambda { 42.round(fixnum_min) }.should raise_error(RangeError)
20 changes: 20 additions & 0 deletions spec/ruby/core/kernel/define_singleton_method_spec.rb
Original file line number Diff line number Diff line change
@@ -78,4 +78,24 @@ class DefineMethodByProcClass

DefineMethodByProcClass.proc_test.should == true
end

it "raises an ArgumentError when no block is given" do
obj = Object.new
lambda {
obj.define_singleton_method(:test)
}.should raise_error(ArgumentError)
end

ruby_version_is "2.3" do
it "does not use the caller block when no block is given" do
o = Object.new
def o.define(name)
define_singleton_method(name)
end

lambda {
o.define(:foo) { raise "not used" }
}.should raise_error(ArgumentError)
end
end
end
38 changes: 20 additions & 18 deletions spec/ruby/core/kernel/shared/dup_clone.rb
Original file line number Diff line number Diff line change
@@ -79,23 +79,25 @@ def initialize_copy(original)
o3.untrusted?.should == true
end

it "raises a TypeError for NilClass" do
lambda { nil.send(@method) }.should raise_error(TypeError)
end

it "raises a TypeError for TrueClass" do
lambda { true.send(@method) }.should raise_error(TypeError)
end

it "raises a TypeError for FalseClass" do
lambda { false.send(@method) }.should raise_error(TypeError)
end

it "raises a TypeError for Fixnum" do
lambda { 1.send(@method) }.should raise_error(TypeError)
end

it "raises a TypeError for Symbol" do
lambda { :my_symbol.send(@method) }.should raise_error(TypeError)
ruby_version_is ''...'2.4' do
it "raises a TypeError for NilClass" do
lambda { nil.send(@method) }.should raise_error(TypeError)
end

it "raises a TypeError for TrueClass" do
lambda { true.send(@method) }.should raise_error(TypeError)
end

it "raises a TypeError for FalseClass" do
lambda { false.send(@method) }.should raise_error(TypeError)
end

it "raises a TypeError for Fixnum" do
lambda { 1.send(@method) }.should raise_error(TypeError)
end

it "raises a TypeError for Symbol" do
lambda { :my_symbol.send(@method) }.should raise_error(TypeError)
end
end
end
15 changes: 15 additions & 0 deletions spec/ruby/core/module/define_method_spec.rb
Original file line number Diff line number Diff line change
@@ -222,6 +222,21 @@ class DefineMethodSpecClass
}.should raise_error(ArgumentError)
end

ruby_version_is "2.3" do
it "does not use the caller block when no block is given" do
o = Object.new
def o.define(name)
self.class.class_eval do
define_method(name)
end
end

lambda {
o.define(:foo) { raise "not used" }
}.should raise_error(ArgumentError)
end
end

it "does not change the arity check style of the original proc" do
class DefineMethodSpecClass
prc = Proc.new { || true }
24 changes: 18 additions & 6 deletions spec/ruby/core/module/include_spec.rb
Original file line number Diff line number Diff line change
@@ -163,12 +163,24 @@ module ModuleSpecs::M
}.should raise_error(ArgumentError)
end

it "accepts no-arguments" do
lambda {
Module.new do
include
end
}.should_not raise_error
ruby_version_is ''...'2.4' do
it "accepts no-arguments" do
lambda {
Module.new do
include
end
}.should_not raise_error
end
end

ruby_version_is '2.4' do
it "doesn't accept no-arguments" do
lambda {
Module.new do
include
end
}.should raise_error(ArgumentError)
end
end

it "returns the class it's included into" do
Loading