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: 342e6c2fcdc7
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c93ba6fcab0c
Choose a head ref
  • 3 commits
  • 64 files changed
  • 1 contributor

Commits on Jun 13, 2018

  1. Update to ruby/spec@5f7b4a6

    eregon committed Jun 13, 2018

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    stepankuzmin Stepan Kuzmin
    Copy the full SHA
    ae71696 View commit details
  2. Add tags for failing specs

    eregon committed Jun 13, 2018

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    stepankuzmin Stepan Kuzmin
    Copy the full SHA
    4e543fc View commit details
  3. Update Array#pack buffer tags

    eregon committed Jun 13, 2018

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    stepankuzmin Stepan Kuzmin
    Copy the full SHA
    c93ba6f View commit details
Showing with 2,069 additions and 346 deletions.
  1. +11 −7 spec/ruby/appveyor.yml
  2. +5 −0 spec/ruby/command_line/dash_upper_c_spec.rb
  3. +15 −13 spec/ruby/command_line/dash_upper_i_spec.rb
  4. +2 −2 spec/ruby/core/array/pack/buffer_spec.rb
  5. +8 −0 spec/ruby/core/basicobject/instance_eval_spec.rb
  6. +85 −16 spec/ruby/core/enumerable/all_spec.rb
  7. +14 −28 spec/ruby/core/enumerable/any_spec.rb
  8. +14 −0 spec/ruby/core/enumerable/fixtures/classes.rb
  9. +141 −44 spec/ruby/core/enumerable/none_spec.rb
  10. +133 −26 spec/ruby/core/enumerable/one_spec.rb
  11. +61 −0 spec/ruby/core/exception/dup_spec.rb
  12. +20 −0 spec/ruby/core/exception/fixtures/common.rb
  13. +1 −1 spec/ruby/core/file/expand_path_spec.rb
  14. +16 −14 spec/ruby/core/file/fixtures/file_types.rb
  15. +1 −1 spec/ruby/core/file/open_spec.rb
  16. +1 −1 spec/ruby/core/file/pipe_spec.rb
  17. +1 −1 spec/ruby/core/file/stat/pipe_spec.rb
  18. +15 −0 spec/ruby/core/integer/dup_spec.rb
  19. +1 −1 spec/ruby/core/io/write_spec.rb
  20. +38 −0 spec/ruby/core/kernel/autoload_spec.rb
  21. +9 −0 spec/ruby/core/kernel/fixtures/autoload_from_included_module.rb
  22. +9 −0 spec/ruby/core/kernel/fixtures/autoload_from_included_module2.rb
  23. +43 −0 spec/ruby/core/kernel/fixtures/classes.rb
  24. +20 −0 spec/ruby/core/kernel/shared/then.rb
  25. +8 −0 spec/ruby/core/kernel/then_spec.rb
  26. +56 −0 spec/ruby/core/kernel/warn_spec.rb
  27. +2 −18 spec/ruby/core/kernel/yield_self_spec.rb
  28. +10 −0 spec/ruby/core/marshal/dump_spec.rb
  29. +13 −4 spec/ruby/core/range/case_compare_spec.rb
  30. +133 −6 spec/ruby/core/string/capitalize_spec.rb
  31. +20 −0 spec/ruby/core/string/casecmp_spec.rb
  32. +133 −6 spec/ruby/core/string/downcase_spec.rb
  33. +20 −5 spec/ruby/core/string/dump_spec.rb
  34. +123 −6 spec/ruby/core/string/swapcase_spec.rb
  35. +17 −4 spec/ruby/core/string/uminus_spec.rb
  36. +451 −0 spec/ruby/core/string/undump_spec.rb
  37. +123 −7 spec/ruby/core/string/upcase_spec.rb
  38. +10 −0 spec/ruby/core/thread/backtrace/location/base_label_spec.rb
  39. +10 −0 spec/ruby/core/time/comparison_spec.rb
  40. +23 −0 spec/ruby/core/tracepoint/parameters_spec.rb
  41. +8 −0 spec/ruby/language/send_spec.rb
  42. +3 −7 spec/ruby/language/super_spec.rb
  43. +6 −0 spec/ruby/optional/capi/class_spec.rb
  44. +44 −2 spec/ruby/optional/capi/ext/string_spec.c
  45. +10 −1 spec/ruby/optional/capi/fixtures/class.rb
  46. +60 −8 spec/ruby/optional/capi/string_spec.rb
  47. +5 −8 spec/ruby/security/cve_2011_4815_spec.rb
  48. +24 −30 spec/ruby/security/cve_2017_17742_spec.rb
  49. +36 −42 spec/ruby/security/cve_2018_6914_spec.rb
  50. +31 −37 spec/ruby/security/cve_2018_8780_spec.rb
  51. BIN spec/tags/ruby/core/array/pack/buffer_tags.txt
  52. +3 −0 spec/tags/ruby/core/enumerable/all_tags.txt
  53. +1 −0 spec/tags/ruby/core/enumerable/any_tags.txt
  54. +1 −0 spec/tags/ruby/core/enumerable/none_tags.txt
  55. +1 −0 spec/tags/ruby/core/enumerable/one_tags.txt
  56. +5 −0 spec/tags/ruby/core/kernel/autoload_tags.txt
  57. +4 −0 spec/tags/ruby/core/kernel/warn_tags.txt
  58. +1 −0 spec/tags/ruby/core/marshal/dump_tags.txt
  59. +2 −0 spec/tags/ruby/core/string/capitalize_tags.txt
  60. +2 −0 spec/tags/ruby/core/string/downcase_tags.txt
  61. +2 −0 spec/tags/ruby/core/string/swapcase_tags.txt
  62. +1 −0 spec/tags/ruby/core/string/undump_tags.txt
  63. +2 −0 spec/tags/ruby/core/string/upcase_tags.txt
  64. +1 −0 spec/tags/ruby/core/thread/backtrace/location/base_label_tags.txt
