Permalink
Browse files

Updated CI specs to RubySpec 56c5528f.

  • Loading branch information...
brixen committed Feb 21, 2013
1 parent 7aa541e commit a842e3734de5251168af6d72387855c0109ed503
View
@@ -13,6 +13,7 @@
optional/ffi/fixtures/build
jruby.1.8.mspec
jruby.1.9.mspec
+rubyspec_temp
# We have to generate this file because it was removed in 1.9.
optional/capi/ext/rubyspec_version.h
View
@@ -0,0 +1,3 @@
+source 'https://rubygems.org'
+gem 'mspec', :github => 'rubyspec/mspec'
+gem 'ffi', :github => 'ffi/ffi'
@@ -6,6 +6,7 @@ The RubySpec files are written using RSpec-compatible syntax. MSpec is a
purpose-built framework for running RubySpec. For more information, see the
http://github.com/rubyspec/mspec project.
+[![Build Status](https://travis-ci.org/rubyspec/rubyspec.png)](https://travis-ci.org/rubyspec/rubyspec)
1. Installing MSpec
@@ -4,8 +4,6 @@ module Module
module WrapIncludeModule
end
-
- DATA = {}
end
def main_public_method
@@ -1,7 +0,0 @@
-module StringRefinement
- refine(String) do
- def foo
- 'foo'
- end
- end
-end
@@ -1,11 +0,0 @@
-using StringRefinement
-
-module MainSpecs
- DATA[:in_module] = 'hello'.foo
-
- def self.call_foo(x)
- x.foo
- end
-end
-
-MainSpecs::DATA[:toplevel] = 'hello'.foo
@@ -1,132 +0,0 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-
-ruby_version_is "2.0.0" do
- require File.expand_path('../fixtures/classes', __FILE__)
- require File.expand_path('../fixtures/string_refinement', __FILE__)
-
- describe "main.using" do
- it "requires one Module argument" do
- lambda do
- eval('using', TOPLEVEL_BINDING)
- end.should raise_error(ArgumentError)
-
- lambda do
- eval('using "foo"', TOPLEVEL_BINDING)
- end.should raise_error(TypeError)
- end
-
- it "uses refinements from the given module only in the target file" do
- load File.expand_path('../fixtures/string_refinement_user.rb', __FILE__)
- MainSpecs::DATA[:in_module].should == 'foo'
- MainSpecs::DATA[:toplevel].should == 'foo'
- lambda do
- 'hello'.foo
- end.should raise_error(NoMethodError)
- end
-
- it "uses refinements from the given module for method calls in the target file" do
- load File.expand_path('../fixtures/string_refinement_user.rb', __FILE__)
- lambda do
- 'hello'.foo
- end.should raise_error(NoMethodError)
- MainSpecs.call_foo('hello').should == 'foo'
- end
-
- it "uses refinements from the given module in the eval string" do
- cls = MainSpecs::DATA[:cls] = Class.new {def foo; 'foo'; end}
- MainSpecs::DATA[:mod] = Module.new do
- refine(cls) do
- def foo; 'bar'; end
- end
- end
- eval(<<-EOS, TOPLEVEL_BINDING).should == 'bar'
- using MainSpecs::DATA[:mod]
- MainSpecs::DATA[:cls].new.foo
- EOS
- end
-
- it "does not affect methods defined before it is called" do
- cls = Class.new {def foo; 'foo'; end}
- MainSpecs::DATA[:mod] = Module.new do
- refine(cls) do
- def foo; 'bar'; end
- end
- end
- x = MainSpecs::DATA[:x] = Object.new
- eval <<-EOS, TOPLEVEL_BINDING
- x = MainSpecs::DATA[:x]
- def x.before_using(obj)
- obj.foo
- end
- using MainSpecs::DATA[:mod]
- def x.after_using(obj)
- obj.foo
- end
- EOS
-
- x.before_using(cls.new).should == 'foo'
- x.after_using(cls.new).should == 'bar'
- end
-
- it "propagates refinements added to existing modules after it is called" do
- cls = Class.new {def foo; 'foo'; end}
- mod = MainSpecs::DATA[:mod] = Module.new do
- refine(cls) do
- def foo; 'quux'; end
- end
- end
- x = MainSpecs::DATA[:x] = Object.new
- eval <<-EOS, TOPLEVEL_BINDING
- using MainSpecs::DATA[:mod]
- x = MainSpecs::DATA[:x]
- def x.call_foo(obj)
- obj.foo
- end
- def x.call_bar(obj)
- obj.bar
- end
- EOS
-
- x.call_foo(cls.new).should == 'quux'
-
- mod.module_eval do
- refine(cls) do
- def bar; 'quux'; end
- end
- end
-
- x.call_bar(cls.new).should == 'quux'
- end
-
- it "does not propagate refinements of new modules added after it is called" do
- cls = Class.new {def foo; 'foo'; end}
- cls2 = Class.new {def bar; 'bar'; end}
- mod = MainSpecs::DATA[:mod] = Module.new do
- refine(cls) do
- def foo; 'quux'; end
- end
- end
- x = MainSpecs::DATA[:x] = Object.new
- eval <<-EOS, TOPLEVEL_BINDING
- using MainSpecs::DATA[:mod]
- x = MainSpecs::DATA[:x]
- def x.call_foo(obj)
- obj.foo
- end
- def x.call_bar(obj)
- obj.bar
- end
- EOS
-
- x.call_foo(cls.new).should == 'quux'
-
- mod.module_eval do
- refine(cls2) do
- def bar; 'quux'; end
- end
- end
-
- x.call_bar(cls2.new).should == 'bar'
- end
- end
-end
@@ -1,104 +0,0 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-
-ruby_version_is "2.0.0" do
- describe "Module#refine" do
- it "runs its block in an anonymous Module" do
- selves = nil
- mod = Module.new do
- outer_self = self
- refine String do
- selves = [outer_self, self]
- end
- end
-
- selves[0].should == mod
- selves[0].should_not == selves[1]
- selves[1].should be_kind_of(Module)
- end
-
- it "uses the same anonymous module for future refines of the same class" do
- selves = []
- mod = Module.new do
- selves << self
- refine String do
- selves << self
- end
- end
-
- mod.module_eval do
- refine String do
- selves << self
- end
- end
-
- selves[1].should == selves[2]
- end
-
- it "adds methods defined in its block to the anon module's public instance methods" do
- inner_self = nil
- mod = Module.new do
- refine String do
- def blah
- "blah"
- end
- inner_self = self
- end
- end
-
- inner_self.public_instance_methods.should include(:blah)
- end
-
- it "raises ArgumentError if not passed an argument" do
- lambda do
- Module.new do
- refine {}
- end
- end.should raise_error(ArgumentError)
- end
-
- it "raises TypeError if not passed a class or module" do
- lambda do
- Module.new do
- refine('foo') {}
- end
- end.should raise_error(TypeError)
- end
-
- it "raises ArgumentError if not given a block" do
- lambda do
- Module.new do
- refine String
- end
- end.should raise_error(ArgumentError)
- end
-
- it "applies refinements to calls in the refine block" do
- result = nil
- Module.new do
- refine(String) do
- def foo; 'foo'; end
- result = 'hello'.foo
- end
- end
- result.should == 'foo'
- end
-
- it "doesn't apply refinements outside the refine block" do
- Module.new do
- refine(String) {def foo; 'foo'; end}
- lambda do
- 'hello'.foo
- end
- should raise_error(NoMethodError)
- end
- end
-
- it "does not apply refinements to external scopes not using the module" do
- Module.new do
- refine(String) {def foo; 'foo'; end}
- end
-
- lambda {'hello'.foo}.should raise_error(NoMethodError)
- end
- end
-end
@@ -223,6 +223,7 @@
describe "ENC_CODERANGE_ASCIIONLY" do
it "returns true if the object encoding is only ASCII" do
str = encode("abc", "us-ascii")
+ str.valid_encoding? # make sure to set the coderange
@s.ENC_CODERANGE_ASCIIONLY(str).should be_true
end
@@ -35,7 +35,7 @@ VALUE kernel_spec_rb_block_proc(VALUE self) {
#ifdef HAVE_RB_BLOCK_CALL
VALUE block_call_inject(VALUE yield_value, VALUE data2) {
- // yield_value yields the first block argument
+ /* yield_value yields the first block argument */
VALUE elem = yield_value;
VALUE elem_incr = INT2FIX(FIX2INT(elem) + 1);
return elem_incr;
@@ -47,7 +47,7 @@ VALUE kernel_spec_rb_block_call(VALUE self, VALUE ary) {
#ifdef RUBY_VERSION_IS_1_9
VALUE block_call_inject_multi_arg(VALUE yield_value, VALUE data2, int argc, VALUE argv[]) {
- // yield_value yields the first block argument
+ /* yield_value yields the first block argument */
VALUE sum = yield_value;
VALUE elem = argv[1];
@@ -18,6 +18,8 @@
#undef HAVE_RBIGNUM_POSITIVE_P
#undef HAVE_RBIGNUM_NEGATIVE_P
#undef HAVE_RB_STR_SET_LEN
+#undef HAVE_RB_BLOCK_CALL
+#undef HAVE_RB_OBJ_METHOD
#endif
#ifdef RUBY_VERSION_IS_1_8_EX_1_9
@@ -320,15 +320,15 @@
#define HAVE_RB_RESCUE2 1
#define HAVE_RB_SET_END_PROC 1
#define HAVE_RB_SYS_FAIL 1
-#ifdef RUBY_VERSION_IS_1_9
+#ifdef RUBY_VERSION_IS_1_9_3
#define HAVE_RB_SYSERR_FAIL 1
+#define HAVE_RB_MAKE_BACKTRACE 1
#endif
#define HAVE_RB_THROW 1
#define HAVE_RB_CATCH 1
#ifdef RUBY_VERSION_IS_1_9
#define HAVE_RB_THROW_OBJ 1
#define HAVE_RB_CATCH_OBJ 1
-#define HAVE_RB_MAKE_BACKTRACE 1
#endif
#define HAVE_RB_WARN 1
#define HAVE_RB_YIELD 1
@@ -40,6 +40,7 @@ static void unblock_func(void *data) {
}
/* Returns true if the thread is interrupted. */
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
static VALUE thread_spec_rb_thread_blocking_region(VALUE self) {
int fds[2];
VALUE ret;
@@ -53,6 +54,7 @@ static VALUE thread_spec_rb_thread_blocking_region(VALUE self) {
close(fds[1]);
return ret;
}
+#pragma GCC diagnostic warning "-Wdeprecated-declarations"
/* This is unblocked by a signal. */
static VALUE blocking_func_for_udf_io(void *data) {
@@ -67,6 +69,7 @@ static VALUE blocking_func_for_udf_io(void *data) {
}
/* Returns true if the thread is interrupted. */
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
static VALUE thread_spec_rb_thread_blocking_region_with_ubf_io(VALUE self) {
int fds[2];
VALUE ret;
@@ -81,6 +84,7 @@ static VALUE thread_spec_rb_thread_blocking_region_with_ubf_io(VALUE self) {
close(fds[1]);
return ret;
}
+#pragma GCC diagnostic warning "-Wdeprecated-declarations"
#endif
#ifdef HAVE_RB_THREAD_CURRENT
@@ -102,6 +106,7 @@ static VALUE thread_spec_rb_thread_local_aset(VALUE self, VALUE thr, VALUE sym,
#endif
#ifdef HAVE_RB_THREAD_SELECT
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
static VALUE thread_spec_rb_thread_select_fd(VALUE self, VALUE fd_num, VALUE msec) {
int fd = NUM2INT(fd_num);
struct timeval tv;
@@ -125,6 +130,7 @@ static VALUE thread_spec_rb_thread_select(VALUE self, VALUE msec) {
rb_thread_select(0, NULL, NULL, NULL, &tv);
return Qnil;
}
+#pragma GCC diagnostic warning "-Wdeprecated-declarations"
#endif
#ifdef HAVE_RB_THREAD_WAKEUP
Oops, something went wrong.

0 comments on commit a842e37

Please sign in to comment.