mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	Update to ruby/spec@691755d
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									c555bd7f01
								
							
						
					
					
						commit
						52d2636f3e
					
				
					 18 changed files with 134 additions and 26 deletions
				
			
		| 
						 | 
				
			
			@ -1,18 +1,29 @@
 | 
			
		|||
---
 | 
			
		||||
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
 | 
			
		||||
  # 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)
 | 
			
		||||
environment:
 | 
			
		||||
  matrix:
 | 
			
		||||
    - RUBY_VERSION: 23-x64
 | 
			
		||||
    - RUBY_VERSION: 24-x64
 | 
			
		||||
    - RUBY_VERSION: _trunk # So the folder name is ruby_trunk
 | 
			
		||||
install:
 | 
			
		||||
  - SET PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
 | 
			
		||||
  - ruby --version
 | 
			
		||||
  - call "C:\Ruby23-x64\DevKit\devkitvars.bat"
 | 
			
		||||
  - git clone https://github.com/ruby/mspec.git ../mspec
 | 
			
		||||
build: off
 | 
			
		||||
test_script:
 | 
			
		||||
  - SET CHECK_LEAKS=true
 | 
			
		||||
  - ../mspec/bin/mspec -ff
 | 
			
		||||
  - ../mspec/bin/mspec -rdevkit -ff
 | 
			
		||||
on_finish:
 | 
			
		||||
  - ruby -v
 | 
			
		||||
matrix:
 | 
			
		||||
  allow_failures:
 | 
			
		||||
    - ruby_version: _trunk
 | 
			
		||||
branches:
 | 
			
		||||
  only:
 | 
			
		||||
    - master
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,8 +6,7 @@ describe "The -v command line option" do
 | 
			
		|||
 | 
			
		||||
  describe "when used alone" do
 | 
			
		||||
    it "prints version and ends" do
 | 
			
		||||
      version = ruby_exe(nil, args: '--version')
 | 
			
		||||
      ruby_exe(nil, args: '-v').should == version
 | 
			
		||||
      ruby_exe(nil, args: '-v').include?(RUBY_DESCRIPTION).should == true
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -108,6 +108,7 @@ describe "IO.select when passed nil for timeout" do
 | 
			
		|||
    end
 | 
			
		||||
 | 
			
		||||
    Thread.pass while t.status && t.status != "sleep"
 | 
			
		||||
    t.join unless t.status
 | 
			
		||||
    t.status.should == "sleep"
 | 
			
		||||
    t.kill
 | 
			
		||||
    t.join
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,4 +25,11 @@ describe "String#include? with String" do
 | 
			
		|||
    lambda { "hello".include?('h'.ord)  }.should raise_error(TypeError)
 | 
			
		||||
    lambda { "hello".include?(mock('x')) }.should raise_error(TypeError)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "raises an Encoding::CompatibilityError if the encodings are incompatible" do
 | 
			
		||||
    pat = "ア".encode Encoding::EUC_JP
 | 
			
		||||
    lambda do
 | 
			
		||||
      "あれ".include?(pat)
 | 
			
		||||
    end.should raise_error(Encoding::CompatibilityError)
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,5 +2,8 @@ require File.expand_path('../../../spec_helper', __FILE__)
 | 
			
		|||
require 'date'
 | 
			
		||||
 | 
			
		||||
describe "Date#day" do
 | 
			
		||||
  it "needs to be reviewed for spec completeness"
 | 
			
		||||
  it "returns the day" do
 | 
			
		||||
    d = Date.new(2000, 7, 1).day
 | 
			
		||||
    d.should == 1
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,5 +2,8 @@ require File.expand_path('../../../spec_helper', __FILE__)
 | 
			
		|||
require 'date'
 | 
			
		||||
 | 
			
		||||
describe "Date#month" do
 | 
			
		||||
  it "needs to be reviewed for spec completeness"
 | 
			
		||||
  it "returns the month" do
 | 
			
		||||
    m = Date.new(2000, 7, 1).month
 | 
			
		||||
    m.should == 7
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										14
									
								
								spec/ruby/library/date/next_month_spec.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								spec/ruby/library/date/next_month_spec.rb
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,14 @@
 | 
			
		|||
require File.expand_path('../../../spec_helper', __FILE__)
 | 
			
		||||
require 'date'
 | 
			
		||||
 | 
			
		||||
describe "Date#next_month" do
 | 
			
		||||
  it "returns the next month" do
 | 
			
		||||
    d = Date.new(2000, 7, 1).next_month
 | 
			
		||||
    d.should == Date.new(2000, 8, 1)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "returns three months later" do
 | 
			
		||||
    d = Date.new(2000, 7, 1).next_month(3)
 | 
			
		||||
    d.should == Date.new(2000, 10, 1)
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										14
									
								
								spec/ruby/library/date/prev_day_spec.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								spec/ruby/library/date/prev_day_spec.rb
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,14 @@
 | 
			
		|||