18 changes: 11 additions & 7 deletions spec/ruby/appveyor.yml
Original file line number Diff line number Diff line change
@@ -3,16 +3,20 @@ version: "{build}"
clone_depth: 5
init:
# To avoid duplicated executables in PATH, see https://github.com/ruby/spec/pull/468
- set PATH=C:\ruby%RUBY_VERSION%\bin;C:\Program Files\7-Zip;C:\Program Files\AppVeyor\BuildAgent;C:\Program Files\Git\cmd;C:\Windows\system32;C:\Program Files;C:\Windows
- set PATH=C:\Ruby%ruby_version%\bin;C:\Program Files\7-Zip;C:\Program Files\AppVeyor\BuildAgent;C:\Program Files\Git\cmd;C:\Windows\system32;C:\Program Files;C:\Windows
# Loads trunk build and updates MSYS2 / MinGW to most recent gcc compiler
- if %ruby_version%==_trunk (
appveyor DownloadFile https://ci.appveyor.com/api/projects/MSP-Greg/ruby-loco/artifacts/ruby_trunk.7z -FileName C:\ruby_trunk.7z &
7z x C:\ruby_trunk.7z -oC:\ruby_trunk & C:\ruby_trunk\trunk_msys2.cmd)
- ps: |
if ($env:ruby_version -eq '_trunk') {
$trunk_uri = 'https://ci.appveyor.com/api/projects/MSP-Greg/ruby-loco/artifacts/ruby_trunk.7z'
(New-Object Net.WebClient).DownloadFile($trunk_uri, 'C:\ruby_trunk.7z')
7z.exe x C:\ruby_trunk.7z -oC:\Ruby_trunk
}
environment:
matrix:
- RUBY_VERSION: 23-x64
- RUBY_VERSION: 24-x64
- RUBY_VERSION: _trunk # So the folder name is ruby_trunk
- ruby_version: 24-x64
- ruby_version: 25-x64
- ruby_version: _trunk # So the folder name is ruby_trunk
install:
- git clone https://github.com/ruby/mspec.git ../mspec
build: off
5 changes: 5 additions & 0 deletions spec/ruby/command_line/dash_upper_c_spec.rb
Original file line number Diff line number Diff line change
@@ -11,6 +11,11 @@
output.should == @tempdir
end

