Skip to content

Commit

Permalink
Showing 82 changed files with 743 additions and 426 deletions.
5 changes: 4 additions & 1 deletion core/src/main/java/org/jruby/runtime/load/LoadService.java
Original file line number Diff line number Diff line change
@@ -308,7 +308,10 @@ protected void addPath(String path) {
if (path == null || path.length() == 0) return;
final RubyArray loadPath = this.loadPath;
synchronized(loadPath) {
loadPath.append(runtime.newString(path.replace('\\', '/')));
final RubyString pathToAdd = runtime.newString(path.replace('\\', '/'));
// Do not add duplicated paths
if (loadPath.includes(runtime.getCurrentContext(), pathToAdd)) return;
loadPath.append(pathToAdd);
}
}

27 changes: 20 additions & 7 deletions lib/ruby/truffle/cext/ruby.h
Original file line number Diff line number Diff line change
@@ -26,8 +26,8 @@ extern "C" {
#define xfree free
#define ALLOC_N(type, n) malloc(sizeof(type) * n)

typedef void *ID;
typedef void *VALUE;
typedef void* ID;
typedef void* VALUE;

// Constants

@@ -46,10 +46,12 @@ VALUE get_rb_eException(void);
VALUE get_rb_cObject(void);
VALUE get_rb_cArray(void);
VALUE get_rb_cHash(void);
VALUE get_rb_mKernel(void);

#define rb_cObject get_rb_cObject()
#define rb_cArray get_rb_cArray()
#define rb_cHash get_rb_cHash()
#define rb_mKernel get_rb_mKernel()

VALUE get_rb_eRuntimeError(void);

@@ -72,8 +74,12 @@ VALUE UINT2NUM(unsigned int value);
VALUE LONG2NUM(long value);
VALUE LONG2FIX(long value);

ID SYM2ID(VALUE value);
VALUE ID2SYM(ID value);

// Type checks

int NIL_P(VALUE value);
int FIXNUM_P(VALUE value);

// Float
@@ -85,13 +91,15 @@ VALUE rb_float_new(double value);
char *RSTRING_PTR(VALUE string);
int RSTRING_LEN(VALUE string);
VALUE rb_intern_str(VALUE string);
VALUE rb_str_new2(const char *string);
VALUE rb_str_new_cstr(const char *string);
#define rb_str_new2 rb_str_new_cstr
void rb_str_cat(VALUE string, const char *to_concat, long length);

// Symbol

ID rb_intern(const char *string);
VALUE ID2SYM(ID id);
ID rb_intern2(const char *string, long length);
#define rb_intern_const(str) rb_intern2((str), strlen(str))

// Array

@@ -141,12 +149,17 @@ void rb_raise(VALUE exception, const char *format, ...);
// Defining classes, modules and methods

VALUE rb_define_class(const char *name, VALUE superclass);
VALUE rb_define_class_under(VALUE module, const char *name, VALUE superclass);
VALUE rb_define_class_id_under(VALUE module, ID name, VALUE superclass);
VALUE rb_define_module(const char *name);
VALUE rb_define_module_under(VALUE module, const char *name);

void rb_define_method(VALUE module, const char *name, void *function, int args);
void rb_define_private_method(VALUE module, const char *name, void *function, int args);
void rb_define_module_function(VALUE module, const char *name, void *function, int args);
void rb_define_method(VALUE module, const char *name, void *function, int argc);
void rb_define_private_method(VALUE module, const char *name, void *function, int argc);
void rb_define_protected_method(VALUE module, const char *name, void *function, int argc);
void rb_define_module_function(VALUE module, const char *name, void *function, int argc);
void rb_define_global_function(const char *name, void *function, int argc);
void rb_define_singleton_method(VALUE object, const char *name, void *function, int argc);

#if defined(__cplusplus)
}
Binary file modified lib/ruby/truffle/cext/ruby.su
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/ruby/truffle/jruby+truffle/gem_ci/activesupport.rb
Original file line number Diff line number Diff line change
@@ -8,5 +8,5 @@

has_to_succeed setup

result run(%w[--require-pattern test/**/*_test.rb -r exclude_tests -- -I test -e nil], raise: false)
result run(%w[--require-pattern test/**/*_test.rb -- -I test -e nil], raise: false)

Original file line number Diff line number Diff line change
@@ -41,16 +41,11 @@
bundler.rb: "module Bundler; def self.setup; end; end"
# mock method_source gem
method_source.rb: nil
exclude_tests.rb: |
failures = { LoadPathsTest: [:test_uniq_load_paths] }
require 'truffle/exclude_rspec_examples'
Truffle.exclude_rspec_examples failures

# do not let bundler to install db gem group
:without:
- db
- job
:before:
# temporary workaround, rake 10.4.2 will not install
- ruby -e 'File.write "../Gemfile.lock", File.read("../Gemfile.lock").gsub(/rake \(10\.4\.2\)/,"rake (11.1.2)")'
13 changes: 8 additions & 5 deletions spec/ruby/core/bignum/coerce_spec.rb
Original file line number Diff line number Diff line change
@@ -29,16 +29,19 @@
lambda { a.coerce(:test) }.should raise_error(TypeError)
end

not_compliant_on :rubinius do
it "raises a TypeError when passed a Float or String" do
ruby_version_is ""..."2.4" do
it "raises a TypeError when passed a String" do
a = bignum_value

lambda { a.coerce(12.3) }.should raise_error(TypeError)
lambda { a.coerce("123") }.should raise_error(TypeError)
end

it "raises a TypeError when passed a Float" do
a = bignum_value
lambda { a.coerce(12.3) }.should raise_error(TypeError)
end
end

deviates_on :rubinius do
ruby_version_is "2.4" do
it "coerces both values to Floats and returns [other, self] when passed a Float" do
a = bignum_value
a.coerce(1.2).should == [1.2, a.to_f]
18 changes: 10 additions & 8 deletions spec/ruby/core/io/puts_spec.rb
Original file line number Diff line number Diff line change
@@ -119,24 +119,26 @@ def @io.write(str)

with_feature :encoding do
it "writes crlf when IO is opened with newline: :crlf" do
File.open(@name, 'w', newline: :crlf) do |file|
File.open(@name, 'wt', newline: :crlf) do |file|
file.puts
end
File.read(@name).should == "\r\n"
File.binread(@name).should == "\r\n"
end

it "writes cr when IO is opened with newline: :cr" do
File.open(@name, 'w', newline: :cr) do |file|
File.open(@name, 'wt', newline: :cr) do |file|
file.puts
end
File.read(@name).should == "\r"
File.binread(@name).should == "\r"
end

it "writes lf when IO is opened with newline: :lf" do
File.open(@name, 'w', newline: :lf) do |file|
file.puts
platform_is_not :windows do # https://bugs.ruby-lang.org/issues/12436
it "writes lf when IO is opened with newline: :lf" do
File.open(@name, 'wt', newline: :lf) do |file|
file.puts
end
File.binread(@name).should == "\n"
end
File.read(@name).should == "\n"
end
end
end
Loading

0 comments on commit fc66125

Please sign in to comment.