require File.expand_path('../../../spec_helper', __FILE__)
 | 
			
		||||
require 'date'
 | 
			
		||||
 | 
			
		||||
describe "Date#prev_day" do
 | 
			
		||||
  it "returns previous day" do
 | 
			
		||||
    d = Date.new(2000, 7, 2).prev_day
 | 
			
		||||
    d.should == Date.new(2000, 7, 1)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "returns three days ago" do
 | 
			
		||||
    d = Date.new(2000, 7, 4).prev_day(3)
 | 
			
		||||
    d.should == Date.new(2000, 7, 1)
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										14
									
								
								spec/ruby/library/date/prev_month_spec.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								spec/ruby/library/date/prev_month_spec.rb
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,14 @@
 | 
			
		|||
require File.expand_path('../../../spec_helper', __FILE__)
 | 
			
		||||
require 'date'
 | 
			
		||||
 | 
			
		||||
describe "Date#prev_month" do
 | 
			
		||||
  it "returns previous month" do
 | 
			
		||||
    d = Date.new(2000, 9, 1).prev_month
 | 
			
		||||
    d.should == Date.new(2000, 8, 1)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "returns three months ago" do
 | 
			
		||||
    d = Date.new(2000, 10, 1).prev_month(3)
 | 
			
		||||
    d.should == Date.new(2000, 7, 1)
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			@ -2,5 +2,8 @@ require File.expand_path('../../../spec_helper', __FILE__)
 | 
			
		|||
require 'date'
 | 
			
		||||
 | 
			
		||||
describe "Date#year" do
 | 
			
		||||
  it "needs to be reviewed for spec completeness"
 | 
			
		||||
  it "returns the year" do
 | 
			
		||||
    y = Date.new(2000, 7, 1).year
 | 
			
		||||
    y.should == 2000
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,7 +10,7 @@ with_feature :fiber_library do
 | 
			
		|||
      # We can always transfer to the root Fiber; it will never die
 | 
			
		||||
      5.times do
 | 
			
		||||
        root.transfer.should be_nil
 | 
			
		||||
        root.alive?.should_not be_false #Workaround for bug #1547
 | 
			
		||||
        root.alive?.should be_true
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -19,39 +19,31 @@ with_feature :fiber_library do
 | 
			
		|||
        this = Fiber.current
 | 
			
		||||
        this.should be_an_instance_of(Fiber)
 | 
			
		||||
        this.should == fiber
 | 
			
		||||
        this.alive?.should_not be_false # Workaround for bug #1547
 | 
			
		||||
        this.alive?.should be_true
 | 
			
		||||
      end
 | 
			
		||||
      fiber.resume
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it "returns the current Fiber when called from a Fiber that transferred to another" do
 | 
			
		||||
 | 
			
		||||
      states = []
 | 
			
		||||
      fiber = Fiber.new do
 | 
			
		||||
        states << :fiber
 | 
			
		||||
        this = Fiber.current
 | 
			
		||||
        this.should be_an_instance_of(Fiber)
 | 
			
		||||
        this.should === fiber
 | 
			
		||||
        this.alive?.should_not be_false # Workaround for bug #1547
 | 
			
		||||
        this.should == fiber
 | 
			
		||||
        this.alive?.should be_true
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      fiber2 = Fiber.new do
 | 
			
		||||
        states << :fiber2
 | 
			
		||||
        fiber.transfer
 | 
			
		||||
        this = Fiber.current
 | 
			
		||||
        this.should be_an_instance_of(Fiber)
 | 
			
		||||
        this.should === fiber2
 | 
			
		||||
        this.alive?.should_not be_false # Workaround for bug #1547
 | 
			
		||||
        flunk
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      fiber3 = Fiber.new do
 | 
			
		||||
        states << :fiber3
 | 
			
		||||
        fiber2.transfer
 | 
			
		||||
        this = Fiber.current
 | 
			
		||||
        this.should be_an_instance_of(Fiber)
 | 
			
		||||
        this.should === fiber3
 | 
			
		||||
        this.alive?.should_not be_false # Workaround for bug #1547
 | 
			
		||||
        fiber2.transfer
 | 
			
		||||
        flunk
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      fiber3.resume
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,9 +7,15 @@ describe "SortedSet#add" do
 | 
			
		|||
 | 
			
		||||
  it "takes only values which responds <=>" do
 | 
			
		||||
    obj = mock('no_comparison_operator')
 | 
			
		||||
    obj.should_receive(:respond_to?).with(:<=>).and_return(false)
 | 
			
		||||
    obj.stub!(:respond_to?).with(:<=>).and_return(false)
 | 
			
		||||
    lambda { SortedSet["hello"].add(obj) }.should raise_error(ArgumentError)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "raises on incompatible <=> comparison" do
 | 
			
		||||
    # Use #to_a here as elements are sorted only when needed.
 | 
			
		||||
    # Therefore the <=> incompatibility is only noticed on sorting.
 | 
			
		||||
    lambda { SortedSet['1', '2'].add(3).to_a }.should raise_error(ArgumentError)
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
describe "SortedSet#add?" do
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,4 +21,10 @@ describe "SortedSet#initialize" do
 | 
			
		|||
    s.should include(4)
 | 
			
		||||
    s.should include(9)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "raises on incompatible <=> comparison" do
 | 
			
		||||
    # Use #to_a here as elements are sorted only when needed.
 | 
			
		||||
    # Therefore the <=> incompatibility is only noticed on sorting.
 | 
			
		||||
    lambda { SortedSet.new(['00', nil]).to_a }.should raise_error(ArgumentError)
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,16 @@ require File.expand_path('../../../../spec_helper', __FILE__)
 | 
			
		|||