it 'does not need a space after -C for the argument' do
output = ruby_exe(@script, options: "-C#{@tempdir}")
output.should == @tempdir
end

it 'changes the PWD when using -e' do
output = ruby_exe(nil, options: "-C #{@tempdir} -e 'print Dir.pwd'")
output.should == @tempdir
28 changes: 15 additions & 13 deletions spec/ruby/command_line/dash_upper_i_spec.rb
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@

it "adds the path at the front of $LOAD_PATH" do
lines = ruby_exe(@script, options: "-I fixtures").lines
if File.basename(ruby_exe[0]) == "miniruby"
if PlatformGuard.implementation? :ruby
# In a MRI checkout, $PWD ends up as the first entry in $LOAD_PATH.
# So just assert that it's at the beginning.
idx = lines.index { |l| l.include?("fixtures") }
@@ -31,19 +31,21 @@
end
end

describe "The -I command line option" do
before :each do
@script = fixture __FILE__, "loadpath.rb"
@fixtures = File.dirname(@script)
@symlink = tmp("loadpath_symlink")
File.symlink(@fixtures, @symlink)
end
platform_is_not :windows do
describe "The -I command line option" do
before :each do
@script = fixture __FILE__, "loadpath.rb"
@fixtures = File.dirname(@script)
@symlink = tmp("loadpath_symlink")
File.symlink(@fixtures, @symlink)
end

after :each do
rm_r @symlink
end
after :each do
rm_r @symlink
end

it "does not expand symlinks" do
ruby_exe(@script, options: "-I #{@symlink}").lines.should include "#{@symlink}\n"
it "does not expand symlinks" do
ruby_exe(@script, options: "-I #{@symlink}").lines.should include "#{@symlink}\n"
end
end
end
4 changes: 2 additions & 2 deletions spec/ruby/core/array/pack/buffer_spec.rb
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
require_relative '../../../spec_helper'

ruby_version_is '2.4' do
describe "Aray#pack with `buffer` option" do
describe "Array#pack with :buffer option" do
it "returns specified buffer" do
n = [ 65, 66, 67 ]
buffer = " "*3
@@ -36,7 +36,7 @@
n.pack("@3ccc", buffer: buffer).should == "123ABC"
end

it "fills the gap with \0 if buffer content is shorter than offset" do
it "fills the gap with \\0 if buffer content is shorter than offset" do
n = [ 65, 66, 67 ]
buffer = "123"
n.pack("@6ccc", buffer: buffer).should == "123\0\0\0ABC"
8 changes: 8 additions & 0 deletions spec/ruby/core/basicobject/instance_eval_spec.rb
Original file line number Diff line number Diff line change
@@ -177,4 +177,12 @@ def meth(arg); arg; end
end
err.backtrace.first.split(":")[0..1].should == ["b_file", "-98"]
end

it "has access to the caller's local variables" do
x = nil

instance_eval "x = :value"

x.should == :value
end
end
101 changes: 85 additions & 16 deletions spec/ruby/core/enumerable/all_spec.rb
Original file line number Diff line number Diff line change
@@ -2,12 +2,11 @@
require_relative 'fixtures/classes'

describe "Enumerable#all?" do

before :each do
@enum = EnumerableSpecs::Numerous.new
@empty = EnumerableSpecs::Empty.new()
@enum1 = [0, 1, 2, -1]
@enum2 = [nil, false, true]
@enum1 = EnumerableSpecs::Numerous.new(0, 1, 2, -1)
@enum2 = EnumerableSpecs::Numerous.new(nil, false, true)
end

it "always returns true on empty enumeration" do
@@ -21,6 +20,21 @@
{}.all? { nil }.should == true
end

it "raises an ArgumentError when more than 1 argument is provided" do
lambda { @enum.all?(1, 2, 3) }.should raise_error(ArgumentError)
lambda { [].all?(1, 2, 3) }.should raise_error(ArgumentError)
lambda { {}.all?(1, 2, 3) }.should raise_error(ArgumentError)
end

ruby_version_is ""..."2.5" do
it "raises an ArgumentError when any arguments provided" do
lambda { @enum.all?(Proc.new {}) }.should raise_error(ArgumentError)
lambda { @enum.all?(nil) }.should raise_error(ArgumentError)
lambda { @empty.all?(1) }.should raise_error(ArgumentError)
lambda { @enum1.all?(1) {} }.should raise_error(ArgumentError)
end
end

it "does not hide exceptions out of #each" do
lambda {
EnumerableSpecs::ThrowingEach.new.all?
@@ -58,16 +72,6 @@
multi = EnumerableSpecs::YieldsMultiWithFalse.new
multi.all?.should be_true
end

ruby_version_is "2.5" do
describe "given a pattern argument" do
# This spec should be replaced by more extensive ones
it "returns true iff all match that pattern" do
@enum.all?(Integer).should == true
@enum2.all?(NilClass).should == false
end
end
end
end

describe "with block" do
@@ -117,14 +121,79 @@

it "gathers initial args as elements when each yields multiple" do
multi = EnumerableSpecs::YieldsMulti.new
multi.all? {|e| !(Array === e) }.should be_true
yielded = []
multi.all? { |e| yielded << e }.should == true
yielded.should == [1, 3, 6]
end

it "yields multiple arguments when each yields multiple" do
multi = EnumerableSpecs::YieldsMulti.new
yielded = []
multi.all? {|e, i| yielded << [e, i] }
yielded.should == [[1, 2], [3, 4], [6, 7]]
multi.all? { |*args| yielded << args }.should == true
yielded.should == [[1, 2], [3, 4, 5], [6, 7, 8, 9]]
end
end

ruby_version_is "2.5" do
describe 'when given a pattern argument' do
it "calls `===` on the pattern the return value " do
pattern = EnumerableSpecs::Pattern.new { |x| x >= 0 }
@enum1.all?(pattern).should == false
pattern.yielded.should == [[0], [1], [2], [-1]]
end

it "ignores block" do
@enum2.all?(NilClass) { raise }.should == false
[1, 2, nil].all?(NilClass) { raise }.should == false
{a: 1}.all?(Array) { raise }.should == true
end

it "always returns true on empty enumeration" do
@empty.all?(Integer).should == true
[].all?(Integer).should == true
{}.all?(NilClass).should == true
end

it "does not hide exceptions out of #each" do
lambda {
EnumerableSpecs::ThrowingEach.new.all?(Integer)
}.should raise_error(RuntimeError)
end

it "returns true if the pattern never returns false or nil" do
pattern = EnumerableSpecs::Pattern.new { |x| 42 }
@enum.all?(pattern).should == true

[1, 42, 3].all?(pattern).should == true

pattern = EnumerableSpecs::Pattern.new { |x| Array === x }
{a: 1, b: 2}.all?(pattern).should == true
end

it "returns false if the pattern ever returns false or nil" do
pattern = EnumerableSpecs::Pattern.new { |x| x >= 0 }
@enum1.all?(pattern).should == false
pattern.yielded.should == [[0], [1], [2], [-1]]

[1, 2, 3, -1].all?(pattern).should == false

pattern = EnumerableSpecs::Pattern.new { |x| x[1] >= 0 }
{a: 1, b: -1}.all?(pattern).should == false
end

it "does not hide exceptions out of pattern#===" do
pattern = EnumerableSpecs::Pattern.new { raise "from pattern" }
lambda {
@enum.all?(pattern)
}.should raise_error(RuntimeError)
end

it "calls the pattern with gathered array when yielded with multiple arguments" do
multi = EnumerableSpecs::YieldsMulti.new
pattern = EnumerableSpecs::Pattern.new { true }
multi.all?(pattern).should == true
pattern.yielded.should == [[[1, 2]], [[3, 4, 5]], [[6, 7, 8, 9]]]
end
end
end
end
42 changes: 14 additions & 28 deletions spec/ruby/core/enumerable/any_spec.rb
Original file line number Diff line number Diff line change
@@ -4,9 +4,9 @@
describe "Enumerable#any?" do
before :each do
@enum = EnumerableSpecs::Numerous.new
@empty = EnumerableSpecs::Empty.new()
@enum1 = [0, 1, 2, -1]
@enum2 = [nil, false, true]
@empty = EnumerableSpecs::Empty.new
@enum1 = EnumerableSpecs::Numerous.new(0, 1, 2, -1)
@enum2 = EnumerableSpecs::Numerous.new(nil, false, true)
end

it "always returns false on empty enumeration" do
@@ -86,7 +86,7 @@
@enum2.any? { |i| i == nil }.should == true
end

it "any? should return false if the block never returns other than false or nil" do
it "returns false if the block never returns other than false or nil" do
@enum.any? { false }.should == false
@enum.any? { nil }.should == false

@@ -134,32 +134,21 @@

it "gathers initial args as elements when each yields multiple" do
multi = EnumerableSpecs::YieldsMulti.new
multi.any? {|e| e == 1 }.should be_true
yielded = []
multi.any? { |e| yielded << e; false }.should == false
yielded.should == [1, 3, 6]
end

it "yields multiple arguments when each yields multiple" do
multi = EnumerableSpecs::YieldsMulti.new
yielded = []
multi.any? {|e, i| yielded << [e, i] }
yielded.should == [[1, 2]]
multi.any? { |*args| yielded << args; false }.should == false
yielded.should == [[1, 2], [3, 4, 5], [6, 7, 8, 9]]
end

end

ruby_version_is "2.5" do
describe 'when given a pattern argument' do
class EnumerableSpecs::Pattern
attr_reader :yielded
def initialize(&block)
@block = block
@yielded = []
end
def ===(*args)
@yielded << args
@block.call(*args)
end
end

it "calls `===` on the pattern the return value " do
pattern = EnumerableSpecs::Pattern.new { |x| x == 2 }
@enum1.any?(pattern).should == true
@@ -195,7 +184,7 @@ def ===(*args)
{a: 1, b: 2}.any?(pattern).should == true
end

it "any? should return false if the block never returns other than false or nil" do
it "returns false if the block never returns other than false or nil" do
pattern = EnumerableSpecs::Pattern.new { |x| nil }
@enum1.any?(pattern).should == false
pattern.yielded.should == [[0], [1], [2], [-1]]
@@ -204,21 +193,18 @@ def ===(*args)
{a: 1}.any?(pattern).should == false
end

it "does not hide exceptions out of the block" do
it "does not hide exceptions out of pattern#===" do
pattern = EnumerableSpecs::Pattern.new { raise "from pattern" }
lambda {
@enum.any?(pattern)
}.should raise_error(RuntimeError)
end

it "calls the pattern with gathered array when yielded with multiple arguments" do
multi = EnumerableSpecs::YieldsMulti.new
pattern = EnumerableSpecs::Pattern.new { false }
EnumerableSpecs::YieldsMixed2.new.any?(pattern).should == false
pattern.yielded.should == EnumerableSpecs::YieldsMixed2.gathered_yields.map { |x| [x] }

pattern = EnumerableSpecs::Pattern.new { false }
{a: 1, b: 2}.any?(pattern).should == false
pattern.yielded.should == [[[:a, 1]], [[:b, 2]]]
multi.any?(pattern).should == false
pattern.yielded.should == [[[1, 2]], [[3, 4, 5]], [[6, 7, 8, 9]]]
end
end
end
14 changes: 14 additions & 0 deletions spec/ruby/core/enumerable/fixtures/classes.rb
Original file line number Diff line number Diff line change
@@ -328,4 +328,18 @@ def map(&block)
EnumerableMapping.new(self, block)
end
end

class Pattern
attr_reader :yielded

def initialize(&block)
@block = block
@yielded = []
end

def ===(*args)
@yielded << args
@block.call(*args)
end
end
end # EnumerableSpecs utility classes
Loading