Skip to content

Commit

Permalink
[GR-47834] Fixes for Cerner plugin applications
Browse files Browse the repository at this point in the history
PullRequest: truffleruby/4003
  • Loading branch information
andrykonchin committed Sep 14, 2023
2 parents 97cf7b1 + 5371c4d commit 82dcdce
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/cext/ABI_check.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2
4
4 changes: 2 additions & 2 deletions lib/cext/include/ruby/internal/core/rarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ long rb_array_len(VALUE a);
int RARRAY_LENINT(VALUE ary);
VALUE *RARRAY_PTR_IMPL(VALUE array);
void rb_ary_store(VALUE, long, VALUE);
VALUE RARRAY_AREF(VALUE array, long index);
VALUE rb_tr_rarray_aref(VALUE array, long index);
#endif
RBIMPL_SYMBOL_EXPORT_END()

Expand Down Expand Up @@ -611,7 +611,7 @@ RARRAY_ASET(VALUE ary, long i, VALUE v)
* transition path, but currently no way is found to do so.
*/
#ifdef TRUFFLERUBY
#define RARRAY_AREF RARRAY_AREF
#define RARRAY_AREF rb_tr_rarray_aref
#else
#define RARRAY_AREF(a, i) RARRAY_CONST_PTR_TRANSIENT(a)[i]
#endif
Expand Down
1 change: 0 additions & 1 deletion lib/cext/include/truffleruby/truffleruby.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ static inline int rb_tr_scan_args_kw_int(int kw_flag, int argc, VALUE *argv, str
if (parse_data.rest || argc <= n_mand + n_opt) {
parse_data.kwargs = false;
erased_kwargs = true;
rb_warn("The last argument is nil, treating as empty keywords");
}
}
else {
Expand Down
4 changes: 4 additions & 0 deletions spec/ruby/library/datetime/rfc2822_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@

describe "DateTime.rfc2822" do
it "needs to be reviewed for spec completeness"

it "raises DateError if passed nil" do
-> { DateTime.rfc2822(nil) }.should raise_error(Date::Error, "invalid date")
end
end
13 changes: 13 additions & 0 deletions spec/ruby/optional/capi/util_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,19 @@
ScratchPad.recorded.should == [1, 7, 4]
end

it "assigns optional arguments with no hash argument given" do
@o.rb_scan_args([1, 7], "02:", 3, @acc).should == 2
ScratchPad.recorded.should == [1, 7, nil]
end

it "assigns optional arguments with no hash argument given and rejects the use of optional nil argument as a hash" do
-> {
@o.rb_scan_args([1, nil], "02:", 3, @acc).should == 2
}.should_not complain

ScratchPad.recorded.should == [1, nil, nil]
end

it "assigns required, optional, splat, post-splat, Hash and block arguments" do
h = {a: 1, b: 2}
@o.rb_scan_args([1, 2, 3, 4, 5, h], "k11*1:&", 6, @acc, &@prc).should == 5
Expand Down
2 changes: 1 addition & 1 deletion src/main/c/cext/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ int RARRAY_LENINT(VALUE array) {
return polyglot_get_array_size(rb_tr_unwrap(array));
}

VALUE RARRAY_AREF(VALUE array, long index) {
VALUE rb_tr_rarray_aref(VALUE array, long index) {
return rb_tr_wrap(polyglot_get_array_element(rb_tr_unwrap(array), (int) index));
}

Expand Down

0 comments on commit 82dcdce

Please sign in to comment.