Skip to content

Commit

Permalink
Build and test with only 1.8 or 1.9 mode enabled.
Browse files Browse the repository at this point in the history
Closes #1558. Closes #1560.
  • Loading branch information
brixen committed Feb 17, 2012
1 parent 8d30323 commit ccaa717
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -217,7 +217,7 @@ task :spec20 => %w[build vm:test] do
end

desc "Run CI in default (configured) mode but do not rebuild on failure"
task :spec => %w[spec18 spec19]
task :spec => BUILD_CONFIG[:version_list].map { |v| "spec#{v}" }

desc "Print list of items marked to-do in kernel/ (@todo|TODO)"
task :todos do
Expand Down
1 change: 1 addition & 0 deletions configure
Expand Up @@ -199,6 +199,7 @@ class Configure

o.on "--enable-version", "VERSION", "Enable Ruby VERSION support (eg 18,19)" do |v|
@version_list = normalize_versions v
@default_version = @version_list.first if @version_list.size == 1
end

o.doc "\n Compiler settings"
Expand Down
22 changes: 12 additions & 10 deletions spec/command_line/dash_x_version_spec.rb
@@ -1,19 +1,21 @@
require File.expand_path('../../spec_helper', __FILE__)

describe "The -Xversion command line option" do

describe "-X18" do
it "sets RUBY_VERSION to 1.8.7 when RBXOPT specifies 1.9.3" do
opts = { :args => %Q{-e "puts RUBY_VERSION" 2>&1}, :env => { "RBXOPT" => "-X19" }, :options => "-X18" }
ruby_exe(nil, opts).chomp.should == "1.8.7"
ruby_version_is ""..."1.9" do
describe "-X18" do
it "sets RUBY_VERSION to 1.8.7 when RBXOPT specifies 1.9.3" do
opts = { :args => %Q{-e "puts RUBY_VERSION" 2>&1}, :env => { "RBXOPT" => "-X19" }, :options => "-X18" }
ruby_exe(nil, opts).chomp.should == "1.8.7"
end
end
end

describe "-X19" do
it "sets RUBY_VERSION to 1.9.3 when RBXOPT specifies 1.8.7" do
opts = { :args => %Q{-e "puts RUBY_VERSION" 2>&1}, :env => { "RBXOPT" => "-X18" }, :options => "-X19" }
ruby_exe(nil, opts).chomp.should == "1.9.3"
ruby_version_is "1.9" do
describe "-X19" do
it "sets RUBY_VERSION to 1.9.3 when RBXOPT specifies 1.8.7" do
opts = { :args => %Q{-e "puts RUBY_VERSION" 2>&1}, :env => { "RBXOPT" => "-X18" }, :options => "-X19" }
ruby_exe(nil, opts).chomp.should == "1.9.3"
end
end
end

end
4 changes: 1 addition & 3 deletions vm/capi/module.cpp
Expand Up @@ -30,9 +30,7 @@ extern "C" {
}

int rb_const_defined_at(VALUE module_handle, ID const_id) {
NativeMethodEnvironment* env = NativeMethodEnvironment::get();

if(LANGUAGE_18_ENABLED(env->state())) {
if(LANGUAGE_18_ENABLED(NativeMethodEnvironment::get()->state())) {
return rb_funcall(module_handle,
rb_intern("const_defined?"), 1, ID2SYM(const_id));
} else {
Expand Down
10 changes: 8 additions & 2 deletions vm/test/test_fixnum.hpp
@@ -1,5 +1,6 @@
#include "vm/test/test.hpp"

#include "configuration.hpp"
#include "builtin/exception.hpp"
#include "builtin/list.hpp"

Expand Down Expand Up @@ -315,8 +316,13 @@ class TestFixnum : public CxxTest::TestSuite, public VMTest {
TS_ASSERT_EQUALS(Fixnum::from(-1)->pow(state, Fixnum::from(1)), Fixnum::from(-1));
TS_ASSERT_EQUALS(Fixnum::from(-1)->pow(state, Fixnum::from(2)), Fixnum::from(1));
TS_ASSERT_EQUALS(Fixnum::from(7)->pow(state, Fixnum::from(5)), Fixnum::from(16807));
check_float(as<Float>(Fixnum::from(100)->pow(state, Fixnum::from(-1))),
Float::create(state,.01));
}

void test_pow_with_float() {
if(LANGUAGE_18_ENABLED(state)) {
check_float(as<Float>(Fixnum::from(100)->pow(state, Fixnum::from(-1))),
Float::create(state,.01));
}
}

void test_pow_overflows_to_bignum() {
Expand Down

0 comments on commit ccaa717

Please sign in to comment.