require 'set'
 | 
			
		||||
 | 
			
		||||
describe "SortedSet#to_a" do
 | 
			
		||||
  it "returns an array containing elements of self" do
 | 
			
		||||
    SortedSet[1, 2, 3].to_a.sort.should == [1, 2, 3]
 | 
			
		||||
  it "returns an array containing elements" do
 | 
			
		||||
    set = SortedSet.new [1, 2, 3]
 | 
			
		||||
    set.to_a.should == [1, 2, 3]
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "returns a sorted array containing elements" do
 | 
			
		||||
    set = SortedSet[2, 3, 1]
 | 
			
		||||
    set.to_a.should == [1, 2, 3]
 | 
			
		||||
 | 
			
		||||
    set = SortedSet.new [5, 6, 4, 4]
 | 
			
		||||
    set.to_a.should == [4, 5, 6]
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -152,6 +152,12 @@ static VALUE module_specs_rbclass2name(VALUE self, VALUE klass) {
 | 
			
		|||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_RB_MOD_ANCESTORS
 | 
			
		||||
static VALUE module_specs_rb_mod_ancestors(VALUE self, VALUE klass) {
 | 
			
		||||
  return rb_mod_ancestors(klass);
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
void Init_module_spec(void) {
 | 
			
		||||
  VALUE cls;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -245,6 +251,10 @@ void Init_module_spec(void) {
 | 
			
		|||
#ifdef HAVE_RB_CLASS2NAME
 | 
			
		||||
  rb_define_method(cls, "rb_class2name", module_specs_rbclass2name, 1);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_RB_MOD_ANCESTORS
 | 
			
		||||
  rb_define_method(cls, "rb_mod_ancestors", module_specs_rb_mod_ancestors, 1);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -401,6 +401,7 @@
 | 
			
		|||
#define HAVE_RB_DEFINE_PRIVATE_METHOD      1
 | 
			
		||||
#define HAVE_RB_DEFINE_PROTECTED_METHOD    1
 | 
			
		||||
#define HAVE_RB_DEFINE_SINGLETON_METHOD    1
 | 
			
		||||
#define HAVE_RB_MOD_ANCESTORS              1
 | 
			
		||||
#define HAVE_RB_UNDEF                      1
 | 
			
		||||
#define HAVE_RB_UNDEF_METHOD               1
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -339,4 +339,14 @@ describe "CApiModule" do
 | 
			
		|||
      @m.rb_class2name(CApiModuleSpecs::M).should == "CApiModuleSpecs::M"
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe "rb_mod_ancestors" do
 | 
			
		||||
    it "returns an array of ancestors" do
 | 
			
		||||
      one = Module.new
 | 
			
		||||
      two = Module.new do
 | 
			
		||||
        include one
 | 
			
		||||
      end
 | 
			
		||||
      @m.rb_mod_ancestors(two).should == [two, one]
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,11 @@ describe :fiber_resume, shared: true do
 | 
			
		|||
   fiber.send(@method).should == :fiber
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "raises a FiberError if the Fiber tries to resume itself" do
 | 
			
		||||
    fiber = Fiber.new { fiber.resume }
 | 
			
		||||
    -> { fiber.resume }.should raise_error(FiberError, /double resume/)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "raises a FiberError if invoked from a different Thread" do
 | 
			
		||||
    fiber = Fiber.new { }
 | 
			
		||||
    lambda do
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue